Skip to content
Snippets Groups Projects
Commit e3adbcb7 authored by Robin Appelman's avatar Robin Appelman
Browse files

remove non existing files from the cache when rescanning a folder

parent 09a5c59c
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
/**
......
......@@ -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;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment