PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.1
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.1
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 / AbstractMigrations.php

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

105 lines 1.8 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 /**
6 * Class AbstractMigrations
7 *
8 * Abstract class that provides common functionality for migration classes.
9 *
10 * @package WPFunnels\Admin\Migrations
11 * @since 3.5.0
12 */
13 abstract class AbstractMigrations
14 {
15
16 /**
17 * Migration key.
18 *
19 * @var string
20 * @since 3.5.0
21 */
22 public $key;
23
24
25 /**
26 * Check if the migration should be enqueued.
27 *
28 * Determines if the migration process should be added to the queue.
29 *
30 * @return bool
31 *
32 * @since 3.5.0
33 */
34 public function should_enqueue_migration_instance()
35 {
36 $is_migration_completed = $this->is_migration_completed();
37 if ('completed' === $is_migration_completed) {
38 return false;
39 }
40 return true;
41 }
42
43
44 /**
45 * Check if the migration is completed.
46 *
47 * @return string The status of the migration.
48 *
49 * @since 3.5.0
50 */
51 public function is_migration_completed()
52 {
53 return get_option("wpfunnels_" . $this->key . "_status", '');
54 }
55
56
57 /**
58 * Set the migration status.
59 *
60 * @param string $status The status to set.
61 *
62 * @since 3.5.0
63 */
64 public function set_migration_status($status)
65 {
66 update_option("wpfunnels_" . $this->key . "_status", $status);
67 }
68
69
70 /**
71 * Check if the migration is on the queue.
72 *
73 * @return bool True if the migration is running, false otherwise.
74 *
75 * @since 3.5.0
76 */
77 public function is_on_queue()
78 {
79 return get_option("wpfunnels_" . $this->key . "_status", '') === 'running';
80 }
81
82
83 /**
84 * Set the batch number.
85 *
86 * @param int $batch The batch number to set.
87 *
88 * @since 3.5.0
89 */
90 public function set_batch($batch)
91 {
92 update_option("wpfunnels_" . $this->key . "_batch", $batch);
93 }
94
95
96 /**
97 * Get the next batch to process.
98 *
99 * @return mixed The next batch to process.
100 *
101 * @since 3.5.0
102 */
103 abstract function get_next_batch_to_process();
104 }
105