PluginProbe ʕ •ᴥ•ʔ
Starter Sites & Templates by Neve / 1.4.1
Starter Sites & Templates by Neve v1.4.1
1.4.1 1.4.0 1.3.0 1.2.29 1.2.28 1.2.6 1.2.7 1.2.8 1.2.9 trunk 1.0.10 1.0.11 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.21 1.1.22 1.1.23 1.1.24 1.1.25 1.1.26 1.1.27 1.1.28 1.1.29 1.1.3 1.1.30 1.1.31 1.1.32 1.1.33 1.1.34 1.1.35 1.1.36 1.1.37 1.1.38 1.1.39 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.3 1.2.4 1.2.5
templates-patterns-collection / vendor / codeinwp / themeisle-sdk / src / Modules / Abstract_Migration.php
templates-patterns-collection / vendor / codeinwp / themeisle-sdk / src / Modules Last commit date
About_us.php 3 weeks ago Abstract_Migration.php 2 months ago Announcements.php 2 months ago Compatibilities.php 2 years ago Dashboard_widget.php 3 weeks ago Featured_plugins.php 1 month ago Float_widget.php 1 year ago Licenser.php 2 months ago Logger.php 10 months ago Migrator.php 2 months ago Notification.php 3 years ago Promotions.php 3 weeks ago Recommendation.php 3 years ago Review.php 1 year ago Rollback.php 1 year ago Script_loader.php 1 year ago Translate.php 5 years ago Translations.php 1 year ago Uninstall_feedback.php 2 days ago Welcome.php 2 years ago
Abstract_Migration.php
89 lines
1 <?php
2 /**
3 * The abstract migration class for ThemeIsle SDK.
4 *
5 * @package ThemeIsleSDK
6 * @subpackage Modules
7 * @copyright Copyright (c) 2024, Themeisle
8 * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9 * @since 3.3.50
10 */
11
12 namespace ThemeisleSDK\Modules;
13
14 // Exit if accessed directly.
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit;
17 }
18
19 /**
20 * Abstract base class for SDK migrations.
21 *
22 * Migration files should return an anonymous class instance extending this class:
23 *
24 * return new class extends \ThemeisleSDK\Modules\Abstract_Migration {
25 * public function up() { ... }
26 * };
27 */
28 abstract class Abstract_Migration {
29 /**
30 * WordPress database object.
31 *
32 * @var \wpdb
33 */
34 protected $wpdb;
35
36 /**
37 * WordPress table prefix.
38 *
39 * @var string
40 */
41 protected $prefix;
42
43 /**
44 * WordPress charset and collation string.
45 *
46 * @var string
47 */
48 protected $charset_collate;
49
50 /**
51 * Constructor. Populates database helpers.
52 */
53 public function __construct() {
54 global $wpdb;
55 $this->wpdb = $wpdb;
56 $this->prefix = $wpdb->prefix;
57 $this->charset_collate = $wpdb->get_charset_collate();
58 }
59
60 /**
61 * Run the migration.
62 */
63 abstract public function up();
64
65 /**
66 * Reverse the migration.
67 *
68 * Override in concrete migrations to undo what up() did. Called by
69 * Migrator::rollback() — never invoked automatically.
70 *
71 * @return void
72 */
73 public function down() {
74 // No-op by default. Override to implement rollback logic.
75 }
76
77 /**
78 * Determine whether this migration should run.
79 *
80 * Override to add a custom idempotency check beyond name-based tracking.
81 * Return false to skip the migration without recording it.
82 *
83 * @return bool
84 */
85 public function should_run() {
86 return true;
87 }
88 }
89