PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 3.3.0
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v3.3.0
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 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 All 162 releases
← All changes | classes/class-cartflows-update.php +47 -1 3.0.1 → 3.3.0 View file →
@@ -21,14 +21,16 @@
21 21 /**
22 22 * Class instance.
23 23 *
24 24 * @access private
25 - * @var $instance Class instance.
25 + * @var Cartflows_Update|null
26 26 */
27 27 private static $instance;
28 28
29 29 /**
30 30 * Initiator
31 + *
32 + * @return Cartflows_Update
31 33 */
32 34 public static function get_instance() {
33 35 if ( ! isset( self::$instance ) ) {
34 36 self::$instance = new self();
@@ -175,8 +177,13 @@
175 177 if ( is_string( $saved_version ) && version_compare( $saved_version, '3.0.0', '<' ) ) {
176 178 update_option( 'cartflows-legacy-admin', 'enable' );
177 179 }
178 180
181 + // Knowledge Base docs were stored autoloaded, adding hundreds of KB to every request.
182 + if ( is_string( $saved_version ) && version_compare( $saved_version, '3.2.1', '<' ) ) {
183 + $this->migrate_knowledge_base_docs_storage();
184 + }
185 +
179 186 // Update auto saved version number.
180 187 update_option( 'cartflows-version', CARTFLOWS_VER );
181 188
182 189 // Update cartflows asset version to regenerate the dynamic css. We are using the time() function to add the random number.
@@ -414,8 +421,47 @@
414 421 }
415 422 }
416 423
417 424 return $migrated;
425 + }
426 +
427 + /**
428 + * Stop the Knowledge Base docs option from being autoloaded on every request.
429 + * Only the legacy admin renders the screen that reads it, so the new UI drops it entirely.
430 + *
431 + * @since x.x.x
432 + * @return void
433 + */
434 + public function migrate_knowledge_base_docs_storage() {
435 +
436 + // Earlier blocks in init() rewrite this option, so CARTFLOWS_LEGACY_ADMIN is stale here — see class-cartflows-loader.php:158 for the allowlist.
437 + $legacy_admin_saved = get_option( 'cartflows-legacy-admin', false );
438 + $is_legacy_admin = in_array( $legacy_admin_saved, array( true, 1, '1', 'enable', 'yes' ), true );
439 +
440 + if ( ! $is_legacy_admin ) {
441 + delete_option( 'cartflows_docs_data' );
442 +
443 + if ( function_exists( 'as_unschedule_all_actions' ) ) {
444 + as_unschedule_all_actions( 'cartflows_update_knowledge_base_data' );
445 + }
446 +
447 + return;
448 + }
449 +
450 + if ( false === get_option( 'cartflows_docs_data', false ) ) {
451 + return;
452 + }
453 +
454 + // wp_set_option_autoload() landed in WP 6.4 and we still support 5.8.
455 + if ( function_exists( 'wp_set_option_autoload' ) ) {
456 + wp_set_option_autoload( 'cartflows_docs_data', false );
457 + return;
458 + }
459 +
460 + $docs_data = get_option( 'cartflows_docs_data' );
461 +
462 + delete_option( 'cartflows_docs_data' );
463 + add_option( 'cartflows_docs_data', $docs_data, '', false );
418 464 }
419 465
420 466 /**
421 467 * Migrate old combined custom script meta to separate JS and CSS meta fields.