Action_Scheduler\Migration

Controller::schedule_migration()publicWC 1.0

Set up the background migration process.

Method of the class: Controller{}

No Hooks.

Return

null. Nothing (null).

Usage

$Controller = new Controller();
$Controller->schedule_migration();

Controller::schedule_migration() code WC 8.6.1

public function schedule_migration() {
	$logging_tables = new ActionScheduler_LoggerSchema();
	$store_tables   = new ActionScheduler_StoreSchema();

	/*
	 * In some unusual cases, the expected tables may not have been created. In such cases
	 * we do not schedule a migration as doing so will lead to fatal error conditions.
	 *
	 * In such cases the user will likely visit the Tools > Scheduled Actions screen to
	 * investigate, and will see appropriate messaging (this step also triggers an attempt
	 * to rebuild any missing tables).
	 *
	 * @see https://github.com/woocommerce/action-scheduler/issues/653
	 */
	if (
		ActionScheduler_DataController::is_migration_complete()
		|| $this->migration_scheduler->is_migration_scheduled()
		|| ! $store_tables->tables_exist()
		|| ! $logging_tables->tables_exist()
	) {
		return;
	}

	$this->migration_scheduler->schedule_migration();
}