[Pkg-owncloud-commits] [owncloud] 132/394: stop increasing folder sizes once we hit a non folder
David Prévot
taffit at alioth.debian.org
Fri Nov 8 23:11:45 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.
commit 3e20032a322f4f97931eca7fbad3416d4b5fb6c4
Author: Robin Appelman <icewind at owncloud.com>
Date: Fri Nov 16 17:54:58 2012 +0100
stop increasing folder sizes once we hit a non folder
fixes #234
Conflicts:
lib/filecache.php
---
lib/filecache.php | 37 +++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)
diff --git a/lib/filecache.php b/lib/filecache.php
index 402c50b..e7b5374 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -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;
+ }
}
}
@@ -514,21 +527,21 @@ class OC_FileCache{
}
}
- /**
- * get the real path and the root of a shared file
- * @param string $path
- * @return array with the path and the root of the give file
+ /**
+ * get the real path and the root of a shared file
+ * @param string $path
+ * @return array with the path and the root of the give file
*/
private static function getSourcePathOfSharedFile($path, $root) {
if ( OC_App::isEnabled('files_sharing')) {
$fullPath = OC_Filesystem::normalizePath($root.'/'.$path);
$sharedPos = strpos($fullPath, '/Shared/');
- if ( $sharedPos !== false && ($source = OC_Files_Sharing_Util::getSourcePath(substr($fullPath, $sharedPos+8))) ) {
- $source = OC_Files_Sharing_Util::getSourcePath(str_replace('/Shared/', '', $path));
- $parts = explode('/', $source, 4);
- $root = '/'.$parts[1].'/files';
+ if ( $sharedPos !== false && ($source = OC_Files_Sharing_Util::getSourcePath(substr($fullPath, $sharedPos+8))) ) {
+ $source = OC_Files_Sharing_Util::getSourcePath(str_replace('/Shared/', '', $path));
+ $parts = explode('/', $source, 4);
+ $root = '/'.$parts[1].'/files';
$path = '/'.$parts[3];
- }
+ }
}
return array($path, $root);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list