Automattic\WooCommerce\Blueprint\Importers

ImportInstallPlugin::installprotectedWC 1.0

Installs a plugin from the given local path.

Method of the class: ImportInstallPlugin{}

No Hooks.

Returns

true|false|WP_Error. True on success, WP_Error on failure.

Usage

// protected - for code of main (parent) or child class
$result = $this->install( $local_plugin_path );
$local_plugin_path(string) (required)
Path to the local plugin file.

ImportInstallPlugin::install() code WC 9.9.5

protected function install( $local_plugin_path ) {
	if ( ! class_exists( 'Plugin_Upgrader' ) ) {
		include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
		include_once ABSPATH . '/wp-admin/includes/class-plugin-upgrader.php';
	}

	$upgrader = new \Plugin_Upgrader( new \Automatic_Upgrader_Skin() );
	return $upgrader->install( $local_plugin_path );
}