Skip to content

Commit

Permalink
Merge branch 'release/150930'
Browse files Browse the repository at this point in the history
  • Loading branch information
raamdev committed Sep 30, 2015
2 parents 34cc519 + 7e2dd0d commit 3b5f691
Show file tree
Hide file tree
Showing 9 changed files with 395 additions and 386 deletions.
5 changes: 5 additions & 0 deletions zencache/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
= 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).
- **Enhancement**: Updated Text Domain throughout codebase in preparation for plugin import to translate.wordpress.org. See [Issue #576](https://github.com/websharks/zencache/issues/576).

= v150718 =

- **Bug Fix**: Fixed a Fatal Error when upgrading from v150629 to the latest version of ZenCache. This fatal error only occurred on sites that had `WP_DEBUG` enabled, at which point ZenCache failed to properly update `advanced-cache.php`. When `WP_DEBUG` was disabled, the new version of ZenCache was able to properly update `advanced-cache.php` and therefore the temporary failure was silent and inconsequential. This bug fix ensures that no fatal error will be produced when upgrading from v150629, even if `WP_DEBUG` is enabled. See [Issue #524](https://github.com/websharks/zencache/issues/524).
Expand Down
76 changes: 38 additions & 38 deletions zencache/includes/advanced-cache.tpl.php

Large diffs are not rendered by default.

536 changes: 268 additions & 268 deletions zencache/includes/menu-pages.php

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions 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 = '150718';
public $version = '150930';

/**
* Plugin slug; based on `__NAMESPACE__`.
Expand Down Expand Up @@ -262,7 +262,7 @@ public function cache_dir($rel_path = '')
$cache_dir = ZENCACHE_DIR; // Global constant.

if(empty($cache_dir)) // No cache directory?
throw new \exception(__('Unable to determine cache directory location.', $this->text_domain));
throw new \exception(__('Unable to determine cache directory location.', 'zencache'));

return $cache_dir.($rel_path ? '/'.ltrim((string)$rel_path) : '');
}
Expand Down Expand Up @@ -1610,7 +1610,7 @@ public function delete_files_from_cache_dir($regex, $check_max_age = FALSE)
$cache_dir = $this->n_dir_seps($cache_dir);

if($check_max_age && (empty($this->options) || !is_array($this->options) || !isset($this->options['cache_max_age'])))
throw new \exception(__('The `options` property w/ a `cache_max_age` key is not defined in this class.', $this->text_domain));
throw new \exception(__('The `options` property w/ a `cache_max_age` key is not defined in this class.', 'zencache'));

if($check_max_age && !($max_age = strtotime('-'.$this->options['cache_max_age'])))
return $counter; // Invalid cache expiration time.
Expand All @@ -1636,7 +1636,7 @@ public function delete_files_from_cache_dir($regex, $check_max_age = FALSE)
// Uncomment the above line to debug regex pattern matching used by this routine; and others that call upon it.

if(!rename($cache_dir, $cache_dir_tmp)) // Work from tmp directory so deletions are atomic.
throw new \exception(sprintf(__('Unable to delete files. Rename failure on directory: `%1$s`.', $this->text_domain), $cache_dir));
throw new \exception(sprintf(__('Unable to delete files. Rename failure on directory: `%1$s`.', 'zencache'), $cache_dir));

/** @var $_resource \RecursiveDirectoryIterator Regex iterator reference for IDEs. */
foreach(($_dir_regex_iteration = $this->dir_regex_iteration($cache_dir_tmp, $cache_dir_tmp_regex)) as $_resource)
Expand All @@ -1659,7 +1659,7 @@ public function delete_files_from_cache_dir($regex, $check_max_age = FALSE)
break; // Break switch handler.

if(!unlink($_path_name)) // Throw exception if unable to delete.
throw new \exception(sprintf(__('Unable to delete symlink: `%1$s`.', $this->text_domain), $_path_name));
throw new \exception(sprintf(__('Unable to delete symlink: `%1$s`.', 'zencache'), $_path_name));
$counter++; // Increment counter for each link we delete.

break; // Break switch handler.
Expand All @@ -1671,7 +1671,7 @@ public function delete_files_from_cache_dir($regex, $check_max_age = FALSE)
break; // Break switch handler.

if(!unlink($_path_name)) // Throw exception if unable to delete.
throw new \exception(sprintf(__('Unable to delete file: `%1$s`.', $this->text_domain), $_path_name));
throw new \exception(sprintf(__('Unable to delete file: `%1$s`.', 'zencache'), $_path_name));
$counter++; // Increment counter for each file we delete.

break; // Break switch handler.
Expand All @@ -1685,19 +1685,19 @@ public function delete_files_from_cache_dir($regex, $check_max_age = FALSE)
break; // Break switch handler. Not deleting everything in this case.

if(!rmdir($_path_name)) // Throw exception if unable to delete the directory itself.
throw new \exception(sprintf(__('Unable to delete dir: `%1$s`.', $this->text_domain), $_path_name));
throw new \exception(sprintf(__('Unable to delete dir: `%1$s`.', 'zencache'), $_path_name));
# $counter++; // Increment counter for each directory we delete. ~ NO don't do that here.

break; // Break switch handler.

default: // Something else that is totally unexpected here.
throw new \exception(sprintf(__('Unexpected resource type: `%1$s`.', $this->text_domain), $_resource_type));
throw new \exception(sprintf(__('Unexpected resource type: `%1$s`.', 'zencache'), $_resource_type));
}
}
unset($_dir_regex_iteration, $_resource, $_resource_type, $_sub_path_name, $_path_name, $_lstat); // Housekeeping.

