Skip to content

Commit

Permalink
Merge branch '000000-dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
raamdev committed May 20, 2016
2 parents d16fe45 + a6b6133 commit 6ce77f4
Show file tree
Hide file tree
Showing 46 changed files with 487 additions and 7,658 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 comet-cache.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
Network: true
Expand Down
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).
15 changes: 15 additions & 0 deletions src/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
deny from all
</IfModule>

<FilesMatch "\.(js|css|map|gif|jpg|png|svg|eot|woff|ttf|html|txt|md)$">
<IfModule authz_core_module>
Require all granted
</IfModule>
<IfModule !authz_core_module>
allow from all
</IfModule>
</FilesMatch>
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\Classes;

use WebSharks\CometCache\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\Classes;

use WebSharks\CometCache\Traits;
use WebSharks\CometCache\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: 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\Classes;

use WebSharks\CometCache\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) .', 'comet-cache').'</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.', 'comet-cache').'</p>'."\n";
echo ' <hr />'."\n";
echo ' <h3>'.__('Disable the Admin Toolbar for Logged-In Users &amp; Comment Authors?', 'comet-cache').'</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.', 'comet-cache').'</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).', 'comet-cache').'</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.', 'comet-cache').'</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.', 'comet-cache').'</p>'."\n";
echo ' </div>'."\n";

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

'when_logged_in',
'when_logged_in_admin_bar',

'version_salt',

'htmlc_enable',
Expand Down Expand Up @@ -300,7 +302,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 @@ -341,6 +343,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 @@ -457,6 +462,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
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
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')}();
}
}
5 changes: 4 additions & 1 deletion src/includes/traits/Plugin/WcpUpdaterUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ public function autoClearOnUpgraderProcessComplete(\WP_Upgrader $upgrader_instan
}
}
unset($_plugin); // Housekeeping.
} elseif ($single_plugin_update && is_plugin_active($data['plugin'])) {
} elseif ($single_plugin_update && ( is_plugin_active($data['plugin']) || $upgrader_instance->skin->upgrader->skin->plugin_active || $upgrader_instance->skin->upgrader->skin->plugin_network_active)) {
$upgrading_active_plugin = true;
}
if ($upgrading_active_plugin) {
$counter += $this->autoClearCache();
add_action('shutdown', [$this, 'wipeOpcacheByForce'], PHP_INT_MAX);
}
break; // Break switch.

Expand Down Expand Up @@ -91,12 +92,14 @@ public function autoClearOnUpgraderProcessComplete(\WP_Upgrader $upgrader_instan

if ($upgrading_active_theme || $upgrading_active_parent_theme) {
$counter += $this->autoClearCache();
add_action('shutdown', [$this, 'wipeOpcacheByForce'], PHP_INT_MAX);
}
break; // Break switch.

case 'core': // Core upgrade.
default: // Or any other sort of upgrade.
$counter += $this->autoClearCache();
add_action('shutdown', [$this, 'wipeOpcacheByForce'], PHP_INT_MAX);
break; // Break switch.
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInit1282194a29af7710e5b95305c89863ea::getLoader();
return ComposerAutoloaderInit42cd68716e26c15cd28e74de3dd5e314::getLoader();
6 changes: 3 additions & 3 deletions src/vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit1282194a29af7710e5b95305c89863ea
class ComposerAutoloaderInit42cd68716e26c15cd28e74de3dd5e314
{
private static $loader;

Expand All @@ -19,9 +19,9 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInit1282194a29af7710e5b95305c89863ea', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit42cd68716e26c15cd28e74de3dd5e314', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit1282194a29af7710e5b95305c89863ea', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit42cd68716e26c15cd28e74de3dd5e314', 'loadClassLoader'));

$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
Expand Down
12 changes: 6 additions & 6 deletions src/vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,23 +227,23 @@
},
{
"name": "websharks/wp-php-rv",
"version": "150511",
"version_normalized": "150511",
"version": "160504",
"version_normalized": "160504",
"source": {
"type": "git",
"url": "https://github.com/websharks/wp-php-rv.git",
"reference": "ed0a58f3647e59c740560235da1e61904dca8d84"
"reference": "275e387f582ca8bf96354abe0aa10c3e0d7a3fe8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/websharks/wp-php-rv/zipball/ed0a58f3647e59c740560235da1e61904dca8d84",
"reference": "ed0a58f3647e59c740560235da1e61904dca8d84",
"url": "https://api.github.com/repos/websharks/wp-php-rv/zipball/275e387f582ca8bf96354abe0aa10c3e0d7a3fe8",
"reference": "275e387f582ca8bf96354abe0aa10c3e0d7a3fe8",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"time": "2015-05-10 10:30:04",
"time": "2016-05-05 07:44:00",
"type": "library",
"installation-source": "dist",
"notification-url": "https://packagist.org/downloads/",
Expand Down
3 changes: 0 additions & 3 deletions src/vendor/websharks/css-minifier/CHANGELOG.md

This file was deleted.

Loading

0 comments on commit 6ce77f4

Please sign in to comment.