diff options
Diffstat (limited to 'lib/cache/fileglobal.php')
-rw-r--r-- | lib/cache/fileglobal.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/cache/fileglobal.php b/lib/cache/fileglobal.php index d4336553c38..6d01964e185 100644 --- a/lib/cache/fileglobal.php +++ b/lib/cache/fileglobal.php @@ -57,19 +57,20 @@ class OC_Cache_FileGlobal{ public function remove($key) { $cache_dir = self::getCacheDir(); - if(!$cache_dir){ + if(!$cache_dir) { return false; } $key = $this->fixKey($key); return unlink($cache_dir.$key); } - public function clear(){ + public function clear($prefix='') { $cache_dir = self::getCacheDir(); - if($cache_dir and is_dir($cache_dir)){ + $prefix = $this->fixKey($prefix); + if($cache_dir and is_dir($cache_dir)) { $dh=opendir($cache_dir); - while($file=readdir($dh)){ - if($file!='.' and $file!='..'){ + while($file=readdir($dh)) { + if($file!='.' and $file!='..' and ($prefix==='' || strpos($file, $prefix) === 0)) { unlink($cache_dir.$file); } } |