diff --git a/inc/Dependencies/ActionScheduler/classes/WP_CLI/Migration_Command.php b/inc/Dependencies/ActionScheduler/classes/WP_CLI/Migration_Command.php index 066697e4e..c6ddb2b53 100644 --- a/inc/Dependencies/ActionScheduler/classes/WP_CLI/Migration_Command.php +++ b/inc/Dependencies/ActionScheduler/classes/WP_CLI/Migration_Command.php @@ -7,6 +7,7 @@ use Action_Scheduler\Migration\Runner; use Action_Scheduler\Migration\Scheduler; use Action_Scheduler\Migration\Controller; +use Exception; use WP_CLI; use WP_CLI_Command; @@ -86,12 +87,14 @@ public function migrate( $positional_args, $assoc_args ) { $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 ); - + try { + do { + $actions_processed = $runner->run( $batch_size ); + $this->total_processed += $actions_processed; + } while ( $actions_processed > 0 ); + } catch ( Exception $e) { + WP_CLI::warning( $e->getMessage() ); + } if ( ! $config->get_dry_run() ) { // let the scheduler know that there's nothing left to do $scheduler = new Scheduler(); diff --git a/inc/Dependencies/ActionScheduler/classes/migration/Scheduler.php b/inc/Dependencies/ActionScheduler/classes/migration/Scheduler.php index dcbe2db5f..ea4030d5c 100644 --- a/inc/Dependencies/ActionScheduler/classes/migration/Scheduler.php +++ b/inc/Dependencies/ActionScheduler/classes/migration/Scheduler.php @@ -2,6 +2,7 @@ namespace Action_Scheduler\Migration; +use WP_CLI; /** * Class Scheduler @@ -38,7 +39,11 @@ public function unhook() { */ public function run_migration() { $migration_runner = $this->get_migration_runner(); - $count = $migration_runner->run( $this->get_batch_size() ); + try { + $count = $migration_runner->run( $this->get_batch_size() ); + } catch (\Exception $e) { + WP_CLI::warning( $e->getMessage() ); + } if ( $count === 0 ) { $this->mark_complete();