PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.7.2
Block Animations, Motion & Scroll Effects – Ghost Kit v3.7.2
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
← All changes | classes/class-migration.php +55 -3 3.3.03.7.2 View file →
@@ -42,19 +42,23 @@
42 42 * Init.
43 43 */
44 44 public function init() {
45 45 // Migration code added after `$this->initial_version` plugin version.
46 - $saved_version = get_option( 'vpf_db_version', $this->initial_version );
46 + $saved_version = get_option( 'ghostkit_db_version', $this->initial_version );
47 47 $current_version = $this->version;
48 48
49 49 foreach ( $this->get_migrations() as $migration ) {
50 - if ( version_compare( $saved_version, $migration['version'], '<' ) ) {
50 + if (
51 + version_compare( $saved_version, $migration['version'], '<' ) &&
52 + // A migration keyed above the plugin version belongs to a later release and waits for it.
53 + version_compare( $migration['version'], $current_version, '<=' )
54 + ) {
51 55 call_user_func( $migration['cb'] );
52 56 }
53 57 }
54 58
55 59 if ( version_compare( $saved_version, $current_version, '<' ) ) {
56 - update_option( 'vpf_db_version', $current_version );
60 + update_option( 'ghostkit_db_version', $current_version );
57 61 }
58 62 }
59 63
60 64 /**
@@ -67,9 +71,57 @@
67 71 array(
68 72 'version' => '2.25.1',
69 73 'cb' => array( $this, 'v_2_25_1' ),
70 74 ),
75 + array(
76 + 'version' => '3.7.2',
77 + 'cb' => array( $this, 'v_3_7_2' ),
78 + ),
71 79 );
80 + }
81 +
82 + /**
83 + * Remove what the runtime SCSS compiler left behind: compiled CSS in uploads,
84 + * the cron event of its queue, and the options of the queue.
85 + */
86 + public function v_3_7_2() {
87 + global $wpdb;
88 +
89 + $upload_dir = wp_get_upload_dir();
90 +
91 + GhostKit_Breakpoints::remove_dir( $upload_dir['basedir'] . '/ghostkit/gutenberg' );
92 +
93 + wp_clear_scheduled_hook( 'ghostkit_run_breakpoints_processing_cron' );
94 +
95 + delete_option( 'ghostkit_saved_breakpoints_hash' );
96 +
97 + // The queue kept its batches and status as site options: sitemeta on multisite, options otherwise.
98 + delete_site_option( 'ghostkit_run_breakpoints_processing_status' );
99 +
100 + $batch_like = $wpdb->esc_like( 'ghostkit_run_breakpoints_processing_batch_' ) . '%';
101 +
102 + if ( is_multisite() ) {
103 + // phpcs:ignore
104 + $batch_options = $wpdb->get_col(
105 + $wpdb->prepare(
106 + "SELECT meta_key FROM {$wpdb->sitemeta} WHERE site_id = %d AND meta_key LIKE %s",
107 + get_current_network_id(),
108 + $batch_like
109 + )
110 + );
111 + } else {
112 + // phpcs:ignore
113 + $batch_options = $wpdb->get_col(
114 + $wpdb->prepare(
115 + "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE %s",
116 + $batch_like
117 + )
118 + );
119 + }
120 +
121 + foreach ( $batch_options as $batch_option ) {
122 + delete_site_option( $batch_option );
123 + }
72 124 }
73 125
74 126 /**
75 127 * Fix typography with google-fonts category.