PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 4.0.8
Visualizer – Tables & Charts Manager with Built-in AI Generator v4.0.8
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / codeinwp / themeisle-sdk / src / Modules / Abstract_Migration.php

Abstract_Migration.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 4.0.8, at vendor/codeinwp/themeisle-sdk/src/Modules/Abstract_Migration.php

89 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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