remove non existing files from the cache when rescanning a folder

This commit is contained in:
Robin Appelman 2012-04-29 15:09:47 +02:00
parent 09a5c59cca
commit e3adbcb7d5
2 changed files with 20 additions and 15 deletions

View File

@ -522,26 +522,30 @@ class OC_FileCache{
$view=new OC_FilesystemView(($root=='/')?'':$root); $view=new OC_FilesystemView(($root=='/')?'':$root);
} }
self::scanFile($path,$root); self::scanFile($path,$root);
$dh=$view->opendir($path.'/'); if(self::inCache($path)){
$totalSize=0; self::updateFolder($path,$root);
if($dh){ }else{
while (($filename = readdir($dh)) !== false) { $dh=$view->opendir($path.'/');
if($filename != '.' and $filename != '..'){ $totalSize=0;
$file=$path.'/'.$filename; if($dh){
if($view->is_dir($file.'/')){ while (($filename = readdir($dh)) !== false) {
self::scan($file,$eventSource,$count,$root); if($filename != '.' and $filename != '..'){
}else{ $file=$path.'/'.$filename;
$totalSize+=self::scanFile($file,$root); if($view->is_dir($file.'/')){
$count++; self::scan($file,$eventSource,$count,$root);
if($count>$lastSend+25 and $eventSource){ }else{
$lastSend=$count; $totalSize+=self::scanFile($file,$root);
$eventSource->send('scanning',array('file'=>$path,'count'=>$count)); $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);
} }
/** /**

View File

@ -275,6 +275,7 @@ class OC_Filesystem{
if(class_exists($class)){ if(class_exists($class)){
return new $class($arguments); return new $class($arguments);
}else{ }else{
OC_Log::write('core','storage backend '.$class.' not found',OC_Log::ERROR);
return false; return false;
} }
} }