Skip to content

Commit

Permalink
Merge branch 'release/151107'
Browse files Browse the repository at this point in the history
  • Loading branch information
raamdev committed Nov 7, 2015
2 parents 3b5f691 + e6739ea commit fa5b206
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 35 deletions.
6 changes: 6 additions & 0 deletions zencache/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
= v151107 =

- **Announcement: The next version of ZenCache will require PHP 5.4+.** As of December 1st, 2015, the minimum PHP version required to run ZenCache will change to PHP 5.4+. This release of ZenCache will be the last version to support PHP 5.3. Please see announcement with further details: [New Minimum PHP Version: PHP 5.4](http://zencache.com/r/new-minimum-php-version-php-5-4/)
- **Announcement: The next version of ZenCache will not support the PHP APC Extension**. As of December 1st, 2015, ZenCache will no longer run with the PHP APC extension enabled. Please see announcement with further details: [PHP APC Extension No Longer Supported](http://zencache.com/r/php-apc-extension-no-longer-supported/)
- **Bug Fix**: Fixed a bug where a commented-out `WP_CACHE` definition in `wp-config.php` (such as what WP Super Cache leaves behind) was being incorrectly ignored and resulted in caching being silently disabled. Props @davidfavor. See [Issue #591](https://github.com/websharks/zencache/issues/591).

= v150930 =

- **Bug Fix**: Fixed a bug where, in some rare cases, `wp-config.php` would end up with two `WP_CACHE` definitions. See [Issue #509](https://github.com/websharks/zencache/issues/509).
Expand Down
2 changes: 1 addition & 1 deletion zencache/includes/share.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ abstract class share // Shared between {@link advanced_cache} and {@link plugin}
*
* @var string Current version of the software.
*/
public $version = '150930';
public $version = '151107';

/**
* Plugin slug; based on `__NAMESPACE__`.
Expand Down
86 changes: 63 additions & 23 deletions zencache/includes/translations/zencache.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# This file is distributed under the same license as the ZenCache package.
msgid ""
msgstr ""
"Project-Id-Version: ZenCache 150930\n"
"Project-Id-Version: ZenCache 151107\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/zencache\n"
"POT-Creation-Date: 2015-09-30 02:31:30+00:00\n"
"POT-Creation-Date: 2015-11-07 05:08:43+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -1365,90 +1365,130 @@ msgstr ""
msgid "<strong>%1$s:</strong> detected a new version of itself. Recompiling w/ latest version... wiping the cache... all done :-)"
msgstr ""

#: zencache.inc.php:591
#: zencache.inc.php:596
msgid "Settings"
msgstr ""

#: zencache.inc.php:592
#: zencache.inc.php:597
msgid "Preview Pro Features"
msgstr ""

#: zencache.inc.php:593
#: zencache.inc.php:598
msgid "Upgrade"
msgstr ""

#: zencache.inc.php:689 zencache.inc.php:766
#: zencache.inc.php:694 zencache.inc.php:771
msgid "dismiss &times;"
msgstr ""

#: zencache.inc.php:824
#: zencache.inc.php:829
msgid "Every 15 Minutes"
msgstr ""

#: zencache.inc.php:951
#: zencache.inc.php:956
msgid "<strong>%1$s:</strong> detected significant changes. Found %2$s in the cache; auto-wiping."
msgstr ""

#: zencache.inc.php:995
#: zencache.inc.php:1000
msgid "<strong>%1$s:</strong> detected important site changes. Found %2$s in the cache for this site; auto-clearing."
msgstr ""

#: zencache.inc.php:1076
#: zencache.inc.php:1081
msgid "Post"
msgstr ""

#: zencache.inc.php:1084
#: zencache.inc.php:1089
msgid "<strong>%1$s:</strong> detected changes. Found %2$s in the cache for %3$s ID: <code>%4$s</code>; auto-clearing."
msgstr ""

#: zencache.inc.php:1261
#: zencache.inc.php:1266
msgid "<strong>%1$s:</strong> detected changes. Found %2$s in the cache, for XML feeds of type: <code>%3$s</code>; auto-clearing."
msgstr ""

#: zencache.inc.php:1310
#: zencache.inc.php:1315
msgid "<strong>%1$s:</strong> detected changes. Found %2$s in the cache for XML sitemaps; auto-clearing."
msgstr ""

#: zencache.inc.php:1353
#: zencache.inc.php:1358
msgid "<strong>%1$s:</strong> detected changes. Found %2$s in the cache for the designated \"Home Page\"; auto-clearing."
msgstr ""

#: zencache.inc.php:1411
#: zencache.inc.php:1416
msgid "<strong>%1$s:</strong> detected changes. Found %2$s in the cache for the designated \"Posts Page\"; auto-clearing."
msgstr ""

#: zencache.inc.php:1469
#: zencache.inc.php:1474
msgid "Untitled"
msgstr ""

#: zencache.inc.php:1480
#: zencache.inc.php:1485
msgid "<strong>%1$s:</strong> detected changes. Found %2$s in the cache for Custom Post Type: <code>%3$s</code>; auto-clearing."
msgstr ""

#: zencache.inc.php:1570
#: zencache.inc.php:1575
msgid "<strong>%1$s:</strong> detected changes. Found %2$s in the cache for Author Page: <code>%3$s</code>; auto-clearing."
msgstr ""

#: zencache.inc.php:1722
#: zencache.inc.php:1727
msgid "<strong>%1$s:</strong> detected changes. Found %2$s in the cache for %3$s: <code>%4$s</code>; auto-clearing."
msgstr ""

#: zencache.inc.php:2011 zencache.inc.php:2039
#: zencache.inc.php:2016 zencache.inc.php:2044
msgid "Doing it wrong! Missing `base_dir` option value. MUST call this method after `setup()`."
msgstr ""

#: zencache.inc.php:2494
#: zencache.inc.php:2505
msgid "Lite"
msgstr ""

#: zencache.inc.php:2495
#: zencache.inc.php:2506
msgid "Pro"
msgstr ""

#: zencache.inc.php:2501
#: zencache.inc.php:2512
msgid "<strong>%1$s</strong> is NOT running. A conflicting plugin, <strong>%2$s</strong>, is currently active. Please deactivate the %2$s plugin to clear this message."
msgstr ""

#: zencache.php:29
msgid "<strong>NOTICE: ZenCache Minimum PHP Version</strong></h3>"
msgstr ""

#: zencache.php:30
msgid "<strong>As of December 1st, 2015 ZenCache will require PHP 5.4 or higher.</strong> Your server is currently running PHP v%1$s. You will need to upgrade to PHP 5.4 or higher to run the next version of ZenCache."
msgstr ""

#: zencache.php:31
msgid "Learn more about this upcoming change here: <a href=\"http://zencache.com/r/new-minimum-php-version-php-5-4/\" target=\"_blank\">New Minimum PHP Version: PHP 5.4</a>"
msgstr ""

#: zencache.php:33
msgid "Your server is also running the <strong>outdated PHP APC extension</strong>. Please see: <a href=\"http://zencache.com/r/php-apc-extension-no-longer-supported/\" target=\"_blank\">PHP APC Extension No Longer Supported</a>"
msgstr ""

#: zencache.php:51
msgid "<strong>NOTICE: ZenCache + PHP APC Extension</strong></h3>"
msgstr ""

#: zencache.php:52
msgid "<strong>As of December 1st, 2015 ZenCache will no longer run with the outdated PHP APC extension.</strong> It appears that you're currently running PHP v%1$s with APC enabled. You will need to follow one of the actions below to run the next version of ZenCache."
msgstr ""

#: zencache.php:53
msgid "<h4 style=\"margin:0 0 .5em 0; font-size:1.25em;\"><span class=\"dashicons dashicons-lightbulb\"></span> Options Available (Action Required):</h4>"
msgstr ""

#: zencache.php:55
msgid "Please add <code>ini_set('apc.cache_by_default', false);</code> to the top of your <code>/wp-config.php</code> file. That will get rid of this message and allow ZenCache to run without issue."
msgstr ""

#: zencache.php:56
msgid "Or, contact your web hosting provider and ask about upgrading to PHP v5.5+; which includes the new <a href=\"http://zencache.com/r/php-opcache-extension/\" target=\"_blank\">OPcache extension for PHP</a>. The new OPcache extension replaces APC in modern versions of PHP."
msgstr ""

#: zencache.php:58
msgid "To learn more about this upcoming change, please see the announcement: <a href=\"http://zencache.com/r/php-apc-extension-no-longer-supported/\" target=\"_blank\">PHP APC Extension No Longer Supported</a>"
msgstr ""

#. Plugin Name of the plugin/theme
msgid "ZenCache"
msgstr ""
Expand Down
8 changes: 7 additions & 1 deletion zencache/readme.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=== Zen Cache ===

Stable tag: 150930
Stable tag: 151107
Requires at least: 3.7
Tested up to: 4.4-alpha
Text Domain: zencache
Expand Down Expand Up @@ -333,6 +333,12 @@ Requires PHP v5.3.2+. The latest version of ZenCache is a complete rewrite (OOP

== Changelog ==

= v151107 =

- **Announcement: The next version of ZenCache will require PHP 5.4+.** As of December 1st, 2015, the minimum PHP version required to run ZenCache will change to PHP 5.4+. This release of ZenCache will be the last version to support PHP 5.3. Please see announcement with further details: [New Minimum PHP Version: PHP 5.4](http://zencache.com/r/new-minimum-php-version-php-5-4/)
- **Announcement: The next version of ZenCache will not support the PHP APC Extension**. As of December 1st, 2015, ZenCache will no longer run with the PHP APC extension enabled. Please see announcement with further details: [PHP APC Extension No Longer Supported](http://zencache.com/r/php-apc-extension-no-longer-supported/)
- **Bug Fix**: Fixed a bug where a commented-out `WP_CACHE` definition in `wp-config.php` (such as what WP Super Cache leaves behind) was being incorrectly ignored and resulted in caching being silently disabled. Props @davidfavor. See [Issue #591](https://github.com/websharks/zencache/issues/591).

= v150930 =

- **Bug Fix**: Fixed a bug where, in some rare cases, `wp-config.php` would end up with two `WP_CACHE` definitions. See [Issue #509](https://github.com/websharks/zencache/issues/509).
Expand Down
21 changes: 16 additions & 5 deletions zencache/zencache.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,13 @@ public function uninstall()
$this->remove_base_dir();

delete_option(__NAMESPACE__.'_options');
if(is_multisite()) // Delete network options too.
delete_site_option(__NAMESPACE__.'_options');
delete_option(__NAMESPACE__.'_min_php54_warning_bypass');
delete_option(__NAMESPACE__.'_apc_deprecated_warning_bypass');
if(is_multisite()) { // Delete network options too.
delete_site_option(__NAMESPACE__.'_options');
delete_site_option(__NAMESPACE__.'_min_php54_warning_bypass');
delete_site_option(__NAMESPACE__.'_apc_deprecated_warning_bypass');
}

delete_option(__NAMESPACE__.'_notices');
delete_option(__NAMESPACE__.'_errors');
Expand Down Expand Up @@ -2062,11 +2067,14 @@ public function add_wp_cache_to_wp_config()
if(!($wp_config_file = $this->find_wp_config_file()))
return ''; // Unable to find `/wp-config.php`.

if (!($wp_config_file_contents_no_whitespace = php_strip_whitespace($wp_config_file))) {
return ''; // Failure; file empty
}
if(!is_readable($wp_config_file)) return ''; // Not possible.
if(!($wp_config_file_contents = file_get_contents($wp_config_file)))
return ''; // Failure; could not read file.

if(preg_match('/define\s*\(\s*([\'"])WP_CACHE\\1\s*,\s*(?:\-?[1-9][0-9\.]*|TRUE|([\'"])(?:[^0\'"]|[^\'"]{2,})\\2)\s*\)\s*;/i', $wp_config_file_contents))
if(preg_match('/\bdefine\s*\(\s*([\'"])WP_CACHE\\1\s*,\s*(?:\-?[1-9][0-9\.]*|TRUE|([\'"])(?:[^0\'"]|[^\'"]{2,})\\2)\s*\)\s*;/i', $wp_config_file_contents_no_whitespace))
return $wp_config_file_contents; // It's already in there; no need to modify this file.

if(!($wp_config_file_contents = $this->remove_wp_cache_from_wp_config()))
Expand Down Expand Up @@ -2101,17 +2109,20 @@ public function remove_wp_cache_from_wp_config()
if(!($wp_config_file = $this->find_wp_config_file()))
return ''; // Unable to find `/wp-config.php`.

if (!($wp_config_file_contents_no_whitespace = php_strip_whitespace($wp_config_file))) {
return ''; // Failure; file empty
}
if(!is_readable($wp_config_file)) return ''; // Not possible.
if(!($wp_config_file_contents = file_get_contents($wp_config_file)))
return ''; // Failure; could not read file.

if(!preg_match('/([\'"])WP_CACHE\\1/i', $wp_config_file_contents))
return $wp_config_file_contents; // Already gone.

if(preg_match('/define\s*\(\s*([\'"])WP_CACHE\\1\s*,\s*(?:0|FALSE|NULL|([\'"])0?\\2)\s*\)\s*;/i', $wp_config_file_contents) && !is_writable($wp_config_file))
if(preg_match('/\bdefine\s*\(\s*([\'"])WP_CACHE\\1\s*,\s*(?:0|FALSE|NULL|([\'"])0?\\2)\s*\)\s*;/i', $wp_config_file_contents_no_whitespace) && !is_writable($wp_config_file))
return $wp_config_file_contents; // It's already disabled, and since we can't write to this file let's let this slide.

if(!($wp_config_file_contents = preg_replace('/define\s*\(\s*([\'"])WP_CACHE\\1\s*,\s*(?:\-?[0-9\.]+|TRUE|FALSE|NULL|([\'"])[^\'"]*\\2)\s*\)\s*;/i', '', $wp_config_file_contents)))
if(!($wp_config_file_contents = preg_replace('/\bdefine\s*\(\s*([\'"])WP_CACHE\\1\s*,\s*(?:\-?[0-9\.]+|TRUE|FALSE|NULL|([\'"])[^\'"]*\\2)\s*\)\s*;/i', '', $wp_config_file_contents)))
return ''; // Failure; something went terribly wrong here.

if(preg_match('/([\'"])WP_CACHE\\1/i', $wp_config_file_contents))
Expand Down
67 changes: 62 additions & 5 deletions zencache/zencache.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
Version: 150930
Version: 151107
Text Domain: zencache
Plugin Name: ZenCache
Network: true
Expand All @@ -12,9 +12,66 @@
Description: ZenCache is an advanced WordPress caching plugin inspired by simplicity. Speed up your site (BIG time!) with a reliable and fast WordPress cache.
*/
if(!defined('WPINC')) // MUST have WordPress.
exit('Do NOT access this file directly: '.basename(__FILE__));
exit('Do NOT access this file directly: '.basename(__FILE__));

$GLOBALS['wp_php_rv'] = '5.3.2'; // Require PHP v5.3.2+.
if(require(dirname(__FILE__).'/submodules/wp-php-rv/wp-php-rv.php'))
require_once dirname(__FILE__).'/zencache.inc.php';
else wp_php_rv_notice('ZenCache');

if(require(dirname(__FILE__).'/submodules/wp-php-rv/wp-php-rv.php')) {
if (!empty($_REQUEST['zencache_min_php54_warning_bypass']) && is_admin()) {
update_site_option('zencache_min_php54_warning_bypass', time());
}
if (!empty($_REQUEST['zencache_apc_deprecated_warning_bypass']) && is_admin()) {
update_site_option('zencache_apc_deprecated_warning_bypass', time());
}
$_apc_enabled = (extension_loaded('apc') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN) && stripos((string)ini_get('apc.filters'), 'zencache') === false) ? true : false;
if (!version_compare(PHP_VERSION, '5.4', '>=')) {
if (!get_site_option('zencache_min_php54_warning_bypass') && is_admin()) {
${__FILE__}['php54_warning'] = '<h3 style="margin:.5em 0 .25em 0;">'.__('<strong>NOTICE: ZenCache Minimum PHP Version</strong></h3>', 'zencache');
${__FILE__}['php54_warning'] .= '<p style="margin-top:0;">'.sprintf(__('<strong>As of December 1st, 2015 ZenCache will require PHP 5.4 or higher.</strong> Your server is currently running PHP v%1$s. You will need to upgrade to PHP 5.4 or higher to run the next version of ZenCache.', 'zencache'), esc_html(PHP_VERSION)).'</p>';
${__FILE__}['php54_warning'] .= '<p style="margin-top:0;">'.__('Learn more about this upcoming change here: <a href="http://zencache.com/r/new-minimum-php-version-php-5-4/" target="_blank">New Minimum PHP Version: PHP 5.4</a>', 'zencache').'</p>';
if ($_apc_enabled) {
${__FILE__}['php54_warning'] .= '<p style="margin-top:0;">'.__('Your server is also running the <strong>outdated PHP APC extension</strong>. Please see: <a href="http://zencache.com/r/php-apc-extension-no-longer-supported/" target="_blank">PHP APC Extension No Longer Supported</a>', 'zencache').'</p>';
}
${__FILE__}['php54_warning'] .= '<p style="margin-bottom:.5em;">'.__('<a href="'.esc_attr(add_query_arg('zencache_min_php54_warning_bypass', '1')).'" onclick="if(!confirm(\'Are you sure? Press OK to continue, or Cancel to stop and read carefully.\')) return false;">Dismiss this notice.</a>', 'zencache').'</p>';
add_action(
'all_admin_notices', create_function(
'', 'if(!current_user_can(\'activate_plugins\'))'.
' return;'."\n".// User missing capability.
'echo \''.// Wrap `$notice` inside a WordPress error.
'<div class="error">'.
' '.str_replace("'", "\\'", ${__FILE__}['php54_warning']).
'</div>'.
'\';'
)
);
}
unset(${__FILE__}); // Housekeeping.
} else if (version_compare(PHP_VERSION, '5.4', '>=') && $_apc_enabled) {
if (!get_site_option('zencache_apc_deprecated_warning_bypass') && is_admin()) {
${__FILE__}['apc_deprecated_warning'] = '<h3 style="margin:.5em 0 .25em 0;">'.__('<strong>NOTICE: ZenCache + PHP APC Extension</strong></h3>', 'zencache');
${__FILE__}['apc_deprecated_warning'] .= '<p style="margin-top:0;">'.sprintf(__('<strong>As of December 1st, 2015 ZenCache will no longer run with the outdated PHP APC extension.</strong> It appears that you\'re currently running PHP v%1$s with APC enabled. You will need to follow one of the actions below to run the next version of ZenCache.', 'zencache'), esc_html(PHP_VERSION)).'</p>';
${__FILE__}['apc_deprecated_warning'] .= __('<h4 style="margin:0 0 .5em 0; font-size:1.25em;"><span class="dashicons dashicons-lightbulb"></span> Options Available (Action Required):</h4>', 'zencache');
${__FILE__}['apc_deprecated_warning'] .= '<ul style="margin-left:2em; list-style:disc;">';
${__FILE__}['apc_deprecated_warning'] .= ' <li>'.__('Please add <code>ini_set(\'apc.cache_by_default\', false);</code> to the top of your <code>/wp-config.php</code> file. That will get rid of this message and allow ZenCache to run without issue.', 'zencache').'</li>';
${__FILE__}['apc_deprecated_warning'] .= ' <li>'.__('Or, contact your web hosting provider and ask about upgrading to PHP v5.5+; which includes the new <a href="http://zencache.com/r/php-opcache-extension/" target="_blank">OPcache extension for PHP</a>. The new OPcache extension replaces APC in modern versions of PHP.', 'zencache').'</li>';
${__FILE__}['apc_deprecated_warning'] .= '</ul>';
${__FILE__}['apc_deprecated_warning'] .= '<p style="margin-top:0;">'.__('To learn more about this upcoming change, please see the announcement: <a href="http://zencache.com/r/php-apc-extension-no-longer-supported/" target="_blank">PHP APC Extension No Longer Supported</a>', 'zencache').'</p>';
${__FILE__}['apc_deprecated_warning'] .= '<p style="margin-bottom:.5em;">'.__('<a href="'.esc_attr(add_query_arg('zencache_apc_deprecated_warning_bypass', '1')).'" onclick="if(!confirm(\'Are you sure? Press OK to continue, or Cancel to stop and read carefully.\')) return false;">Dismiss this notice.</a>', 'zencache').'</p>';
add_action(
'all_admin_notices', create_function(
'', 'if(!current_user_can(\'activate_plugins\'))'.
' return;'."\n".// User missing capability.
'echo \''.// Wrap `$notice` inside a WordPress error.
'<div class="error">'.
' '.str_replace("'", "\\'", ${__FILE__}['apc_deprecated_warning']).
'</div>'.
'\';'
)
);
}
unset(${__FILE__}); // Housekeeping.
}
require_once dirname(__FILE__).'/zencache.inc.php';
} else {
wp_php_rv_notice('ZenCache');
}

0 comments on commit fa5b206

Please sign in to comment.