From 956a1326a0e2c714dc6a2c935d48eb3fe7deb80d Mon Sep 17 00:00:00 2001 From: Raam Dev Date: Thu, 22 Oct 2015 23:50:57 -0400 Subject: [PATCH 1/8] Fix bug with commented-out WP_CACHE definition being ignored. See websharks/zencache#591 --- zencache/zencache.inc.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/zencache/zencache.inc.php b/zencache/zencache.inc.php index b80e5f9..8599bdb 100644 --- a/zencache/zencache.inc.php +++ b/zencache/zencache.inc.php @@ -2062,11 +2062,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())) @@ -2101,6 +2104,9 @@ 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. @@ -2108,10 +2114,10 @@ public function remove_wp_cache_from_wp_config() 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)) From 80ddc4849bb8964a2beba7257e38cf6ab75e3879 Mon Sep 17 00:00:00 2001 From: Raam Dev Date: Thu, 22 Oct 2015 23:52:51 -0400 Subject: [PATCH 2/8] Fix formatting. See websharks/zencache#591 --- zencache/zencache.inc.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zencache/zencache.inc.php b/zencache/zencache.inc.php index 8599bdb..e1189b3 100644 --- a/zencache/zencache.inc.php +++ b/zencache/zencache.inc.php @@ -2062,9 +2062,9 @@ 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 (!($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. @@ -2104,9 +2104,9 @@ 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 (!($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. From 3673c0c8be0ba8b5fe7447fe0b867214679e5891 Mon Sep 17 00:00:00 2001 From: Raam Dev Date: Thu, 5 Nov 2015 23:40:46 -0500 Subject: [PATCH 3/8] Announce PHP 5.4+ Minimum Requirement and APC Extension Not Supported --- zencache/zencache.php | 67 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/zencache/zencache.php b/zencache/zencache.php index 971b885..ab3f6ed 100644 --- a/zencache/zencache.php +++ b/zencache/zencache.php @@ -15,6 +15,67 @@ 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 (empty($_REQUEST['zencache_min_php54_warning_bypass']) && is_admin()) { + ${__FILE__}['php54_warning'] = '

'.__('NOTICE: ZenCache Minimum PHP Version

', 'zencache'); + ${__FILE__}['php54_warning'] .= '

'.sprintf(__('As of December 1st, 2015 ZenCache will require PHP 5.4 or higher. The minimum PHP version required to run ZenCache is being increased from PHP 5.3.2+ to PHP 5.4+. It appears that 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)).'

'; + ${__FILE__}['php54_warning'] .= '

'.__('To learn more about this upcoming change, please see the announcement: New Minimum PHP Version: PHP 5.4', 'zencache').'

'; + if ($_apc_enabled) { + ${__FILE__}['php54_warning'] .= '

'.__('Additionally, it appears that your server is also running the outdated PHP APC extension. The PHP APC extension will also no longer be supported as of December 1st, 2015. Please see: PHP APC Extension No Longer Supported', 'zencache').'

'; + } + ${__FILE__}['php54_warning'] .= '

'.__('Dismiss this notice.', 'zencache').'

'; + + 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. + + '
'. + ' '.str_replace("'", "\\'", ${__FILE__}['php54_warning']). + '
'. + + '\';' + ) + ); + } + unset(${__FILE__}); // Housekeeping. + } else if (version_compare(PHP_VERSION, '5.4', '>=') && $_apc_enabled) { + if (empty($_REQUEST['zencache_apc_deprecated_warning_bypass']) && is_admin()) { + ${__FILE__}['apc_deprecated_warning'] = '

'.__('NOTICE: PHP APC Extension No Longer Supported

', 'zencache'); + ${__FILE__}['apc_deprecated_warning'] .= '

'.__('As of December 1st, 2015 ZenCache will no longer support the outdated PHP APC extension. It appears that your server is currently running the PHP APC extension. You will need to switch to the PHP OPcache extension or upgrade to PHP 5.5+ to run the next version of ZenCache.', 'zencache').'

'; + ${__FILE__}['apc_deprecated_warning'] .= '

'.__('To learn more about this upcoming change, please see the announcement: PHP APC Extension No Longer Supported', 'zencache').'

