← All changes
|
libraries/action-scheduler/classes/migration/Controller.php
+34
-9
2.7.2
→
3.1.1
View file →
| @@ -18,20 +18,41 @@ | ||
| 18 | 18 | * |
| 19 | 19 | * @codeCoverageIgnore |
| 20 | 20 | */ |
| 21 | 21 | class Controller { |
| 22 | + /** | |
| 23 | + * Instance. | |
| 24 | + * | |
| 25 | + * @var self | |
| 26 | + */ | |
| 22 | 27 | private static $instance; |
| 23 | 28 | |
| 24 | - /** @var Action_Scheduler\Migration\Scheduler */ | |
| 29 | + /** | |
| 30 | + * Scheduler instance. | |
| 31 | + * | |
| 32 | + * @var Action_Scheduler\Migration\Scheduler | |
| 33 | + */ | |
| 25 | 34 | private $migration_scheduler; |
| 26 | 35 | |
| 27 | - /** @var string */ | |
| 36 | + /** | |
| 37 | + * Class name of the store object. | |
| 38 | + * | |
| 39 | + * @var string | |
| 40 | + */ | |
| 28 | 41 | private $store_classname; |
| 29 | 42 | |
| 30 | - /** @var string */ | |
| 43 | + /** | |
| 44 | + * Class name of the logger object. | |
| 45 | + * | |
| 46 | + * @var string | |
| 47 | + */ | |
| 31 | 48 | private $logger_classname; |
| 32 | 49 | |
| 33 | - /** @var bool */ | |
| 50 | + /** | |
| 51 | + * Flag to indicate migrating custom store. | |
| 52 | + * | |
| 53 | + * @var bool | |
| 54 | + */ | |
| 34 | 55 | private $migrate_custom_store; |
| 35 | 56 | |
| 36 | 57 | /** |
| 37 | 58 | * Controller constructor. |
| @@ -141,9 +162,9 @@ | ||
| 141 | 162 | $config->set_progress_bar( new ProgressBar( '', 0 ) ); |
| 142 | 163 | } |
| 143 | 164 | } |
| 144 | 165 | |
| 145 | - return apply_filters( 'action_scheduler/migration_config', $config ); | |
| 166 | + return apply_filters( 'action_scheduler/migration_config', $config ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores | |
| 146 | 167 | } |
| 147 | 168 | |
| 148 | 169 | /** |
| 149 | 170 | * Hook dashboard migration notice. |
| @@ -158,9 +179,15 @@ | ||
| 158 | 179 | /** |
| 159 | 180 | * Show a dashboard notice that migration is in progress. |
| 160 | 181 | */ |
| 161 | 182 | public function display_migration_notice() { |
| 162 | - printf( '<div class="notice notice-warning"><p>%s</p></div>', esc_html__( 'Action Scheduler migration in progress. The list of scheduled actions may be incomplete.', 'action-scheduler' ) ); | |
| 183 | + wp_admin_notice( | |
| 184 | + __( 'Action Scheduler migration in progress. The list of scheduled actions may be incomplete.', 'action-scheduler' ), | |
| 185 | + array( | |
| 186 | + 'type' => 'warning', | |
| 187 | + 'paragraph_wrap' => true, | |
| 188 | + ) | |
| 189 | + ); | |
| 163 | 190 | } |
| 164 | 191 | |
| 165 | 192 | /** |
| 166 | 193 | * Add store classes. Hook migration. |
| @@ -170,9 +197,9 @@ | ||
| 170 | 197 | add_filter( 'action_scheduler_logger_class', array( $this, 'get_logger_class' ), 100, 1 ); |
| 171 | 198 | add_action( 'init', array( $this, 'maybe_hook_migration' ) ); |
| 172 | 199 | add_action( 'wp_loaded', array( $this, 'schedule_migration' ) ); |
| 173 | 200 | |
| 174 | - // Action Scheduler may be displayed as a Tools screen or WooCommerce > Status administration screen | |
| 201 | + // Action Scheduler may be displayed as a Tools screen or WooCommerce > Status administration screen. | |
| 175 | 202 | add_action( 'load-tools_page_action-scheduler', array( $this, 'hook_admin_notices' ), 10, 0 ); |
| 176 | 203 | add_action( 'load-woocommerce_page_wc-status', array( $this, 'hook_admin_notices' ), 10, 0 ); |
| 177 | 204 | } |
| 178 | 205 | |
| @@ -177,10 +204,8 @@ | ||
| 177 | 204 | } |
| 178 | 205 | |
| 179 | 206 | /** |
| 180 | 207 | * Possibly hook the migration scheduler action. |
| 181 | - * | |
| 182 | - * @author Jeremy Pry | |
| 183 | 208 | */ |
| 184 | 209 | public function maybe_hook_migration() { |
| 185 | 210 | if ( ! $this->allow_migration() || \ActionScheduler_DataController::is_migration_complete() ) { |
| 186 | 211 | return; |