]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix size calculation during recursive scan
authorRobin Appelman <icewind@owncloud.com>
Tue, 3 Jun 2014 09:55:35 +0000 (11:55 +0200)
committerRobin Appelman <icewind@owncloud.com>
Tue, 3 Jun 2014 17:54:59 +0000 (19:54 +0200)
lib/private/files/cache/scanner.php

index 5a71bd26e8979b328e161d320b592484c53e9d88..6cb9807f5a79b587e4477109bdfae41e88cf416d 100644 (file)
@@ -174,7 +174,6 @@ class Scanner extends BasicEmitter {
         * @return int the id of the added file
         */
        protected function addToCache($path, $data) {
-               echo "add";
                \OC_Hook::emit('Scanner', 'addToCache', array('file' => $path, 'data' => $data));
                $this->emit('\OC\Files\Cache\Scanner', 'addToCache', array($path, $this->storageId, $data));
                if ($this->cacheActive) {
@@ -250,11 +249,8 @@ class Scanner extends BasicEmitter {
                                                        if ($data) {
                                                                if ($data['mimetype'] === 'httpd/unix-directory' and $recursive === self::SCAN_RECURSIVE) {
                                                                        $childQueue[] = $child;
-                                                               }
-                                                               if ($data['size'] === -1) {
-                                                                       if ($recursive !== self::SCAN_RECURSIVE) {
-                                                                               $size = -1;
-                                                                       }
+                                                               } else if ($data['size'] === -1) {
+                                                                       $size = -1;
                                                                } else if ($size !== -1) {
                                                                        $size += $data['size'];
                                                                }
@@ -287,7 +283,7 @@ class Scanner extends BasicEmitter {
                                $childSize = $this->scanChildren($child, self::SCAN_RECURSIVE, $reuse);
                                if ($childSize === -1) {
                                        $size = -1;
-                               } else {
+                               } else if ($size !== -1) {
                                        $size += $childSize;
                                }
                        }