]> source.dussan.org Git - nextcloud-server.git/commitdiff
Global file cache should also be able to clear with prefix
authorBart Visscher <bartv@thisnet.nl>
Fri, 7 Sep 2012 11:16:50 +0000 (13:16 +0200)
committerBart Visscher <bartv@thisnet.nl>
Fri, 7 Sep 2012 11:42:22 +0000 (13:42 +0200)
lib/cache/fileglobal.php

index d4336553c38d53353c3ff405fa01c48a1970d588..e551ad472a265e59f342fc9c02c9c7353307f24c 100644 (file)
@@ -64,12 +64,13 @@ class OC_Cache_FileGlobal{
                return unlink($cache_dir.$key);
        }
 
-       public function clear(){
+       public function clear($prefix=''){
                $cache_dir = self::getCacheDir();
+               $prefix = $this->fixKey($prefix);
                if($cache_dir and is_dir($cache_dir)){
                        $dh=opendir($cache_dir);
                        while($file=readdir($dh)){
-                               if($file!='.' and $file!='..'){
+                               if($file!='.' and $file!='..' and ($prefix==='' || strpos($file, $prefix) === 0)){
                                        unlink($cache_dir.$file);
                                }
                        }