← All changes
|
libraries/action-scheduler/classes/migration/Scheduler.php
+6
-6
2.7.9
→
3.1.1
View file →
| @@ -13,12 +13,12 @@ | ||
| 13 | 13 | * @codeCoverageIgnore |
| 14 | 14 | */ |
| 15 | 15 | class Scheduler { |
| 16 | 16 | /** Migration action hook. */ |
| 17 | - const HOOK = 'action_scheduler/migration_hook'; | |
| 17 | + const HOOK = 'action_scheduler/migration_hook'; | |
| 18 | 18 | |
| 19 | 19 | /** Migration action group. */ |
| 20 | - const GROUP = 'action-scheduler-migration'; | |
| 20 | + const GROUP = 'action-scheduler-migration'; | |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Set up the callback for the scheduled job. |
| 24 | 24 | */ |
| @@ -39,9 +39,9 @@ | ||
| 39 | 39 | public function run_migration() { |
| 40 | 40 | $migration_runner = $this->get_migration_runner(); |
| 41 | 41 | $count = $migration_runner->run( $this->get_batch_size() ); |
| 42 | 42 | |
| 43 | - if ( $count === 0 ) { | |
| 43 | + if ( 0 === $count ) { | |
| 44 | 44 | $this->mark_complete(); |
| 45 | 45 | } else { |
| 46 | 46 | $this->schedule_migration( time() + $this->get_schedule_interval() ); |
| 47 | 47 | } |
| @@ -53,9 +53,9 @@ | ||
| 53 | 53 | public function mark_complete() { |
| 54 | 54 | $this->unschedule_migration(); |
| 55 | 55 | |
| 56 | 56 | \ActionScheduler_DataController::mark_migration_complete(); |
| 57 | - do_action( 'action_scheduler/migration_complete' ); | |
| 57 | + do_action( 'action_scheduler/migration_complete' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Get a flag indicating whether the migration is scheduled. |
| @@ -101,9 +101,9 @@ | ||
| 101 | 101 | * |
| 102 | 102 | * @return int Seconds between migration runs. Defaults to 0 seconds to allow chaining migration via Async Runners. |
| 103 | 103 | */ |
| 104 | 104 | private function get_schedule_interval() { |
| 105 | - return (int) apply_filters( 'action_scheduler/migration_interval', 0 ); | |
| 105 | + return (int) apply_filters( 'action_scheduler/migration_interval', 0 ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | 109 | * Get migration batch size. |
| @@ -110,9 +110,9 @@ | ||
| 110 | 110 | * |
| 111 | 111 | * @return int Number of actions to migrate in each batch. Defaults to 250. |
| 112 | 112 | */ |
| 113 | 113 | private function get_batch_size() { |
| 114 | - return (int) apply_filters( 'action_scheduler/migration_batch_size', 250 ); | |
| 114 | + return (int) apply_filters( 'action_scheduler/migration_batch_size', 250 ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * Get migration runner object. |