Action_Scheduler\WP_CLI

Migration_Command::registerpublicWC 1.0

Register the command with WP-CLI

Method of the class: Migration_Command{}

No Hooks.

Returns

null. Nothing (null).

Usage

$Migration_Command = new Migration_Command();
$Migration_Command->register();

Migration_Command::register() code WC 11.0.1

public function register() {
	if ( ! defined( 'WP_CLI' ) || ! WP_CLI ) {
		return;
	}

	WP_CLI::add_command(
		'action-scheduler migrate',
		array( $this, 'migrate' ),
		array(
			'shortdesc' => 'Migrates actions to the DB tables store',
			'synopsis'  => array(
				array(
					'type'        => 'assoc',
					'name'        => 'batch-size',
					'optional'    => true,
					'default'     => 100,
					'description' => 'The number of actions to process in each batch',
				),
				array(
					'type'        => 'assoc',
					'name'        => 'free-memory-on',
					'optional'    => true,
					'default'     => 50,
					'description' => 'The number of actions to process between freeing memory. 0 disables freeing memory',
				),
				array(
					'type'        => 'assoc',
					'name'        => 'pause',
					'optional'    => true,
					'default'     => 0,
					'description' => 'The number of seconds to pause when freeing memory',
				),
				array(
					'type'        => 'flag',
					'name'        => 'dry-run',
					'optional'    => true,
					'description' => 'Reports on the actions that would have been migrated, but does not change any data',
				),
			),
		)
	);
}