WC_WCCOM_Site_Installer::do_install_step()
Perform product installation step.
Method of the class: WC_WCCOM_Site_Installer{}
No Hooks.
Return
null
. Nothing.
Usage
$result = WC_WCCOM_Site_Installer::do_install_step( $product_id, $install_args, $step, $upgrader );
- $product_id(int) (required)
- Product ID.
- $install_args(array) (required)
- Install args.
- $step(string) (required)
- Installation step.
- $upgrader(\WP_Upgrader) (required)
- Core class to handle installation.
Changelog
Since 3.7.0 | Introduced. |
WC_WCCOM_Site_Installer::do_install_step() WC WCCOM Site Installer::do install step code WC 7.7.0
private static function do_install_step( $product_id, $install_args, $step, $upgrader ) { $state_steps = self::get_state( 'steps' ); if ( empty( $state_steps[ $product_id ] ) ) { $state_steps[ $product_id ] = self::$default_step_state; } if ( ! empty( $state_steps[ $product_id ]['last_error'] ) ) { return; } $state_steps[ $product_id ]['last_step'] = $step; if ( ! empty( $install_args['activate'] ) ) { $state_steps[ $product_id ]['activate'] = true; } self::update_state( 'current_step', array( 'product_id' => $product_id, 'step' => $step, ) ); $result = call_user_func( array( __CLASS__, $step ), $product_id, $upgrader ); if ( is_wp_error( $result ) ) { $state_steps[ $product_id ]['last_error'] = $result->get_error_message(); } else { switch ( $step ) { case 'get_product_info': $state_steps[ $product_id ]['download_url'] = $result['download_url']; $state_steps[ $product_id ]['product_type'] = $result['product_type']; $state_steps[ $product_id ]['product_name'] = $result['product_name']; break; case 'download_product': $state_steps[ $product_id ]['download_path'] = $result; break; case 'unpack_product': $state_steps[ $product_id ]['unpacked_path'] = $result; break; case 'move_product': $state_steps[ $product_id ]['installed_path'] = $result['destination']; if ( isset( $result[ self::$folder_exists ] ) ) { $state_steps[ $product_id ]['warning'] = array( 'message' => self::$folder_exists, 'plugin_info' => self::get_plugin_info( $state_steps[ $product_id ]['installed_path'] ), ); } break; } } self::update_state( 'steps', $state_steps ); }