summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-07-27 11:36:27 +0200
committerRobin Appelman <icewind@owncloud.com>2013-07-27 11:36:27 +0200
commite1e7b6a9406d8f9512f37e44d396be12dc1d02df (patch)
tree92bcabaf84b35c27fc4d7a8309713d546d80501f
parent98e76b8978fafb390205b133df8bd8a172a9a32d (diff)
downloadnextcloud-server-e1e7b6a9406d8f9512f37e44d396be12dc1d02df.tar.gz
nextcloud-server-e1e7b6a9406d8f9512f37e44d396be12dc1d02df.zip
Cache: don't check if the parent exists in the cache if we are already sure it does
-rw-r--r--lib/files/cache/scanner.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php
index bcd6032fcac..d8e58f624a1 100644
--- a/lib/files/cache/scanner.php
+++ b/lib/files/cache/scanner.php
@@ -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) {