'; + ${__FILE__}['apc_deprecated_warning'] .= '

'.__('Dismiss this notice.', 'zencache').'

'; + + 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. + + '
'. + ' '.str_replace("'", "\\'", ${__FILE__}['apc_deprecated_warning']). + '
'. + + '\';' + ) + ); + } + unset(${__FILE__}); // Housekeeping. + } else { + require_once dirname(__FILE__).'/zencache.inc.php'; + } +} else { + wp_php_rv_notice('ZenCache'); +} From 9e62718ee60358840a4ed26167a87d5cc77bbba6 Mon Sep 17 00:00:00 2001 From: Raam Dev Date: Fri, 6 Nov 2015 14:00:06 -0500 Subject: [PATCH 4/8] Improve PHP 5.4+ Minimum Requirement and APC Extension Notices --- zencache/zencache.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/zencache/zencache.php b/zencache/zencache.php index ab3f6ed..0855711 100644 --- a/zencache/zencache.php +++ b/zencache/zencache.php @@ -27,10 +27,10 @@ if (!version_compare(PHP_VERSION, '5.4', '>=')) { if (empty($_REQUEST['zencache_min_php54_warning_bypass']) && is_admin()) { ${__FILE__}['php54_warning'] = '

'.__('NOTICE: ZenCache Minimum PHP Version

', 'zencache'); - ${__FILE__}['php54_warning'] .= '

'.sprintf(__('As of December 1st, 2015 ZenCache will require PHP 5.4 or higher. The minimum PHP version required to run ZenCache is being increased from PHP 5.3.2+ to PHP 5.4+. It appears that 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)).'

'; - ${__FILE__}['php54_warning'] .= '

'.__('To learn more about this upcoming change, please see the announcement: New Minimum PHP Version: PHP 5.4', 'zencache').'

'; + ${__FILE__}['php54_warning'] .= '

'.sprintf(__('As of December 1st, 2015 ZenCache will require PHP 5.4 or higher. 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)).'

'; + ${__FILE__}['php54_warning'] .= '

'.__('Learn more about this upcoming change here: New Minimum PHP Version: PHP 5.4', 'zencache').'

'; if ($_apc_enabled) { - ${__FILE__}['php54_warning'] .= '

'.__('Additionally, it appears that your server is also running the outdated PHP APC extension. The PHP APC extension will also no longer be supported as of December 1st, 2015. Please see: PHP APC Extension No Longer Supported', 'zencache').'

'; + ${__FILE__}['php54_warning'] .= '

'.__('Your server is also running the outdated PHP APC extension. Please see: PHP APC Extension No Longer Supported', 'zencache').'

'; } ${__FILE__}['php54_warning'] .= '

'.__('Dismiss this notice.', 'zencache').'

'; @@ -52,8 +52,13 @@ unset(${__FILE__}); // Housekeeping. } else if (version_compare(PHP_VERSION, '5.4', '>=') && $_apc_enabled) { if (empty($_REQUEST['zencache_apc_deprecated_warning_bypass']) && is_admin()) { - ${__FILE__}['apc_deprecated_warning'] = '

'.__('NOTICE: PHP APC Extension No Longer Supported

', 'zencache'); - ${__FILE__}['apc_deprecated_warning'] .= '

'.__('As of December 1st, 2015 ZenCache will no longer support the outdated PHP APC extension. It appears that your server is currently running the PHP APC extension. You will need to switch to the PHP OPcache extension or upgrade to PHP 5.5+ to run the next version of ZenCache.', 'zencache').'

'; + ${__FILE__}['apc_deprecated_warning'] = '

'.__('NOTICE: ZenCache + PHP APC Extension

', 'zencache'); + ${__FILE__}['apc_deprecated_warning'] .= '

'.sprintf(__('As of December 1st, 2015 ZenCache will no longer run with the outdated PHP APC extension. 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)).'

'; + ${__FILE__}['apc_deprecated_warning'] .= __('

Options Available (Action Required):

