Automattic\WooCommerce\Blueprint\Importers
ImportActivatePlugin::process
Process the schema.
Method of the class: ImportActivatePlugin{}
No Hooks.
Returns
StepProcessorResult.
Usage
$ImportActivatePlugin = new ImportActivatePlugin(); $ImportActivatePlugin->process( $schema ): StepProcessorResult;
- $schema(object) (required)
- The schema to process.
ImportActivatePlugin::process() ImportActivatePlugin::process code WC 10.7.0
public function process( $schema ): StepProcessorResult {
$result = StepProcessorResult::success( ActivatePlugin::get_step_name() );
// Not snake case because it's a property of the schema.
$plugin_path = $schema->pluginPath; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$activate = $this->wp_activate_plugin( $plugin_path );
if ( $this->is_wp_error( $activate ) ) {
$result->add_error( "Unable to activate {$plugin_path}." );
} else {
$result->add_info( "Activated {$plugin_path}." );
}
return $result;
}