if(!rename($cache_dir_tmp, $cache_dir)) // Deletions are atomic; restore original directory now.
throw new \exception(sprintf(__('Unable to delete files. Rename failure on tmp directory: `%1$s`.', $this->text_domain), $cache_dir_tmp));
throw new \exception(sprintf(__('Unable to delete files. Rename failure on tmp directory: `%1$s`.', 'zencache'), $cache_dir_tmp));

/* ------- End lock state... ------------- */

Expand Down Expand Up @@ -1752,7 +1752,7 @@ public function delete_files_from_host_cache_dir($regex, $check_max_age = FALSE)
$cache_dir = $this->n_dir_seps($cache_dir);

if($check_max_age && (empty($this->options) || !is_array($this->options) || !isset($this->options['cache_max_age'])))
throw new \exception(__('The `options` property w/ a `cache_max_age` key is not defined in this class.', $this->text_domain));
throw new \exception(__('The `options` property w/ a `cache_max_age` key is not defined in this class.', 'zencache'));

if($check_max_age && !($max_age = strtotime('-'.$this->options['cache_max_age'])))
return $counter; // Invalid cache expiration time.
Expand Down Expand Up @@ -1797,7 +1797,7 @@ public function delete_files_from_host_cache_dir($regex, $check_max_age = FALSE)
// Uncomment the above line to debug regex pattern matching used by this routine; and others that call upon it.

if(!rename($_host_cache_dir, $_host_cache_dir_tmp)) // Work from tmp directory so deletions are atomic.
throw new \exception(sprintf(__('Unable to delete files. Rename failure on tmp directory: `%1$s`.', $this->text_domain), $_host_cache_dir));
throw new \exception(sprintf(__('Unable to delete files. Rename failure on tmp directory: `%1$s`.', 'zencache'), $_host_cache_dir));

/** @var $_file_dir \RecursiveDirectoryIterator Regex iterator reference for IDEs. */
foreach(($_dir_regex_iteration = $this->dir_regex_iteration($_host_cache_dir_tmp, $_host_cache_dir_tmp_regex)) as $_resource)
Expand All @@ -1820,7 +1820,7 @@ public function delete_files_from_host_cache_dir($regex, $check_max_age = FALSE)
break; // Break switch handler.

if(!unlink($_path_name)) // Throw exception if unable to delete.
throw new \exception(sprintf(__('Unable to delete symlink: `%1$s`.', $this->text_domain), $_path_name));
throw new \exception(sprintf(__('Unable to delete symlink: `%1$s`.', 'zencache'), $_path_name));
$counter++; // Increment counter for each link we delete.

break; // Break switch handler.
Expand All @@ -1832,7 +1832,7 @@ public function delete_files_from_host_cache_dir($regex, $check_max_age = FALSE)
break; // Break switch handler.

if(!unlink($_path_name)) // Throw exception if unable to delete.
throw new \exception(sprintf(__('Unable to delete file: `%1$s`.', $this->text_domain), $_path_name));
throw new \exception(sprintf(__('Unable to delete file: `%1$s`.', 'zencache'), $_path_name));
$counter++; // Increment counter for each file we delete.

break; // Break switch handler.
Expand All @@ -1846,19 +1846,19 @@ public function delete_files_from_host_cache_dir($regex, $check_max_age = FALSE)
break; // Break switch handler. Not deleting everything in this case.

if(!rmdir($_path_name)) // Throw exception if unable to delete the directory itself.
throw new \exception(sprintf(__('Unable to delete dir: `%1$s`.', $this->text_domain), $_path_name));
throw new \exception(sprintf(__('Unable to delete dir: `%1$s`.', 'zencache'), $_path_name));
# $counter++; // Increment counter for each directory we delete. ~ NO don't do that here.

break; // Break switch handler.