', 'zencache'); + ${__FILE__}['apc_deprecated_warning'] .= '
    '; + ${__FILE__}['apc_deprecated_warning'] .= '
  • '.__('Please add ini_set(\'apc.cache_by_default\', false); to the top of your /wp-config.php file. That will get rid of this message and allow ZenCache to run without issue.', 'zencache').'
  • '; + ${__FILE__}['apc_deprecated_warning'] .= '
  • '.__('Or, contact your web hosting provider and ask about upgrading to PHP v5.5+; which includes the new OPcache extension for PHP. The new OPcache extension replaces APC in modern versions of PHP.', 'zencache').'
  • '; + ${__FILE__}['apc_deprecated_warning'] .= '
'; ${__FILE__}['apc_deprecated_warning'] .= '

'.__('To learn more about this upcoming change, please see the announcement: PHP APC Extension No Longer Supported', 'zencache').'

'; ${__FILE__}['apc_deprecated_warning'] .= '

'.__('Dismiss this notice.', 'zencache').'

'; From 30b8b784d43e3d4f48db0545a9adfabf0a724134 Mon Sep 17 00:00:00 2001 From: Raam Dev Date: Fri, 6 Nov 2015 21:32:04 -0500 Subject: [PATCH 5/8] Releasing ZenCache v151107 --- zencache/CHANGELOG.md | 6 +++ zencache/includes/share.php | 2 +- zencache/includes/translations/zencache.pot | 50 ++++++++++++++++++--- zencache/readme.txt | 8 +++- zencache/zencache.php | 2 +- 5 files changed, 60 insertions(+), 8 deletions(-) diff --git a/zencache/CHANGELOG.md b/zencache/CHANGELOG.md index cefcfb6..0c23cb4 100644 --- a/zencache/CHANGELOG.md +++ b/zencache/CHANGELOG.md @@ -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). diff --git a/zencache/includes/share.php b/zencache/includes/share.php index 44bd70a..1a791bd 100644 --- a/zencache/includes/share.php +++ b/zencache/includes/share.php @@ -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__`. diff --git a/zencache/includes/translations/zencache.pot b/zencache/includes/translations/zencache.pot index 6708aa1..8a7c642 100644 --- a/zencache/includes/translations/zencache.pot +++ b/zencache/includes/translations/zencache.pot @@ -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 02:30:49+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -1437,18 +1437,58 @@ msgstr "" msgid "Doing it wrong! Missing `base_dir` option value. MUST call this method after `setup()`." msgstr "" -#: zencache.inc.php:2494 +#: zencache.inc.php:2500 msgid "Lite" msgstr "" -#: zencache.inc.php:2495 +#: zencache.inc.php:2501 msgid "Pro" msgstr "" -#: zencache.inc.php:2501 +#: zencache.inc.php:2507 msgid "%1$s is NOT running. A conflicting plugin, %2$s, is currently active. Please deactivate the %2$s plugin to clear this message." msgstr "" +#: zencache.php:29 +msgid "NOTICE: ZenCache Minimum PHP Version" +msgstr "" + +#: zencache.php:30 +msgid "As of December 1st, 2015 ZenCache will require PHP 5.4 or higher. 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: New Minimum PHP Version: PHP 5.4" +msgstr "" + +#: zencache.php:33 +msgid "Your server is also running the outdated PHP APC extension. Please see: PHP APC Extension No Longer Supported" +msgstr "" + +#: zencache.php:55 +msgid "NOTICE: ZenCache + PHP APC Extension" +msgstr "" + +#: zencache.php:56 +msgid "As of December 1st, 2015 ZenCache will no longer run with the outdated PHP APC extension. 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:57 +msgid "

Options Available (Action Required):

" +msgstr "" + +#: zencache.php:59 +msgid "Please add ini_set('apc.cache_by_default', false); to the top of your /wp-config.php file. That will get rid of this message and allow ZenCache to run without issue." +msgstr "" + +#: zencache.php:60 +msgid "Or, contact your web hosting provider and ask about upgrading to PHP v5.5+; which includes the new OPcache extension for PHP. The new OPcache extension replaces APC in modern versions of PHP." +msgstr "" + +#: zencache.php:62 +msgid "To learn more about this upcoming change, please see the announcement: PHP APC Extension No Longer Supported" +msgstr "" + #. Plugin Name of the plugin/theme msgid "ZenCache" msgstr "" diff --git a/zencache/readme.txt b/zencache/readme.txt index 0aa7ea4..a5502df 100644 --- a/zencache/readme.txt +++ b/zencache/readme.txt @@ -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 @@ -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). diff --git a/zencache/zencache.php b/zencache/zencache.php index 0855711..b3c6db8 100644 --- a/zencache/zencache.php +++ b/zencache/zencache.php @@ -1,6 +1,6 @@ Date: Sat, 7 Nov 2015 00:06:20 -0500 Subject: [PATCH 6/8] Fix PHP 5.4+ and APC notices so they don't block loading ZenCache --- zencache/zencache.php | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/zencache/zencache.php b/zencache/zencache.php index b3c6db8..f6e5cc4 100644 --- a/zencache/zencache.php +++ b/zencache/zencache.php @@ -12,7 +12,7 @@ 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+. @@ -25,7 +25,7 @@ } $_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 (empty($_REQUEST['zencache_min_php54_warning_bypass']) && is_admin()) { + if (!get_site_option('zencache_min_php54_warning_bypass') && is_admin()) { ${__FILE__}['php54_warning'] = '

'.__('NOTICE: ZenCache Minimum PHP Version

', 'zencache'); ${__FILE__}['php54_warning'] .= '

'.sprintf(__('As of December 1st, 2015 ZenCache will require PHP 5.4 or higher. 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)).'

'; ${__FILE__}['php54_warning'] .= '

'.__('Learn more about this upcoming change here: New Minimum PHP Version: PHP 5.4', 'zencache').'

'; @@ -33,25 +33,21 @@ ${__FILE__}['php54_warning'] .= '

'.__('Your server is also running the outdated PHP APC extension. Please see: PHP APC Extension No Longer Supported', 'zencache').'

'; } ${__FILE__}['php54_warning'] .= '

'.__('Dismiss this notice.', 'zencache').'

'; - 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. - '
'. ' '.str_replace("'", "\\'", ${__FILE__}['php54_warning']). '
'. - '\';' ) ); } unset(${__FILE__}); // Housekeeping. } else if (version_compare(PHP_VERSION, '5.4', '>=') && $_apc_enabled) { - if (empty($_REQUEST['zencache_apc_deprecated_warning_bypass']) && is_admin()) { + if (!get_site_option('zencache_apc_deprecated_warning_bypass') && is_admin()) { ${__FILE__}['apc_deprecated_warning'] = '

'.__('NOTICE: ZenCache + PHP APC Extension

', 'zencache'); ${__FILE__}['apc_deprecated_warning'] .= '

'.sprintf(__('As of December 1st, 2015 ZenCache will no longer run with the outdated PHP APC extension. 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)).'

'; ${__FILE__}['apc_deprecated_warning'] .= __('

Options Available (Action Required):

', 'zencache'); @@ -61,26 +57,21 @@ ${__FILE__}['apc_deprecated_warning'] .= ''; ${__FILE__}['apc_deprecated_warning'] .= '

'.__('To learn more about this upcoming change, please see the announcement: PHP APC Extension No Longer Supported', 'zencache').'

'; ${__FILE__}['apc_deprecated_warning'] .= '

'.__('Dismiss this notice.', 'zencache').'

