summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoricewind1991 <robin@icewind.nl>2014-01-20 10:37:18 -0800
committericewind1991 <robin@icewind.nl>2014-01-20 10:37:18 -0800
commit92d8db6f19971d2df3b229e8b12a35cac03607c3 (patch)
tree5e430778eeef20b17f674b4de2856955d9da1381
parentee309773837bfcaeaebb922fe4535df392cd14ae (diff)
parent3d6d8d1bb683f9daca3a2b8a876e291adc320375 (diff)
downloadnextcloud-server-92d8db6f19971d2df3b229e8b12a35cac03607c3.tar.gz
nextcloud-server-92d8db6f19971d2df3b229e8b12a35cac03607c3.zip
Merge pull request #6849 from owncloud/checkupdate-reuse
Reuse the data retrieved from the cache in checkUpdate
-rw-r--r--apps/files_sharing/lib/watcher.php2
-rw-r--r--lib/private/files/cache/watcher.php4
-rw-r--r--lib/private/files/view.php7
3 files changed, 8 insertions, 5 deletions
diff --git a/apps/files_sharing/lib/watcher.php b/apps/files_sharing/lib/watcher.php
index c40cf6911b8..285b1a58c6e 100644
--- a/apps/files_sharing/lib/watcher.php
+++ b/apps/files_sharing/lib/watcher.php
@@ -32,7 +32,7 @@ class Shared_Watcher extends Watcher {
* @param string $path
*/
public function checkUpdate($path) {
- if ($path != '' && parent::checkUpdate($path)) {
+ if ($path != '' && parent::checkUpdate($path) === true) {
// since checkUpdate() has already updated the size of the subdirs,
// only apply the update to the owner's parent dirs
diff --git a/lib/private/files/cache/watcher.php b/lib/private/files/cache/watcher.php
index 58f624c8990..251ecbe7071 100644
--- a/lib/private/files/cache/watcher.php
+++ b/lib/private/files/cache/watcher.php
@@ -40,7 +40,7 @@ class Watcher {
* check $path for updates
*
* @param string $path
- * @return boolean true if path was updated, false otherwise
+ * @return boolean | array true if path was updated, otherwise the cached data is returned
*/
public function checkUpdate($path) {
$cachedEntry = $this->cache->get($path);
@@ -56,7 +56,7 @@ class Watcher {
$this->cache->correctFolderSize($path);
return true;
}
- return false;
+ return $cachedEntry;
}
/**
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 8893911ed5d..d97544b865e 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -801,6 +801,7 @@ class View {
* @var string $internalPath
*/
list($storage, $internalPath) = Filesystem::resolvePath($path);
+ $data = null;
if ($storage) {
$cache = $storage->getCache($internalPath);
$permissionsCache = $storage->getPermissionsCache($internalPath);
@@ -811,10 +812,12 @@ class View {
$scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW);
} else {
$watcher = $storage->getWatcher($internalPath);
- $watcher->checkUpdate($internalPath);
+ $data = $watcher->checkUpdate($internalPath);
}
- $data = $cache->get($internalPath);
+ if (!is_array($data)) {
+ $data = $cache->get($internalPath);
+ }
if ($data and $data['fileid']) {
if ($includeMountPoints and $data['mimetype'] === 'httpd/unix-directory') {