stop increasing folder sizes once we hit a non folder

fixes #234

Conflicts:
	lib/filecache.php
This commit is contained in:
Robin Appelman 2012-11-16 17:54:58 +01:00 committed by Thomas Mueller
parent f849dd0693
commit 3e20032a32
1 changed files with 25 additions and 12 deletions

View File

@ -354,12 +354,25 @@ class OC_FileCache{
*/
public static function increaseSize($path,$sizeDiff, $root=false) {
if($sizeDiff==0) return;
$id=self::getId($path,$root);
$item = OC_FileCache_Cached::get($path);
//stop walking up the filetree if we hit a non-folder
if($item['mimetype'] !== 'httpd/unix-directory'){
return;
}
$id = $item['id'];
while($id!=-1) {//walk up the filetree increasing the size of all parent folders
$query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `size`=`size`+? WHERE `id`=?');
$query->execute(array($sizeDiff,$id));
$id=self::getParentId($path);
$query->execute(array($sizeDiff, $id));
if($path == '' or $path =='/'){
return;
}
$path=dirname($path);
$parent = OC_FileCache_Cached::get($path);
$id = $parent['id'];
//stop walking up the filetree if we hit a non-folder
if($parent['mimetype'] !== 'httpd/unix-directory'){
return;
}
}
}