Action_Scheduler\WP_CLI

Migration_Command::migrate()publicWC 1.0

Process the data migration.

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

Хуков нет.

Возвращает

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

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

$Migration_Command = new Migration_Command();
$Migration_Command->migrate( $positional_args, $assoc_args );
$positional_args(массив) (обязательный)
Required for WP CLI. Not used in migration.
$assoc_args(массив) (обязательный)
Optional arguments.

Код Migration_Command::migrate() WC 9.8.5

public function migrate( $positional_args, $assoc_args ) {
	$this->init_logging();

	$config = $this->get_migration_config( $assoc_args );
	$runner = new Runner( $config );
	$runner->init_destination();

	$batch_size = isset( $assoc_args['batch-size'] ) ? (int) $assoc_args['batch-size'] : 100;
	$free_on    = isset( $assoc_args['free-memory-on'] ) ? (int) $assoc_args['free-memory-on'] : 50;
	$sleep      = isset( $assoc_args['pause'] ) ? (int) $assoc_args['pause'] : 0;
	\ActionScheduler_DataController::set_free_ticks( $free_on );
	\ActionScheduler_DataController::set_sleep_time( $sleep );

	do {
		$actions_processed      = $runner->run( $batch_size );
		$this->total_processed += $actions_processed;
	} while ( $actions_processed > 0 );

	if ( ! $config->get_dry_run() ) {
		// let the scheduler know that there's nothing left to do.
		$scheduler = new Scheduler();
		$scheduler->mark_complete();
	}

	WP_CLI::success( sprintf( '%s complete. %d actions processed.', $config->get_dry_run() ? 'Dry run' : 'Migration', $this->total_processed ) );
}