diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-10-16 15:17:36 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-10-24 12:33:54 +0200 |
commit | 16cfca6a5fb3db897246e6ac9ccb7420cf256240 (patch) | |
tree | adaf149c6c3ce621c82ae18bf00dbaf79908f8fd /lib | |
parent | 4438c7de1d0a66bb2c4eaff3bd718e5c946caa6f (diff) | |
download | nextcloud-server-16cfca6a5fb3db897246e6ac9ccb7420cf256240.tar.gz nextcloud-server-16cfca6a5fb3db897246e6ac9ccb7420cf256240.zip |
Better reuse of cache data for getFolderContents
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/view.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php index a9577b193c7..5f5f29ded4f 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -964,15 +964,20 @@ class View { $cache = $storage->getCache($internalPath); $user = \OC_User::getUser(); - if ($cache->getStatus($internalPath) < Cache\Cache::COMPLETE) { + $data = $cache->get($internalPath); + $watcher = $storage->getWatcher($internalPath); + if (!$data or $data['size'] === -1) { + if (!$storage->file_exists($internalPath)) { + return array(); + } $scanner = $storage->getScanner($internalPath); $scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW); - } else { - $watcher = $storage->getWatcher($internalPath); - $watcher->checkUpdate($internalPath); + $data = $cache->get($internalPath); + } else if ($watcher->checkUpdate($internalPath, $data)) { + $data = $cache->get($internalPath); } - $folderId = $cache->getId($internalPath); + $folderId = $data['fileid']; /** * @var \OC\Files\FileInfo[] $files */ @@ -1034,7 +1039,7 @@ class View { break; } } - $rootEntry['path'] = substr($path . '/' . $rootEntry['name'], strlen($user) + 2); // full path without /$user/ + $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ // if sharing was disabled for the user we remove the share permissions if (\OCP\Util::isSharingDisabledForUser()) { |