PluginProbe ʕ •ᴥ•ʔ
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF / 2.0.6
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF v2.0.6
2.0.7 2.0.6 2.0.5 trunk 1.3.7 1.4.0 1.4.1 1.4.2 1.4.6 1.5.0 1.5.3 1.5.6 1.5.8 1.6.5 1.6.6 1.6.9 1.7.0 1.7.4 1.8.1 1.8.2 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4
robin-image-optimizer / vendor / codeinwp / themeisle-sdk / src / Modules / Abstract_Migration.php
robin-image-optimizer / vendor / codeinwp / themeisle-sdk / src / Modules Last commit date
About_us.php 1 month ago Abstract_Migration.php 4 months ago Announcements.php 4 months ago Compatibilities.php 10 months ago Crash_reporter.php 1 month ago Dashboard_widget.php 1 month ago Featured_plugins.php 1 month ago Float_widget.php 10 months ago Licenser.php 4 months ago Logger.php 1 month ago Migrator.php 1 month ago Notification.php 10 months ago Promotions.php 1 month ago Recommendation.php 10 months ago Review.php 10 months ago Rollback.php 10 months ago Script_loader.php 10 months ago Translate.php 10 months ago Translations.php 10 months ago Uninstall_feedback.php 1 month ago Welcome.php 10 months 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