default: // Something else that is totally unexpected here.
throw new \exception(sprintf(__('Unexpected resource type: `%1$s`.', $this->text_domain), $_resource_type));
throw new \exception(sprintf(__('Unexpected resource type: `%1$s`.', 'zencache'), $_resource_type));
}
}
unset($_dir_regex_iteration, $_resource, $_resource_type, $_sub_path_name, $_path_name, $_lstat); // Housekeeping.

if(!rename($_host_cache_dir_tmp, $_host_cache_dir)) // Deletions are atomic; restore original directory now.
throw new \exception(sprintf(__('Unable to delete files. Rename failure on tmp directory: `%1$s`.', $this->text_domain), $_host_cache_dir_tmp));
throw new \exception(sprintf(__('Unable to delete files. Rename failure on tmp directory: `%1$s`.', 'zencache'), $_host_cache_dir_tmp));
}
unset($_host_scheme, $_host_url, $_host_cache_path_flags, $_host_cache_path,
$_host_cache_dir, $_host_cache_dir_tmp, $_host_cache_dir_tmp_regex); // Housekeeping.
Expand Down Expand Up @@ -1912,7 +1912,7 @@ public function delete_all_files_dirs_in($dir, $delete_dir_too = FALSE)
clearstatcache(); // Clear stat cache to be sure we have a fresh start below.

if(!rename($dir, $dir_temp)) // Work from tmp directory so deletions are atomic.
throw new \exception(sprintf(__('Unable to delete all files/dirs. Rename failure on tmp directory: `%1$s`.', $this->text_domain), $dir));
throw new \exception(sprintf(__('Unable to delete all files/dirs. Rename failure on tmp directory: `%1$s`.', 'zencache'), $dir));

/** @var $_file_dir \RecursiveDirectoryIterator for IDEs. */
foreach(($_dir_regex_iteration = $this->dir_regex_iteration($dir_temp, '/.+/')) as $_resource)
Expand All @@ -1926,40 +1926,40 @@ public function delete_all_files_dirs_in($dir, $delete_dir_too = FALSE)
case 'link': // Symbolic links; i.e. 404 errors.

if(!unlink($_path_name)) // Throw exception if unable to delete.
throw new \exception(sprintf(__('Unable to delete symlink: `%1$s`.', $this->text_domain), $_path_name));
throw new \exception(sprintf(__('Unable to delete symlink: `%1$s`.', 'zencache'), $_path_name));
$counter++; // Increment counter for each link we delete.

break; // Break switch handler.

case 'file': // Regular files; i.e. not symlinks.

if(!unlink($_path_name)) // Throw exception if unable to delete.
throw new \exception(sprintf(__('Unable to delete file: `%1$s`.', $this->text_domain), $_path_name));
throw new \exception(sprintf(__('Unable to delete file: `%1$s`.', 'zencache'), $_path_name));
$counter++; // Increment counter for each file we delete.

break; // Break switch handler.

case 'dir': // A regular directory; i.e. not a symlink.

if(!rmdir($_path_name)) // Throw exception if unable to delete the directory itself.
throw new \exception(sprintf(__('Unable to delete dir: `%1$s`.', $this->text_domain), $_path_name));
throw new \exception(sprintf(__('Unable to delete dir: `%1$s`.', 'zencache'), $_path_name));
$counter++; // Increment counter for each directory we delete.

break; // Break switch handler.

default: // Something else that is totally unexpected here.
throw new \exception(sprintf(__('Unexpected resource type: `%1$s`.', $this->text_domain), $_resource_type));
throw new \exception(sprintf(__('Unexpected resource type: `%1$s`.', 'zencache'), $_resource_type));
}
}
unset($_dir_regex_iteration, $_resource, $_resource_type, $_sub_path_name, $_path_name); // Housekeeping.

if(!rename($dir_temp, $dir)) // Deletions are atomic; restore original directory now.
throw new \exception(sprintf(__('Unable to delete all files/dirs. Rename failure on tmp directory: `%1$s`.', $this->text_domain), $dir_temp));
throw new \exception(sprintf(__('Unable to delete all files/dirs. Rename failure on tmp directory: `%1$s`.', 'zencache'), $dir_temp));

if($delete_dir_too) // Delete parent? i.e. delete the `$dir` itself also?
{
if(!rmdir($dir)) // Throw exception if unable to delete.
throw new \exception(sprintf(__('Unable to delete directory: `%1$s`.', $this->text_domain), $dir));
throw new \exception(sprintf(__('Unable to delete directory: `%1$s`.', 'zencache'), $dir));
$counter++; // Increment counter for each directory we delete.
}
/* ------- End lock state... ------------- */
Expand Down Expand Up @@ -1994,7 +1994,7 @@ public function cache_lock()
return FALSE;

