| @@ -32,22 +32,8 @@ | ||
| 32 | 32 | const DEBOUNCE_TRANSIENT = 'mxchat_cache_purge_debounce'; |
| 33 | 33 | const DEBOUNCE_SECONDS = 30; |
| 34 | 34 | const DEFERRED_EVENT = 'mxchat_deferred_cache_purge'; |
| 35 | 35 | |
| 36 | - /** | |
| 37 | - * Owner switch (plan b76ed6, Support Ticket 468: a 1,400-page FlyingPress | |
| 38 | - * site lost its whole preload on every settings save). Standalone option, | |
| 39 | - * 'on' / 'off'; absent means ON so existing sites keep today's behaviour. | |
| 40 | - * Rendered on Settings → Optimization → Page Cache Compatibility and saved | |
| 41 | - * by the mxchat_cache_purge_enabled case in class-ajax-handler.php. | |
| 42 | - * | |
| 43 | - * The switch is read when a watched option is actually written (and when | |
| 44 | - * a deferred purge fires), not at plugin load: the hooks below cost | |
| 45 | - * nothing until a save happens, and a site that never touches the switch | |
| 46 | - * never pays a get_option() for it on a visitor request. | |
| 47 | - */ | |
| 48 | - const OPTION_NAME = 'mxchat_cache_purge_enabled'; | |
| 49 | - | |
| 50 | 36 | private static $instance = null; |
| 51 | 37 | |
| 52 | 38 | /** |
| 53 | 39 | * Whether this request already queued a shutdown purge (one per request). |
| @@ -62,18 +48,8 @@ | ||
| 62 | 48 | } |
| 63 | 49 | return self::$instance; |
| 64 | 50 | } |
| 65 | 51 | |
| 66 | - /** | |
| 67 | - * Whether MxChat clears page caches when its settings are saved. | |
| 68 | - * Default ON; only an explicit 'off' switches it off. | |
| 69 | - * | |
| 70 | - * @return bool | |
| 71 | - */ | |
| 72 | - public static function is_enabled() { | |
| 73 | - return get_option(self::OPTION_NAME, 'on') !== 'off'; | |
| 74 | - } | |
| 75 | - | |
| 76 | 52 | private function __construct() { |
| 77 | 53 | foreach ($this->watched_options() as $option_name) { |
| 78 | 54 | add_action('update_option_' . $option_name, array($this, 'queue_purge'), 10, 0); |
| 79 | 55 | add_action('add_option_' . $option_name, array($this, 'queue_purge'), 10, 0); |
| @@ -103,9 +79,9 @@ | ||
| 103 | 79 | /** |
| 104 | 80 | * Coalesce all option writes in this request into one shutdown purge. |
| 105 | 81 | */ |
| 106 | 82 | public function queue_purge() { |
| 107 | - if ($this->purge_queued || !self::is_enabled()) { | |
| 83 | + if ($this->purge_queued) { | |
| 108 | 84 | return; |
| 109 | 85 | } |
| 110 | 86 | $this->purge_queued = true; |
| 111 | 87 | add_action('shutdown', array($this, 'run_queued_purge'), 5); |
| @@ -130,14 +106,8 @@ | ||
| 130 | 106 | * Purge every supported page cache via its own public API. Each call is |
| 131 | 107 | * guarded so installs without that plugin skip it silently. |
| 132 | 108 | */ |
| 133 | 109 | public function purge_page_caches() { |
| 134 | - // The owner may have switched the purge off after a deferred purge was | |
| 135 | - // scheduled; off means off. | |
| 136 | - if (!self::is_enabled()) { | |
| 137 | - return; | |
| 138 | - } | |
| 139 | - | |
| 140 | 110 | // WP Rocket — public helper, clears the whole domain's page cache. |
| 141 | 111 | if (function_exists('rocket_clean_domain')) { |
| 142 | 112 | rocket_clean_domain(); |
| 143 | 113 | } |