PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / trunk
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell vtrunk
3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 2.8.17 2.8.18 All 259 releases
wpfunnels / admin / Migrations / MigrationManager.php

MigrationManager.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell trunk, at admin/Migrations/MigrationManager.php

67 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPFunnels\Admin\Migrations;
4
5 use WPFunnels\Admin\BatchProcessing\BatchProcessingController;
6
7 /**
8 * Class MigrationManager
9 *
10 * Manages the migration process by scheduling and enqueuing migration instances.
11 *
12 * @package WPFunnels\Admin\Migrations
13 * @since 3.5.0
14 */
15 class MigrationManager
16 {
17
18 /**
19 * Batch processing controller instance.
20 *
21 * @var BatchProcessingController
22 */
23 public $batchProcessingController;
24
25
26 /**
27 * Array of migration instances.
28 *
29 * @var array
30 */
31 public static $migration_instances = array(
32 'order_stat_migration' => 'WPFunnels\\Admin\\Migrations\\OrderToStatTableMigration',
33 'stat_status_sync' => 'WPFunnels\\Admin\\Migrations\\StatStatusSyncMigration',
34 );
35
36
37 /**
38 * MigrationManager constructor.
39 *
40 * @param BatchProcessingController $batchProcessingController The batch processing controller instance.
41 * @since 3.5.0
42 */
43 public function __construct(BatchProcessingController $batchProcessingController)
44 {
45 $this->batchProcessingController = $batchProcessingController;
46 $this->schedule_action();
47 }
48
49
50 /**
51 * Schedule migration actions.
52 *
53 * Iterates over migration instances and enqueues them if they should be processed.
54 *
55 * @since 3.5.0
56 */
57 public function schedule_action()
58 {
59 foreach (self::$migration_instances as $key => $instance_class_name) {
60 $instance = new $instance_class_name();
61 if ($instance->should_enqueue_migration_instance($instance_class_name)) {
62 $this->batchProcessingController->enqueue_processor($key, $instance_class_name);
63 }
64 }
65 }
66 }
67