'; - 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. - '
'. ' '.str_replace("'", "\\'", ${__FILE__}['apc_deprecated_warning']). '
'. - '\';' ) ); } unset(${__FILE__}); // Housekeeping. - } else { - require_once dirname(__FILE__).'/zencache.inc.php'; } + require_once dirname(__FILE__).'/zencache.inc.php'; } else { wp_php_rv_notice('ZenCache'); } From 09fdf6f2bc1871008cd299928e8c06e0c392d8b7 Mon Sep 17 00:00:00 2001 From: Raam Dev Date: Sat, 7 Nov 2015 00:06:41 -0500 Subject: [PATCH 7/8] Remove PHP 5.4+ and APC notices when uninstalling --- zencache/zencache.inc.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zencache/zencache.inc.php b/zencache/zencache.inc.php index e1189b3..0501218 100644 --- a/zencache/zencache.inc.php +++ b/zencache/zencache.inc.php @@ -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'); From e6739eaac251827edc74c81a944aa9c337afcd5c Mon Sep 17 00:00:00 2001 From: Raam Dev Date: Sat, 7 Nov 2015 00:14:22 -0500 Subject: [PATCH 8/8] Update default translation file in preparation for v151107 --- zencache/includes/translations/zencache.pot | 56 ++++++++++----------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/zencache/includes/translations/zencache.pot b/zencache/includes/translations/zencache.pot index 8a7c642..183649f 100644 --- a/zencache/includes/translations/zencache.pot +++ b/zencache/includes/translations/zencache.pot @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: ZenCache 151107\n" "Report-Msgid-Bugs-To: http://wordpress.org/tag/zencache\n" -"POT-Creation-Date: 2015-11-07 02:30:49+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" @@ -1365,87 +1365,87 @@ msgstr "" msgid "%1$s: 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 ×" msgstr "" -#: zencache.inc.php:824 +#: zencache.inc.php:829 msgid "Every 15 Minutes" msgstr "" -#: zencache.inc.php:951 +#: zencache.inc.php:956 msgid "%1$s: detected significant changes. Found %2$s in the cache; auto-wiping." msgstr "" -#: zencache.inc.php:995 +#: zencache.inc.php:1000 msgid "%1$s: 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 "%1$s: detected changes. Found %2$s in the cache for %3$s ID: %4$s; auto-clearing." msgstr "" -#: zencache.inc.php:1261 +#: zencache.inc.php:1266 msgid "%1$s: detected changes. Found %2$s in the cache, for XML feeds of type: %3$s; auto-clearing." msgstr "" -#: zencache.inc.php:1310 +#: zencache.inc.php:1315 msgid "%1$s: detected changes. Found %2$s in the cache for XML sitemaps; auto-clearing." msgstr "" -#: zencache.inc.php:1353 +#: zencache.inc.php:1358 msgid "%1$s: 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 "%1$s: 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 "%1$s: detected changes. Found %2$s in the cache for Custom Post Type: %3$s; auto-clearing." msgstr "" -#: zencache.inc.php:1570 +#: zencache.inc.php:1575 msgid "%1$s: detected changes. Found %2$s in the cache for Author Page: %3$s; auto-clearing." msgstr "" -#: zencache.inc.php:1722 +#: zencache.inc.php:1727 msgid "%1$s: detected changes. Found %2$s in the cache for %3$s: %4$s; 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:2500 +#: zencache.inc.php:2505 msgid "Lite" msgstr "" -#: zencache.inc.php:2501 +#: zencache.inc.php:2506 msgid "Pro" msgstr "" -#: zencache.inc.php:2507 +#: zencache.inc.php:2512 msgid "%1$s is NOT running. A conflicting plugin, %2$s, is currently active. Please deactivate the %2$s plugin to clear this message." msgstr "" @@ -1465,27 +1465,27 @@ msgstr "" msgid "Your server is also running the outdated PHP APC extension. Please see: PHP APC Extension No Longer Supported" msgstr "" -#: zencache.php:55 +#: zencache.php:51 msgid "NOTICE: ZenCache + PHP APC Extension" msgstr "" -#: zencache.php:56 +#: zencache.php:52 msgid "As of December 1st, 2015 ZenCache will no longer run with the outdated PHP APC extension. 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:57 +#: zencache.php:53 msgid "

Options Available (Action Required):

" msgstr "" -#: zencache.php:59 +#: zencache.php:55 msgid "Please add ini_set('apc.cache_by_default', false); to the top of your /wp-config.php file. That will get rid of this message and allow ZenCache to run without issue." msgstr "" -#: zencache.php:60 +#: zencache.php:56 msgid "Or, contact your web hosting provider and ask about upgrading to PHP v5.5+; which includes the new OPcache extension for PHP. The new OPcache extension replaces APC in modern versions of PHP." msgstr "" -#: zencache.php:62 +#: zencache.php:58 msgid "To learn more about this upcoming change, please see the announcement: PHP APC Extension No Longer Supported" msgstr ""