WC_WCCOM_Site_Installation_Step_Activate_Product::activate_plugin()
Activate plugin.
Метод класса: WC_WCCOM_Site_Installation_Step_Activate_Product{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->activate_plugin( $product_id );
- $product_id(int) (обязательный)
- Product ID.
Код WC_WCCOM_Site_Installation_Step_Activate_Product::activate_plugin() WC WCCOM Site Installation Step Activate Product::activate plugin WC 9.8.2
private function activate_plugin( $product_id ) { // Clear plugins cache used in `WC_Helper::get_local_woo_plugins`. wp_clean_plugins_cache(); $filename = false; // If product is WP.org one, find out its filename. $dir_name = $this->get_wporg_product_dir_name(); if ( false !== $dir_name ) { $filename = \WC_WCCOM_Site_Installer::get_wporg_plugin_main_file( $dir_name ); } if ( false === $filename ) { $plugins = wp_list_filter( WC_Helper::get_local_woo_plugins(), array( '_product_id' => $product_id, ) ); $filename = is_array( $plugins ) && ! empty( $plugins ) ? key( $plugins ) : ''; } if ( empty( $filename ) ) { throw new Installer_Error( Installer_Error_Codes::UNKNOWN_FILENAME ); } // If the plugin is already active, make sure we call the registration hook. if ( is_plugin_active( $filename ) ) { WC_Helper::activated_plugin( $filename ); } $result = activate_plugin( $filename ); if ( is_wp_error( $result ) ) { throw new Installer_Error( Installer_Error_Codes::PLUGIN_ACTIVATION_ERROR, $result->get_error_message() ); } }