|
|
@ -350,12 +350,25 @@ class OC_FileCache{ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static function increaseSize($path, $sizeDiff, $root=false) { |
|
|
|
public static function increaseSize($path, $sizeDiff, $root=false) { |
|
|
|
if($sizeDiff==0) return; |
|
|
|
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 |
|
|
|
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=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `size`=`size`+? WHERE `id`=?'); |
|
|
|
$query->execute(array($sizeDiff, $id)); |
|
|
|
$query->execute(array($sizeDiff, $id)); |
|
|
|
$id=self::getParentId($path); |
|
|
|
if($path == '' or $path =='/'){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
$path=dirname($path); |
|
|
|
$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; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|