]> source.dussan.org Git - nextcloud-server.git/commitdiff
Cache: don't check if the parent exists in the cache if we are already sure it does
authorRobin Appelman <icewind@owncloud.com>
Sat, 27 Jul 2013 09:36:27 +0000 (11:36 +0200)
committerRobin Appelman <icewind@owncloud.com>
Sat, 27 Jul 2013 09:36:27 +0000 (11:36 +0200)
lib/files/cache/scanner.php

index bcd6032fcac7649e108afc5c72607451936deb48..d8e58f624a1b00c5942777def2c8717854d43fb5 100644 (file)
@@ -75,9 +75,10 @@ class Scanner extends BasicEmitter {
         *
         * @param string $file
         * @param int $reuseExisting
+        * @param bool $parentExists
         * @return array with metadata of the scanned file
         */
-       public function scanFile($file, $reuseExisting = 0) {
+       public function scanFile($file, $reuseExisting = 0, $parentExists = false) {
                if (!self::isPartialFile($file)
                        and !Filesystem::isFileBlacklisted($file)
                ) {
@@ -85,7 +86,7 @@ class Scanner extends BasicEmitter {
                        \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId));
                        $data = $this->getData($file);
                        if ($data) {
-                               if ($file) {
+                               if ($file and !$parentExists) {
                                        $parent = dirname($file);
                                        if ($parent === '.' or $parent === '/') {
                                                $parent = '';
@@ -162,7 +163,7 @@ class Scanner extends BasicEmitter {
                                $child = ($path) ? $path . '/' . $file : $file;
                                if (!Filesystem::isIgnoredDir($file)) {
                                        $newChildren[] = $file;
-                                       $data = $this->scanFile($child, $reuse);
+                                       $data = $this->scanFile($child, $reuse, true);
                                        if ($data) {
                                                if ($data['size'] === -1) {
                                                        if ($recursive === self::SCAN_RECURSIVE) {