Skip to content

Commit

Permalink
Phing release of v170201-RC with the following changes:
Browse files Browse the repository at this point in the history
- **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](#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](#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](#748).
- **Bug Fix:** Some XML-RPC and REST API requests were being cached inadvertently. See [Issue #855](#855).
- **Bug Fix:** Broken textarea field due to `white-space:nowrap` in Firefox. See [Issue #866](#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](#855).
- **Compatibility Bug Fix:** Some Jetpack API calls were being cached inadvertently. See [Issue #855](#855).
- **Enhancement:** Notes in HTML source now indicate fully functional on first load for improved clarity. See [Issue #860](#860).
- **Code Cleanup:** Enhancing security by removing `basename(__FILE__)` from direct access notices.
  • Loading branch information
raamdev committed Feb 1, 2017
1 parent ac0d16b commit fd62ce4
Show file tree
Hide file tree
Showing 28 changed files with 381 additions and 144 deletions.
4 changes: 2 additions & 2 deletions .gitchange
@@ -1,4 +1,4 @@
1460135613
49dd4154d8f5d3b70691c8e3f52a063a49137fb7:57be33556df067.43016776
853d9120b42cf4f2eabe2f35ea18a6ace7170ea6:585cfba51d7115.78255177
d0e05c36184f81b133761b71ca6ee0136be67409:5862af7eeb5ac2.32178454
853d9120b42cf4f2eabe2f35ea18a6ace7170ea6:588bb5682f4739.12912408
d0e05c36184f81b133761b71ca6ee0136be67409:58926dbb57e4a4.36452623
13 changes: 13 additions & 0 deletions 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._
Expand Down
4 changes: 2 additions & 2 deletions comet-cache.php
@@ -1,6 +1,6 @@
<?php
/*
Version: 161227
Version: 170201-RC
Text Domain: comet-cache
Plugin Name: Comet Cache
Network: true
Expand All @@ -12,6 +12,6 @@
Description: Comet Cache is an advanced WordPress caching plugin inspired by simplicity.
*/
if (!defined('WPINC')) {
exit('Do NOT access this file directly: '.basename(__FILE__));
exit('Do NOT access this file directly.');
}
require_once dirname(__FILE__).'/plugin.php';
2 changes: 1 addition & 1 deletion plugin.php
@@ -1,6 +1,6 @@
<?php
if (!defined('WPINC')) {
exit('Do NOT access this file directly: '.basename(__FILE__));
exit('Do NOT access this file directly.');
}
$GLOBALS['wp_php_rv']['rv'] = '5.3.2'; //php-required-version// // Leaving this at v5.3.2 so that we can have more control over Dashboard messages below.
$GLOBALS['wp_php_rv']['re'] = array('mbstring');
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
@@ -1,6 +1,6 @@
=== Comet Cache ===

Stable tag: 161227
Stable tag: 170201-RC
Requires at least: 4.2
Tested up to: 4.8-alpha
Text Domain: comet-cache
Expand Down
2 changes: 1 addition & 1 deletion src/includes/api.php
Expand Up @@ -9,7 +9,7 @@
use WebSharks\CometCache\Classes;

if (!defined('WPINC')) {
exit('Do NOT access this file directly: '.basename(__FILE__));
exit('Do NOT access this file directly.');
}
class_alias(__NAMESPACE__.'\\Classes\\ApiBase', GLOBAL_NS);

Expand Down
23 changes: 13 additions & 10 deletions src/includes/classes/Actions.php
Expand Up @@ -66,6 +66,7 @@ public function __construct()
* @since 150422 Rewrite.
*
* @param mixed Input action argument(s).
* @param mixed $args
*/
protected function wipeCache($args)
{
Expand All @@ -91,6 +92,7 @@ protected function wipeCache($args)
* @since 150422 Rewrite.
*
* @param mixed Input action argument(s).
* @param mixed $args
*/
protected function clearCache($args)
{
Expand All @@ -116,6 +118,7 @@ protected function clearCache($args)
* @since 150422 Rewrite.
*
* @param mixed Input action argument(s).
* @param mixed $args
*/
protected function ajaxWipeCache($args)
{
Expand All @@ -140,6 +143,7 @@ protected function ajaxWipeCache($args)
* @since 150422 Rewrite.
*
* @param mixed Input action argument(s).
* @param mixed $args
*/
protected function ajaxClearCache($args)
{
Expand Down Expand Up @@ -185,11 +189,10 @@ protected function ajaxClearCache($args)
* @since 150422 Rewrite.
*
* @param mixed Input action argument(s).
* @param mixed $args
*/
protected function saveOptions($args)
{
global $is_apache, $is_nginx;

if (!current_user_can($this->plugin->cap)) {
return; // Nothing to do.
} elseif (empty($_REQUEST['_wpnonce']) || !wp_verify_nonce($_REQUEST['_wpnonce'])) {
Expand Down Expand Up @@ -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';
}
Expand All @@ -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())) {
Expand All @@ -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)) {
Expand All @@ -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';
}
Expand All @@ -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())) {
Expand All @@ -341,6 +343,7 @@ protected function restoreDefaultOptions($args)
* @since 150422 Rewrite.
*
* @param mixed Input action argument(s).
* @param mixed $args
*/
protected function dismissNotice($args)
{
Expand Down
19 changes: 18 additions & 1 deletion src/includes/classes/AdvancedCache.php
Expand Up @@ -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);

Expand Down

0 comments on commit fd62ce4

Please sign in to comment.