diff --git a/.gitchange b/.gitchange index db3c9ac..073f132 100644 --- a/.gitchange +++ b/.gitchange @@ -1,4 +1,4 @@ 1460135613 49dd4154d8f5d3b70691c8e3f52a063a49137fb7:57be33556df067.43016776 -853d9120b42cf4f2eabe2f35ea18a6ace7170ea6:585cfba51d7115.78255177 -d0e05c36184f81b133761b71ca6ee0136be67409:5862af7eeb5ac2.32178454 +853d9120b42cf4f2eabe2f35ea18a6ace7170ea6:588bb5682f4739.12912408 +d0e05c36184f81b133761b71ca6ee0136be67409:58926dbb57e4a4.36452623 diff --git a/CHANGELOG.md b/CHANGELOG.md index 39ba3b4..c575fe6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ += v170201-RC = + +- **New Feature:** Comet Cache can now be configured to automatically clear the cache for date-based archive views whenever any single post is cleared due to changes in content, title, etc. See: **Dashboard → Comet Cache → Plugin Options → Automatic Cache Clearing → Auto-Clear "Date-Based Archives" Too?**. See also: [Issue #724](https://github.com/websharks/comet-cache/issues/724). +- **New Pro Feature:** Apache Optimizations now include a new option that allows site owners to enforce an exact host name for all requests. See: **Dashboard → Comet Cache Pro → Plugin Options → Apache Optimizations → Enforce an Exact Host Name?**. See also: [Issue #101](https://github.com/websharks/comet-cache/issues/101). +- **Bug Fix:** Apache detection sometimes inaccurate. So instead of using default WP core globals for server detection, Comet Cache now uses it's own set of Apache/Nginx/IIS detection functions. And, this release enhances our Apache and Nginx detection routines; making them smart enough to catch additional edge cases; i.e., to further reduce the likelihood of there being a false-positive. See [Issue #748](https://github.com/websharks/comet-cache/issues/748). +- **Bug Fix:** Some XML-RPC and REST API requests were being cached inadvertently. See [Issue #855](https://github.com/websharks/comet-cache/issues/855). +- **Bug Fix:** Broken textarea field due to `white-space:nowrap` in Firefox. See [Issue #866](https://github.com/websharks/comet-cache/issues/866). +- **Bug Fix:** This release resolves empty directories being left in the cache folder, in some scenarios. See [Thread #866](https://forums.wpsharks.com/t/cache-folders-not-removed-during-clean-up-process/866). +- **Bug Fix** (Pro): Some REST requests were being redirected incorrectly whenever Apache Optimizations were enabled. See [Issue #855](https://github.com/websharks/comet-cache/issues/855). +- **Compatibility Bug Fix:** Some Jetpack API calls were being cached inadvertently. See [Issue #855](https://github.com/websharks/comet-cache/issues/855). +- **Enhancement:** Notes in HTML source now indicate fully functional on first load for improved clarity. See [Issue #860](https://github.com/websharks/comet-cache/issues/860). +- **Code Cleanup:** Enhancing security by removing `basename(__FILE__)` from direct access notices. + = v161227 = _**Note:** This is a Comet Cache Pro maintenance release._ diff --git a/comet-cache.php b/comet-cache.php index 6ada9fc..004b578 100644 --- a/comet-cache.php +++ b/comet-cache.php @@ -1,6 +1,6 @@ plugin->cap)) { return; // Nothing to do. } elseif (empty($_REQUEST['_wpnonce']) || !wp_verify_nonce($_REQUEST['_wpnonce'])) { @@ -222,10 +225,10 @@ protected function saveOptions($args) if (!($add_wp_cache_to_wp_config = $this->plugin->addWpCacheToWpConfig())) { $query_args[GLOBAL_NS.'_wp_config_wp_cache_add_failure'] = '1'; } - if ($is_apache && !($add_wp_htaccess = $this->plugin->addWpHtaccess())) { + if ($this->plugin->isApache() && !($add_wp_htaccess = $this->plugin->addWpHtaccess())) { $query_args[GLOBAL_NS.'_wp_htaccess_add_failure'] = '1'; } - if ($is_nginx && $this->plugin->applyWpFilters(GLOBAL_NS.'_wp_htaccess_nginx_notice', true) + if ($this->plugin->isNginx() && $this->plugin->applyWpFilters(GLOBAL_NS.'_wp_htaccess_nginx_notice', true) && (!isset($_SERVER['WP_NGINX_CONFIG']) || $_SERVER['WP_NGINX_CONFIG'] !== 'done')) { $query_args[GLOBAL_NS.'_wp_htaccess_nginx_notice'] = '1'; } @@ -246,7 +249,7 @@ protected function saveOptions($args) if (!($remove_wp_cache_from_wp_config = $this->plugin->removeWpCacheFromWpConfig())) { $query_args[GLOBAL_NS.'_wp_config_wp_cache_remove_failure'] = '1'; } - if ($is_apache && !($remove_wp_htaccess = $this->plugin->removeWpHtaccess())) { + if ($this->plugin->isApache() && !($remove_wp_htaccess = $this->plugin->removeWpHtaccess())) { $query_args[GLOBAL_NS.'_wp_htaccess_remove_failure'] = '1'; } if (!($remove_advanced_cache = $this->plugin->removeAdvancedCache())) { @@ -269,11 +272,10 @@ protected function saveOptions($args) * @since 150422 Rewrite. * * @param mixed Input action argument(s). + * @param mixed $args */ protected function restoreDefaultOptions($args) { - global $is_apache, $is_nginx; - if (!current_user_can($this->plugin->cap)) { return; // Nothing to do. } elseif (is_multisite() && !current_user_can($this->plugin->network_cap)) { @@ -292,10 +294,10 @@ protected function restoreDefaultOptions($args) if (!($add_wp_cache_to_wp_config = $this->plugin->addWpCacheToWpConfig())) { $query_args[GLOBAL_NS.'_wp_config_wp_cache_add_failure'] = '1'; } - if ($is_apache && !($add_wp_htaccess = $this->plugin->addWpHtaccess())) { + if ($this->plugin->isApache() && !($add_wp_htaccess = $this->plugin->addWpHtaccess())) { $query_args[GLOBAL_NS.'_wp_htaccess_add_failure'] = '1'; } - if ($is_nginx && $this->plugin->applyWpFilters(GLOBAL_NS.'_wp_htaccess_nginx_notice', true) + if ($this->plugin->isNginx() && $this->plugin->applyWpFilters(GLOBAL_NS.'_wp_htaccess_nginx_notice', true) && (!isset($_SERVER['WP_NGINX_CONFIG']) || $_SERVER['WP_NGINX_CONFIG'] !== 'done')) { $query_args[GLOBAL_NS.'_wp_htaccess_nginx_notice'] = '1'; } @@ -316,7 +318,7 @@ protected function restoreDefaultOptions($args) if (!($remove_wp_cache_from_wp_config = $this->plugin->removeWpCacheFromWpConfig())) { $query_args[GLOBAL_NS.'_wp_config_wp_cache_remove_failure'] = '1'; } - if ($is_apache && !($remove_wp_htaccess = $this->plugin->removeWpHtaccess())) { + if ($this->plugin->isApache() && !($remove_wp_htaccess = $this->plugin->removeWpHtaccess())) { $query_args[GLOBAL_NS.'_wp_htaccess_remove_failure'] = '1'; } if (!($remove_advanced_cache = $this->plugin->removeAdvancedCache())) { @@ -341,6 +343,7 @@ protected function restoreDefaultOptions($args) * @since 150422 Rewrite. * * @param mixed Input action argument(s). + * @param mixed $args */ protected function dismissNotice($args) { diff --git a/src/includes/classes/AdvancedCache.php b/src/includes/classes/AdvancedCache.php index c9f8d4f..4372649 100644 --- a/src/includes/classes/AdvancedCache.php +++ b/src/includes/classes/AdvancedCache.php @@ -52,11 +52,28 @@ public function __construct() return; // Missing; wait for update. } elseif (COMET_CACHE_AC_FILE_VERSION !== VERSION) { return; // Version mismatch; wait for update. + // } elseif (!defined('WP_CACHE') || !WP_CACHE || !COMET_CACHE_ENABLE) { return; // Not enabled in `wp-config.php` or otherwise. } elseif (defined('WP_INSTALLING') || defined('RELOCATE')) { - return; // N/A; installing|relocating. + return; // Not applicable; installing and/or relocating. + // + } elseif (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) { + return; // Not applicable; bypass API requests. + } elseif (defined('REST_REQUEST') && REST_REQUEST) { + return; // Not applicable; bypass API requests. } + // Note: `REST_REQUEST` is only here as a way of future-proofing the software. + // Ideally, we could catch all API requests here to avoid any overhead in processing. + // I suspect this will be the case in a future release of WordPress. + + // For now, `REST_REQUEST` is not defined by WP until later in the `parse_request` phase. + // Therefore, this check by itself is not enough to avoid all REST requests at this time. + // See: `traits/Ac/ObUtils.php` for additional checks for `REST_REQUEST` API calls. + + // `XMLRPC_REQUEST` on the other hand, is set very early via `xmlrpc.php`. So no issue. + // ------------------------------------------------------------------------------------------------------------- + $this->is_running = true; $this->timer = microtime(true); diff --git a/src/includes/classes/MenuPageOptions.php b/src/includes/classes/MenuPageOptions.php index b00000c..8208307 100644 --- a/src/includes/classes/MenuPageOptions.php +++ b/src/includes/classes/MenuPageOptions.php @@ -17,9 +17,6 @@ public function __construct() { parent::__construct(); // Parent constructor. - global $is_nginx; // WP global for web server checks below. - global $is_apache; // WP global for web server checks below. - echo '