summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-includes/cache.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-01-20 17:03:17 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-01-20 17:03:17 +0000
commitde23735d75bd523cea68e43fc1ef717eb440d069 (patch)
tree324aec89bd3e3ed45a3976d526b6abd50bb5d230 /wp-inst/wp-includes/cache.php
parent42ad115c5b6e5d184a54f825a5c24b19a3b30fb3 (diff)
downloadwordpress-mu-de23735d75bd523cea68e43fc1ef717eb440d069.tar.gz
wordpress-mu-de23735d75bd523cea68e43fc1ef717eb440d069.tar.xz
wordpress-mu-de23735d75bd523cea68e43fc1ef717eb440d069.zip
WP Merge
Removed Legacy Code (Thanks IT Damager) createBlog - only backup roles class if it exists! git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@507 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-includes/cache.php')
-rw-r--r--wp-inst/wp-includes/cache.php27
1 files changed, 16 insertions, 11 deletions
diff --git a/wp-inst/wp-includes/cache.php b/wp-inst/wp-includes/cache.php
index 7e04a7f..4b9bde2 100644
--- a/wp-inst/wp-includes/cache.php
+++ b/wp-inst/wp-includes/cache.php
@@ -235,10 +235,11 @@ class WP_Object_Cache {
$dir = rtrim($dir, DIRECTORY_SEPARATOR);
$top_dir = $dir;
$stack = array($dir);
+ $index = 0;
- while (count($stack)) {
- # Get last directory on stack
- $dir = end($stack);
+ while ($index < count($stack)) {
+ # Get indexed directory from stack
+ $dir = $stack[$index];
$dh = @ opendir($dir);
if (!$dh)
@@ -247,19 +248,22 @@ class WP_Object_Cache {
while (($file = @ readdir($dh)) !== false) {
if ($file == '.' or $file == '..')
continue;
-
+
if (@ is_dir($dir . DIRECTORY_SEPARATOR . $file))
$stack[] = $dir . DIRECTORY_SEPARATOR . $file;
else if (@ is_file($dir . DIRECTORY_SEPARATOR . $file))
@ unlink($dir . DIRECTORY_SEPARATOR . $file);
}
- if (end($stack) == $dir) {
- if ( $dir != $top_dir)
- @ rmdir($dir);
- array_pop($stack);
- }
+ $index++;
}
+
+ $stack = array_reverse($stack); // Last added dirs are deepest
+ foreach($stack as $dir) {
+ if ( $dir != $top_dir)
+ @ rmdir($dir);
+ }
+
}
function release_lock() {
@@ -397,13 +401,14 @@ class WP_Object_Cache {
return;
// Disable the persistent cache if safe_mode is on.
- if ( ini_get('safe_mode') )
+ if ( ini_get('safe_mode') && ! defined('ENABLE_CACHE') )
return;
if (defined('CACHE_PATH'))
$this->cache_dir = CACHE_PATH;
else
- $this->cache_dir = ABSPATH.'wp-content/cache/';
+ // Using the correct separator eliminates some cache flush errors on Windows
+ $this->cache_dir = ABSPATH.'wp-content'.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR;
if (is_writable($this->cache_dir) && is_dir($this->cache_dir)) {
$this->cache_enabled = true;