[Pkg-owncloud-commits] [owncloud] 14/69: only lock in getDirectoryContent if we need to update the cache
David Prévot
taffit at moszumanska.debian.org
Wed Nov 11 02:04:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit 046c72c84a9a2f759cddfd389a56073bdd2bc4b3
Author: Robin Appelman <icewind at owncloud.com>
Date: Mon Oct 26 15:08:17 2015 +0100
only lock in getDirectoryContent if we need to update the cache
---
lib/private/files/view.php | 40 ++++++++++++++++++----------------------
1 file changed, 18 insertions(+), 22 deletions(-)
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index b4c611d..c1bbbfa 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -1272,33 +1272,29 @@ class View {
*/
$files = array();
- try {
+ $data = $cache->get($internalPath);
+ $watcher = $storage->getWatcher($internalPath);
+ if (!$data or $data['size'] === -1) {
$this->lockFile($directory, ILockingProvider::LOCK_SHARED);
-
- $data = $cache->get($internalPath);
- $watcher = $storage->getWatcher($internalPath);
- if (!$data or $data['size'] === -1) {
- if (!$storage->file_exists($internalPath)) {
- $this->unlockFile($directory, ILockingProvider::LOCK_SHARED);
- return array();
- }
- $scanner = $storage->getScanner($internalPath);
- $scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW);
- $data = $cache->get($internalPath);
- } else if ($watcher->checkUpdate($internalPath, $data)) {
- $this->updater->propagate($path);
- $data = $cache->get($internalPath);
+ if (!$storage->file_exists($internalPath)) {
+ $this->unlockFile($directory, ILockingProvider::LOCK_SHARED);
+ return array();
}
-
- $folderId = $data['fileid'];
- $contents = $cache->getFolderContentsById($folderId); //TODO: mimetype_filter
-
+ $scanner = $storage->getScanner($internalPath);
+ $scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW);
+ $data = $cache->get($internalPath);
+ $this->unlockFile($directory, ILockingProvider::LOCK_SHARED);
+ } else if ($watcher->needsUpdate($internalPath, $data)) {
+ $this->lockFile($directory, ILockingProvider::LOCK_SHARED);
+ $watcher->update($internalPath, $data);
+ $this->updater->propagate($path);
+ $data = $cache->get($internalPath);
$this->unlockFile($directory, ILockingProvider::LOCK_SHARED);
- } catch (LockedException $e) {
- // dont try to update the cache when the file is locked
- $contents = $cache->getFolderContents($internalPath);
}
+ $folderId = $data['fileid'];
+ $contents = $cache->getFolderContentsById($folderId); //TODO: mimetype_filter
+
foreach ($contents as $content) {
if ($content['permissions'] === 0) {
$content['permissions'] = $storage->getPermissions($content['path']);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list