Automattic\WooCommerce\Blueprint\Importers

ImportInstallPlugin::installprotectedWC 1.0

Installs a plugin from the given local path.

Метод класса: ImportInstallPlugin{}

Хуков нет.

Возвращает

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

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->install( $local_plugin_path );
$local_plugin_path(строка) (обязательный)
Path to the local plugin file.

Код ImportInstallPlugin::install() WC 10.0.2

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 );
}