Automattic\WooCommerce\Admin

PluginsHelper::schedule_activate_plugins()public staticWC 1.0

Schedule plugin activation.

Method of the class: PluginsHelper{}

No Hooks.

Return

String. Job ID.

Usage

$result = PluginsHelper::schedule_activate_plugins( $plugins );
$plugins(array) (required)
Plugins to activate.

PluginsHelper::schedule_activate_plugins() code WC 9.3.3

public static function schedule_activate_plugins( $plugins ) {
	if ( empty( $plugins ) || ! is_array( $plugins ) ) {
		return new WP_Error(
			'woocommerce_plugins_invalid_plugins',
			__( 'Plugins must be a non-empty array.', 'woocommerce' ),
			404
		);
	}

	$job_id = uniqid();
	WC()->queue()->schedule_single(
		time() + 5,
		'woocommerce_plugins_activate_callback',
		array( $plugins, $job_id )
	);

	return $job_id;
}