| @@ -95,9 +95,19 @@ | ||
| 95 | 95 | * @since 2.0.0 |
| 96 | 96 | * @return void |
| 97 | 97 | */ |
| 98 | 98 | public function run_scheduled_docs_job() { |
| 99 | - if ( false === as_next_scheduled_action( 'cartflows_update_knowledge_base_data' ) && ! wp_installing() ) { | |
| 99 | + | |
| 100 | + if ( wp_installing() ) { | |
| 101 | + return; | |
| 102 | + } | |
| 103 | + | |
| 104 | + // Only the legacy admin renders the Knowledge Base screen that consumes this data. | |
| 105 | + if ( ! defined( 'CARTFLOWS_LEGACY_ADMIN' ) || ! CARTFLOWS_LEGACY_ADMIN ) { | |
| 106 | + return; | |
| 107 | + } | |
| 108 | + | |
| 109 | + if ( false === as_next_scheduled_action( 'cartflows_update_knowledge_base_data' ) ) { | |
| 100 | 110 | as_schedule_recurring_action( time(), WEEK_IN_SECONDS, 'cartflows_update_knowledge_base_data' ); |
| 101 | 111 | } |
| 102 | 112 | } |
| 103 | 113 | |
| @@ -108,9 +118,11 @@ | ||
| 108 | 118 | * @return mixed |
| 109 | 119 | */ |
| 110 | 120 | public static function cartflows_update_knowledge_base_data() { |
| 111 | 121 | $docs_json = json_decode( wp_remote_retrieve_body( wp_remote_get( 'https://cartflows.com//wp-json/powerful-docs/v1/get-docs' ) ) ); |
| 112 | - Cartflows_Helper::update_admin_settings_option( 'cartflows_docs_data', $docs_json ); | |
| 122 | + | |
| 123 | + // Never autoload — this payload runs to hundreds of KB and only the Knowledge Base screen reads it. | |
| 124 | + update_option( 'cartflows_docs_data', $docs_json, false ); | |
| 113 | 125 | } |
| 114 | 126 | |
| 115 | 127 | /** |
| 116 | 128 | * Init dashboard widgets. |
| @@ -302,9 +314,9 @@ | ||
| 302 | 314 | public function add_admin_body_class( $classes ) { |
| 303 | 315 | |
| 304 | 316 | $classes .= ' cartflows-' . CARTFLOWS_VER; |
| 305 | 317 | |
| 306 | - if ( isset( $_GET['action'] ) && in_array( sanitize_text_field( wp_unslash( $_GET['action'] ) ), array( 'wcf-log', 'wcf-license' ) ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 318 | + if ( isset( $_GET['action'] ) && 'wcf-license' === sanitize_text_field( wp_unslash( $_GET['action'] ) ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 307 | 319 | $classes .= ' wcf-debug-page '; |
| 308 | 320 | } |
| 309 | 321 | |
| 310 | 322 | return $classes; |