diff options
Diffstat (limited to 'lib/cache')
-rw-r--r-- | lib/cache/file.php | 20 | ||||
-rw-r--r-- | lib/cache/fileglobal.php | 4 |
2 files changed, 16 insertions, 8 deletions
diff --git a/lib/cache/file.php b/lib/cache/file.php index 531e1d50f40..9fee6034a71 100644 --- a/lib/cache/file.php +++ b/lib/cache/file.php @@ -29,22 +29,30 @@ class OC_Cache_File{ } public function get($key) { + $result = null; + $proxyStatus = \OC_FileProxy::$enabled; + \OC_FileProxy::$enabled = false; if ($this->hasKey($key)) { $storage = $this->getStorage(); - return $storage->file_get_contents($key); + $result = $storage->file_get_contents($key); } - return null; + \OC_FileProxy::$enabled = $proxyStatus; + return $result; } public function set($key, $value, $ttl=0) { $storage = $this->getStorage(); + $result = false; + $proxyStatus = \OC_FileProxy::$enabled; + \OC_FileProxy::$enabled = false; if ($storage and $storage->file_put_contents($key, $value)) { if ($ttl === 0) { $ttl = 86400; // 60*60*24 } - return $storage->touch($key, time() + $ttl); + $result = $storage->touch($key, time() + $ttl); } - return false; + \OC_FileProxy::$enabled = $proxyStatus; + return $result; } public function hasKey($key) { @@ -72,7 +80,7 @@ class OC_Cache_File{ $storage = $this->getStorage(); if($storage and $storage->is_dir('/')) { $dh=$storage->opendir('/'); - while($file=readdir($dh)) { + while (($file = readdir($dh)) !== false) { if($file!='.' and $file!='..' and ($prefix==='' || strpos($file, $prefix) === 0)) { $storage->unlink('/'.$file); } @@ -86,7 +94,7 @@ class OC_Cache_File{ if($storage and $storage->is_dir('/')) { $now = time(); $dh=$storage->opendir('/'); - while($file=readdir($dh)) { + while (($file = readdir($dh)) !== false) { if($file!='.' and $file!='..') { $mtime = $storage->filemtime('/'.$file); if ($mtime < $now) { diff --git a/lib/cache/fileglobal.php b/lib/cache/fileglobal.php index 6d01964e185..2fbd8ca3edb 100644 --- a/lib/cache/fileglobal.php +++ b/lib/cache/fileglobal.php @@ -69,7 +69,7 @@ class OC_Cache_FileGlobal{ $prefix = $this->fixKey($prefix); if($cache_dir and is_dir($cache_dir)) { $dh=opendir($cache_dir); - while($file=readdir($dh)) { + while (($file = readdir($dh)) !== false) { if($file!='.' and $file!='..' and ($prefix==='' || strpos($file, $prefix) === 0)) { unlink($cache_dir.$file); } @@ -88,7 +88,7 @@ class OC_Cache_FileGlobal{ $cache_dir = self::getCacheDir(); if($cache_dir and is_dir($cache_dir)) { $dh=opendir($cache_dir); - while($file=readdir($dh)) { + while (($file = readdir($dh)) !== false) { if($file!='.' and $file!='..') { $mtime = filemtime($cache_dir.$file); if ($mtime < $now) { |