if(!($wp_config_file = $this->find_wp_config_file()))
throw new \exception(__('Unable to find the wp-config.php file.', $this->text_domain));
throw new \exception(__('Unable to find the wp-config.php file.', 'zencache'));

$locking_method = $this->apply_wp_filters(__METHOD__.'_lock_type', 'flock');

Expand All @@ -2010,12 +2010,12 @@ public function cache_lock()
// Use `flock()` as a decent fallback when `sem_get()` is not not forced or is not possible.

if(!($tmp_dir = $this->get_tmp_dir()))
throw new \exception(__('No writable tmp directory.', $this->text_domain));
throw new \exception(__('No writable tmp directory.', 'zencache'));

$inode_key = fileinode($wp_config_file);
$mutex = $tmp_dir.'/'.$this->slug.'-'.$inode_key.'.lock';
if(!($resource = fopen($mutex, 'w')) || !flock($resource, LOCK_EX))
throw new \exception(__('Unable to obtain an exclusive lock.', $this->text_domain));
throw new \exception(__('Unable to obtain an exclusive lock.', 'zencache'));

return array('type' => 'flock', 'resource' => $resource);
}
Expand Down Expand Up @@ -2068,7 +2068,7 @@ public function i18n_files($counter)
{
$counter = (integer)$counter; // Force integer.

return sprintf(_n('%1$s file', '%1$s files', $counter, $this->text_domain), $counter);
return sprintf(_n('%1$s file', '%1$s files', $counter, 'zencache'), $counter);
}

/**
Expand All @@ -2084,7 +2084,7 @@ public function i18n_dirs($counter)
{
$counter = (integer)$counter; // Force integer.

return sprintf(_n('%1$s directory', '%1$s directories', $counter, $this->text_domain), $counter);
return sprintf(_n('%1$s directory', '%1$s directories', $counter, 'zencache'), $counter);
}

/**
Expand All @@ -2100,7 +2100,7 @@ public function i18n_files_dirs($counter)
{
$counter = (integer)$counter; // Force integer.

return sprintf(_n('%1$s file/directory', '%1$s files/directories', $counter, $this->text_domain), $counter);
return sprintf(_n('%1$s file/directory', '%1$s files/directories', $counter, 'zencache'), $counter);
}

/* --------------------------------------------------------------------------------------
Expand Down Expand Up @@ -2133,7 +2133,7 @@ public function hook_id($function)
else if(is_string($function[0]))
return $function[0].'::'.$function[1];

throw new \exception(__('Invalid hook.', $this->text_domain));
throw new \exception(__('Invalid hook.', 'zencache'));
}

/**
Expand Down
16 changes: 8 additions & 8 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 150709\n"
"Project-Id-Version: ZenCache 150930\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/zencache\n"
"POT-Creation-Date: 2015-07-18 15:37:13+00:00\n"
"POT-Creation-Date: 2015-09-30 02:31:30+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 @@ -251,7 +251,7 @@ msgid "close"
msgstr ""

#: includes/menu-pages.php:115
msgid "<strong>Pro Features (Preview)</strong> ~ New option panels below. Please explore before <a href=\"http://www.websharks-inc.com/product/zencache/\" target=\"_blank\">upgrading <i class=\"fa fa-heart-o\"></i></a>.<br /><small>NOTE: the free version of %1$s (this LITE version); is more-than-adequate for most sites. Please upgrade only if you desire advanced features or would like to support the developer.</small>"
msgid "<strong>Pro Features (Preview)</strong> ~ New option panels below. Please explore before <a href=\"https://zencache.com/\" target=\"_blank\">upgrading <i class=\"fa fa-heart-o\"></i></a>.<br /><small>NOTE: the free version of %1$s (this LITE version); is more-than-adequate for most sites. Please upgrade only if you desire advanced features or would like to support the developer.</small>"
msgstr ""

#: includes/menu-pages.php:121
Expand Down Expand Up @@ -1437,15 +1437,15 @@ msgstr ""
msgid "Doing it wrong! Missing `base_dir` option value. MUST call this method after `setup()`."
msgstr ""

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

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

#: zencache.inc.php:2502
#: zencache.inc.php:2501
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 ""

Expand All @@ -1462,9 +1462,9 @@ msgid "ZenCache is an advanced WordPress caching plugin inspired by simplicity.
msgstr ""

#. Author of the plugin/theme
msgid "WebSharks, Inc."
msgid "ZenCache / WebSharks, Inc."
msgstr ""

#. Author URI of the plugin/theme
msgid "http://www.websharks-inc.com/"
msgid "https://zencache.com/"
msgstr ""
Loading

0 comments on commit 3b5f691

Please sign in to comment.