]> source.dussan.org Git - nextcloud-server.git/commitdiff
remove non existing files from the cache when rescanning a folder
authorRobin Appelman <icewind@owncloud.com>
Sun, 29 Apr 2012 13:09:47 +0000 (15:09 +0200)
committerRobin Appelman <icewind@owncloud.com>
Sun, 29 Apr 2012 13:09:47 +0000 (15:09 +0200)
lib/filecache.php
lib/filesystem.php

index 28a9eb247a6fa92dbed427d4e69007d702a3a40c..431470696a6e33998e7394c5578e0959a3b9d486 100644 (file)
@@ -522,26 +522,30 @@ class OC_FileCache{
                        $view=new OC_FilesystemView(($root=='/')?'':$root);
                }
                self::scanFile($path,$root);
-               $dh=$view->opendir($path.'/');
-               $totalSize=0;
-               if($dh){
-                       while (($filename = readdir($dh)) !== false) {
-                               if($filename != '.' and $filename != '..'){
-                                       $file=$path.'/'.$filename;
-                                       if($view->is_dir($file.'/')){
-                                               self::scan($file,$eventSource,$count,$root);
-                                       }else{
-                                               $totalSize+=self::scanFile($file,$root);
-                                               $count++;
-                                               if($count>$lastSend+25 and $eventSource){
-                                                       $lastSend=$count;
-                                                       $eventSource->send('scanning',array('file'=>$path,'count'=>$count));
+               if(self::inCache($path)){
+                       self::updateFolder($path,$root);
+               }else{
+                       $dh=$view->opendir($path.'/');
+                       $totalSize=0;
+                       if($dh){
+                               while (($filename = readdir($dh)) !== false) {
+                                       if($filename != '.' and $filename != '..'){
+                                               $file=$path.'/'.$filename;
+                                               if($view->is_dir($file.'/')){
+                                                       self::scan($file,$eventSource,$count,$root);
+                                               }else{
+                                                       $totalSize+=self::scanFile($file,$root);
+                                                       $count++;
+                                                       if($count>$lastSend+25 and $eventSource){
+                                                               $lastSend=$count;
+                                                               $eventSource->send('scanning',array('file'=>$path,'count'=>$count));
+                                                       }
                                                }
                                        }
                                }
                        }
+                       self::increaseSize($view->getRoot().$path,$totalSize);
                }
-               self::increaseSize($view->getRoot().$path,$totalSize);
        }
 
        /**
index 1b91eabc7c17a553e1e05ff9374280ff84123b8f..cac7e8648ef127e08a5faeaf7d5e2e966c4290a3 100644 (file)
@@ -275,6 +275,7 @@ class OC_Filesystem{
                if(class_exists($class)){
                        return new $class($arguments);
                }else{
+                       OC_Log::write('core','storage backend '.$class.' not found',OC_Log::ERROR);
                        return false;
                }
        }