Skip to content

Commit

Permalink
Merge branch 'release/160514-RC'
Browse files Browse the repository at this point in the history
  • Loading branch information
raamdev committed May 20, 2016
2 parents f6580ba + 426fc55 commit 9678697
Show file tree
Hide file tree
Showing 23 changed files with 2,403 additions and 646 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
= v160521 =

- **Bug Fix**: Fixed a bug that, in some scenarios, resulted in "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_PATH_INDEX'". This also affected the Cache Statistics feature (Comet Cache Pro), resulting in a blank panel when hovering over the Cache Stats button in the menu bar. See [Issue #752](https://github.com/websharks/comet-cache/issues/752).
- **Bug Fix**: When the PHP OPCache extension is active, the OPCache is now cleared when a WordPress plugin is upgraded, activated, or deactivated. This works around an issue that could produce a fatal error when the PHP OPCache contains cached PHP code that conflicts with new PHP code introduced by an update. See [Issue #740](https://github.com/websharks/comet-cache/issues/740).
- **Enhancement** (Pro): It's now possible to disable the WordPress Admin Toolbar when Logged-In User Caching is enabled with a new option in _Comet Cache → Plugin Options → Logged-In Users → Disable the Admin Toolbar for Logged-In Users & Comment Authors?_ Props @renzms and @KTS915. See [Issue #690](https://github.com/websharks/comet-cache/issues/690).
- **Enhancement**: The the option to automatically clear the cache for Custom Term Archive Views (see _Comet Cache → Plugin Options → Automatic Cache Clearing → Auto-Clear "Custom Term Archives" Too?_) is now enabled by default. This feature was previously disabled by default, which lead to confusion about why those cache files were not being cleared automatically when a Custom Post Type with a Custom Term Archive View was being used. Props @renzms. See [Issue #693](https://github.com/websharks/comet-cache/issues/693).
- **Enhancement** (Pro): A new filter allows overriding the default behavior to clear the user cache upon login and logout when caching for Logged-In Users is enabled. See [this article](https://cometcache.com/r/kb-article-how-can-i-prevent-the-user-cache-from-being-cleared-upon-login-or-logout/) for details. Props @KTS915. See [Issue #756](https://github.com/websharks/comet-cache/issues/756).

= v160417 =

- **Bug Fix**: Fixed a "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_SCHEME'" introduced by the previous release (v160416). This issue only affected sites where Feed Caching was enabled (_Comet Cache → Plugin Options → RSS, RDF, and Atom Feeds_). Props to MassimoD and @emanwebdev for reporting. See [Issue #739](https://github.com/websharks/comet-cache/issues/739).

= v160416 =

- **Enhancement**: Several PHP 5.4+ enhancements, most notably a conversion from PHP Closures to PHP Traits. See [Issue #635](https://github.com/websharks/comet-cache/issues/635).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Comet Cache Pro
## Comet Cache Pro [![Build Status](https://travis-ci.org/websharks/comet-cache-pro.svg?branch=000000-dev)](https://travis-ci.org/websharks/comet-cache-pro)

Caching plugin for WordPress®.

Expand Down
2 changes: 1 addition & 1 deletion comet-cache-pro.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
Version: 160417
Version: 160521
Text Domain: comet-cache
Plugin Name: Comet Cache Pro
Network: true
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"role": "developer"
}, {
"name": "raamdev",
"homepage": "http://raam.org/",
"homepage": "https://raamdev.com/",
"role": "developer"
}],
"support": {
Expand All @@ -30,7 +30,7 @@
},
"require": {
"php": ">=5.4",
"websharks/wp-php-rv": "150511",
"websharks/wp-php-rv": "160504",
"websharks/html-compressor": "160118",
"websharks/sharkicons": "160221"
},
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion phings
14 changes: 11 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=== Comet Cache ===

Stable tag: 160417
Stable tag: 160521
Requires at least: 4.2
Tested up to: 4.6-alpha
Text Domain: comet-cache
Expand Down Expand Up @@ -336,9 +336,17 @@ Requires WordPress v4.2+.

== Changelog ==

= v160521 =

- **Bug Fix**: Fixed a bug that, in some scenarios, resulted in "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_PATH_INDEX'". This also affected the Cache Statistics feature (Comet Cache Pro), resulting in a blank panel when hovering over the Cache Stats button in the menu bar. See [Issue #752](https://github.com/websharks/comet-cache/issues/752).
- **Bug Fix**: When the PHP OPCache extension is active, the OPCache is now cleared when a WordPress plugin is upgraded, activated, or deactivated. This works around an issue that could produce a fatal error when the PHP OPCache contains cached PHP code that conflicts with new PHP code introduced by an update. See [Issue #740](https://github.com/websharks/comet-cache/issues/740).
- **Enhancement** (Pro): It's now possible to disable the WordPress Admin Toolbar when Logged-In User Caching is enabled with a new option in _Comet Cache → Plugin Options → Logged-In Users → Disable the Admin Toolbar for Logged-In Users & Comment Authors?_ Props @renzms and @KTS915. See [Issue #690](https://github.com/websharks/comet-cache/issues/690).
- **Enhancement**: The the option to automatically clear the cache for Custom Term Archive Views (see _Comet Cache → Plugin Options → Automatic Cache Clearing → Auto-Clear "Custom Term Archives" Too?_) is now enabled by default. This feature was previously disabled by default, which lead to confusion about why those cache files were not being cleared automatically when a Custom Post Type with a Custom Term Archive View was being used. Props @renzms. See [Issue #693](https://github.com/websharks/comet-cache/issues/693).
- **Enhancement** (Pro): A new filter allows overriding the default behavior to clear the user cache upon login and logout when caching for Logged-In Users is enabled. See [this article](https://cometcache.com/r/kb-article-how-can-i-prevent-the-user-cache-from-being-cleared-upon-login-or-logout/) for details. Props @KTS915. See [Issue #756](https://github.com/websharks/comet-cache/issues/756).

= v160417 =

- **Bug Fix**: Fixed a "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_SCHEME'" with introduced by the previous release (v160416). This issue only affected sites where Feed Caching was enabled (_Comet Cache → Plugin Options → RSS, RDF, and Atom Feeds_). Props to MassimoD and @emanwebdev for reporting. See [Issue #739](https://github.com/websharks/comet-cache/issues/739).
- **Bug Fix**: Fixed a "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_SCHEME'" introduced by the previous release (v160416). This issue only affected sites where Feed Caching was enabled (_Comet Cache → Plugin Options → RSS, RDF, and Atom Feeds_). Props to MassimoD and @emanwebdev for reporting. See [Issue #739](https://github.com/websharks/comet-cache/issues/739).

= v160416 =

Expand Down Expand Up @@ -378,4 +386,4 @@ Requires WordPress v4.2+.
- **Bug Fix (Multisite)**: Fixed a bug where when Comet Cache was Network Activated the plugin settings link would show up in the plugins list for the Main Site and would lead to a 404 error. The settings link is now only shown when viewing the plugins list from the Network Admin. Props @jaswsinc. See [Issue #675](https://github.com/websharks/zencache/issues/675).
- **Enhancement**: Added support-related links to the plugin options page. Props @renzms. See [Issue #612](https://github.com/websharks/zencache/issues/612#issuecomment-186827661).

For older Changelog entries going back to 2009, please see the `CHANGELOG.md` file.
For older changelog history going back to 2009, please see [CHANGELOG.md](https://github.com/websharks/comet-cache/blob/master/CHANGELOG.md).
2 changes: 1 addition & 1 deletion src/client-s/css/admin-bar.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/client-s/css/menu-pages.min.css

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/includes/classes/AbsBase.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php
namespace WebSharks\CometCache\Pro\Classes;

use WebSharks\CometCache\Pro\Interfaces;

/**
* Abstract Base.
*
* @since 150422 Rewrite.
*/
abstract class AbsBase
abstract class AbsBase implements Interfaces\Shared\NcDebugConsts, Interfaces\Shared\CachePathConsts
{
/**
* @type null|plugin Plugin reference.
Expand Down
3 changes: 1 addition & 2 deletions src/includes/classes/AbsBaseAp.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
namespace WebSharks\CometCache\Pro\Classes;

use WebSharks\CometCache\Pro\Traits;
use WebSharks\CometCache\Pro\Interfaces;

/**
* Abstract Base for Advanced Cache and Plugin.
*
* @since 150422 Rewrite.
*/
abstract class AbsBaseAp extends AbsBase implements Interfaces\Shared\NcDebugConsts, Interfaces\Shared\CachePathConsts
abstract class AbsBaseAp extends AbsBase
{
/*[.build.php-auto-generate-use-Traits]*/
use Traits\Shared\BlogUtils;
Expand Down
4 changes: 2 additions & 2 deletions src/includes/classes/Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,8 @@ protected function proUpdate($args)
'_wpnonce' => wp_create_nonce('upgrade-plugin_'.plugin_basename(PLUGIN_FILE)),

// See: `preSiteTransientUpdatePlugins()` where these are picked up.
GLOBAL_NS.'_update_pro_version' => $product_api_response->pro_version,
GLOBAL_NS.'_update_pro_zip' => base64_encode($product_api_response->pro_zip),
GLOBAL_NS.'_update_pro_version' => apply_filters(GLOBAL_NS.'_update_pro_version', $product_api_response->pro_version),
GLOBAL_NS.'_update_pro_zip' => base64_encode(apply_filters(GLOBAL_NS.'_update_pro_zip', $product_api_response->pro_zip)),
// @TODO Encrypt/decrypt to avoid mod_security issues. Base64 is not enough.
];
$redirect_to = add_query_arg(urlencode_deep($query_args), $redirect_to);
Expand Down
4 changes: 1 addition & 3 deletions src/includes/classes/FeedUtils.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<?php
namespace WebSharks\CometCache\Pro\Classes;

use WebSharks\CometCache\Pro\Interfaces;

/**
* Feed Utils.
*
* @since 150422 Rewrite.
*/
class FeedUtils extends AbsBase implements Interfaces\Shared\CachePathConsts
class FeedUtils extends AbsBase
{
/**
* @type string WordPress `home_url()`.
Expand Down
9 changes: 9 additions & 0 deletions src/includes/classes/MenuPageOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,15 @@ public function __construct()
echo ' <option value="postload"'.selected($this->plugin->options['cdn_when_logged_in'], 'postload', false).'>'.__('Yes, enable Static CDN Filters for logged-in users (recommended) .', SLUG_TD).'</option>'."\n";
echo ' </select></p>'."\n";
echo ' <p class="info">'.__('<strong>Note:</strong> Static CDN Filters serve <em>static</em> resources. Static resources, are, simply put, static. Thus, it is not a problem to cache these resources for any visitor (logged-in or not logged-in). To avoid confusion, this defaults to a value of <code>No</code>, and we ask that you set it to <code>Yes</code> on your own so that you\'ll know to expect this behavior; i.e., that static resources will always be served from the CDN (logged-in or not logged-in) even though Logged-In User caching may be disabled above.', SLUG_TD).'</p>'."\n";
echo ' <hr />'."\n";
echo ' <h3>'.__('Disable the Admin Toolbar for Logged-In Users &amp; Comment Authors?', SLUG_TD).'</h3>'."\n";
echo ' <p>'.__('When Logged-In User caching is enabled above, it is recommended that you disable the WordPress Admin Toolbar for logged-in users (on the front-end of the site) because the Toolbar is generally NOT cache-compatible. If you want Comet Cache to automatically disable the Toolbar for logged-in users, you can choose that option below. Or, if you use another plugin to control the Admin Toolbar you can leave this option disabled.', SLUG_TD).'</p>'."\n";
echo ' <p><select name="'.esc_attr(GLOBAL_NS).'[saveOptions][when_logged_in_admin_bar]">'."\n";
echo ' <option value="0"'.selected($this->plugin->options['when_logged_in_admin_bar'], '0', false).'>'.__('Yes, disable the Admin Toolbar for all logged-in users (recommended option).', SLUG_TD).'</option>'."\n";
echo ' <option value="1"'.selected($this->plugin->options['when_logged_in_admin_bar'], '1', false).'>'.__('No, don\'t disable the Admin Toolbar for logged-in users.', SLUG_TD).'</option>'."\n";
echo ' </select></p>'."\n";

echo ' <p class="info">'.__('<strong>Note:</strong> If you don\'t disable the Admin Toolbar for logged-in users that will cause WordPress Nonce values to appear in the page source; nonce values are generally NOT cache-compatible. Please see <a href="https://cometcache.com/r/kb-article-what-are-wordpress-nonces-and-why-are-they-not-cache-compatible/" target="_blank">this article</a> for details.', SLUG_TD).'</p>'."\n";
echo ' </div>'."\n";

echo '</div>'."\n";
Expand Down
10 changes: 8 additions & 2 deletions src/includes/classes/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ public function setup()
'cache_clear_urls',

'when_logged_in',
'when_logged_in_admin_bar',

'version_salt',

'htmlc_enable',
Expand Down Expand Up @@ -348,7 +350,7 @@ public function setup()

'cache_clear_term_category_enable' => '1', // `0|1`.
'cache_clear_term_post_tag_enable' => '1', // `0|1`.
'cache_clear_term_other_enable' => '0', // `0|1`.
'cache_clear_term_other_enable' => '1', // `0|1`.

/* Misc. cache behaviors. */

Expand Down Expand Up @@ -389,6 +391,9 @@ public function setup()
'htmlc_compress_html_code' => '1', // `0|1`.
'htmlc_when_logged_in' => '0', // `0|1`; enable when logged in?
/* Related to Logged-In User Caching */
'when_logged_in_admin_bar' => '1', // `0|1`; enable when logged in?
/* Related to auto-cache engine. */

'auto_cache_enable' => '0', // `0|1`.
Expand Down Expand Up @@ -525,6 +530,7 @@ public function setup()
add_action('admin_init', [$this, 'autoClearCacheOnSettingChanges']);
add_action('safecss_save_pre', [$this, 'autoClearCacheOnJetpackCustomCss'], 10, 1);
add_action('upgrader_process_complete', [$this, 'autoClearOnUpgraderProcessComplete'], 10, 2);
add_action('upgrader_process_complete', [$this, 'wipeOpcacheByForce'], PHP_INT_MAX);

add_action('switch_theme', [$this, 'autoClearCache']);
add_action('wp_create_nav_menu', [$this, 'autoClearCache']);
Expand Down Expand Up @@ -570,7 +576,7 @@ public function setup()
}

/*[pro strip-from="lite"]*/
if ($this->options['when_logged_in'] === '1' && $this->applyWpFilters(GLOBAL_NS.'_when_logged_in_no_admin_bar', true)) {
if ($this->options['when_logged_in'] && !$this->options['when_logged_in_admin_bar'] && $this->applyWpFilters(GLOBAL_NS.'_when_logged_in_no_admin_bar', true)) {
show_admin_bar(false); // Prevent admin bar from being cached.
}
/*[/pro]*/
Expand Down
19 changes: 19 additions & 0 deletions src/includes/classes/VsUpgrades.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ protected function runHandlers()
$this->fromLte151107();
$this->fromLte151114();
$this->fromZenCache();
$this->fromLte160227();
}

/**
Expand Down Expand Up @@ -204,4 +205,22 @@ protected function fromZenCache()
);
}
}

/**
* Before we enabled "Auto-Clear Custom Term Archive Views" by default.
*
* @since 160521
*/
protected function fromLte160227()
{
if (version_compare($this->prev_version, '160227', '<=')) {
if (is_array($existing_options = get_site_option(GLOBAL_NS.'_options'))) {
$this->plugin->options['cache_clear_term_other_enable'] = $this->plugin->default_options['cache_clear_term_other_enable'];
if ($this->plugin->options !== $existing_options) {
$this->plugin->updateOptions($this->plugin->options); // Save/update options.
$this->plugin->activate(); // Reactivate plugin w/ new options.
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/includes/stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
require_once dirname(__DIR__).'/vendor/autoload.php';
require_once __DIR__.'/functions/i18n-utils.php';

${__FILE__}['version'] = '160417'; //version//
${__FILE__}['version'] = '160521'; //version//
${__FILE__}['plugin'] = dirname(dirname(__DIR__));
${__FILE__}['plugin'] .= '/'.basename(${__FILE__}['plugin']).'.php';
${__FILE__}['ns_path'] = str_replace('\\', '/', __NAMESPACE__); // To dir/path.
Expand Down
3 changes: 3 additions & 0 deletions src/includes/traits/Ac/PostloadUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ public function maybeInvalidateWhenLoggedInPostload()
if (!($this->user_token = $this->userToken())) {
return; // Nothing to do in this case.
}
if ($this->applyWpFilters(GLOBAL_NS.'_invalidate_when_logged_in_postload', true) === false) {
return; // Nothing to do in this case (disabled via filter).
}
$regex = $this->assembleCachePathRegex('', '.*?\.u\/'.preg_quote($this->user_token, '/').'[.\/]');
$this->wipeFilesFromCacheDir($regex); // Wipe matching files.
}
Expand Down
12 changes: 12 additions & 0 deletions src/includes/traits/Plugin/WcpOpcacheUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ public function clearOpcache($manually = false, $maybe = true)
return 0; // Not applicable.
}

/**
* Wipe the Opcache (by force).
*
* @since 160521 Improving OPCache support.
*
* @return int Total keys cleared.
*/
public function wipeOpcacheByForce()
{
return $this->wipeOpcache(false, false);
}

/**
* Clear AC class file from Opcache (by force).
*
Expand Down
5 changes: 5 additions & 0 deletions src/includes/traits/Plugin/WcpPluginUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ trait WcpPluginUtils
* @param bool True if activating|deactivating network-wide. Defaults to boolean `FALSE` in case parameter is not passed to hook.
*
* @return int Total files wiped|cleared by this routine (if any).
*
* @note Also wipes the PHP OPCache.
*/
public function autoClearOnPluginActivationDeactivation($plugin, $network_wide = false)
{
if (!$this->applyWpFilters(GLOBAL_NS.'_auto_clear_on_plugin_activation_deactivation', true)) {
return 0; // Nothing to do here.
}

add_action('shutdown', [$this, 'wipeOpcacheByForce'], PHP_INT_MAX);

return $this->{($network_wide ? 'autoWipeCache' : 'autoClearCache')}();
}
}
Loading

0 comments on commit 9678697

Please sign in to comment.