Action_Scheduler\WP_CLI

Migration_Command::register()publicWC 1.0

Register the command with WP-CLI

Метод класса: Migration_Command{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

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

Код Migration_Command::register() WC 8.7.0

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

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