diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-11-16 17:54:58 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-11-16 17:54:58 +0100 |
commit | 1007013833486dbf72b35ba8167944bd495da05b (patch) | |
tree | 2cf50b9936cd24553574c4edad03bae382bf1861 /lib | |
parent | 8fe69dfac69351a10e587fb845a00d3dcdf2e82c (diff) | |
download | nextcloud-server-1007013833486dbf72b35ba8167944bd495da05b.tar.gz nextcloud-server-1007013833486dbf72b35ba8167944bd495da05b.zip |
stop increasing folder sizes once we hit a non folder
fixes #234
Diffstat (limited to 'lib')
-rw-r--r-- | lib/filecache.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/filecache.php b/lib/filecache.php index 1a6100481ad..a74d7cbc390 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -350,12 +350,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); + 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; + } } } |