only lock in getDirectoryContent if we need to update the cache
This commit is contained in:
parent
4f2656993e
commit
fc7f7e5c37
|
@ -1276,12 +1276,10 @@ class View {
|
||||||
*/
|
*/
|
||||||
$files = array();
|
$files = array();
|
||||||
|
|
||||||
try {
|
|
||||||
$this->lockFile($directory, ILockingProvider::LOCK_SHARED);
|
|
||||||
|
|
||||||
$data = $cache->get($internalPath);
|
$data = $cache->get($internalPath);
|
||||||
$watcher = $storage->getWatcher($internalPath);
|
$watcher = $storage->getWatcher($internalPath);
|
||||||
if (!$data or $data['size'] === -1) {
|
if (!$data or $data['size'] === -1) {
|
||||||
|
$this->lockFile($directory, ILockingProvider::LOCK_SHARED);
|
||||||
if (!$storage->file_exists($internalPath)) {
|
if (!$storage->file_exists($internalPath)) {
|
||||||
$this->unlockFile($directory, ILockingProvider::LOCK_SHARED);
|
$this->unlockFile($directory, ILockingProvider::LOCK_SHARED);
|
||||||
return array();
|
return array();
|
||||||
|
@ -1289,20 +1287,18 @@ class View {
|
||||||
$scanner = $storage->getScanner($internalPath);
|
$scanner = $storage->getScanner($internalPath);
|
||||||
$scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW);
|
$scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW);
|
||||||
$data = $cache->get($internalPath);
|
$data = $cache->get($internalPath);
|
||||||
} else if ($watcher->checkUpdate($internalPath, $data)) {
|
$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);
|
$this->updater->propagate($path);
|
||||||
$data = $cache->get($internalPath);
|
$data = $cache->get($internalPath);
|
||||||
|
$this->unlockFile($directory, ILockingProvider::LOCK_SHARED);
|
||||||
}
|
}
|
||||||
|
|
||||||
$folderId = $data['fileid'];
|
$folderId = $data['fileid'];
|
||||||
$contents = $cache->getFolderContentsById($folderId); //TODO: mimetype_filter
|
$contents = $cache->getFolderContentsById($folderId); //TODO: mimetype_filter
|
||||||
|
|
||||||
$this->unlockFile($directory, ILockingProvider::LOCK_SHARED);
|
|
||||||
} catch (LockedException $e) {
|
|
||||||
// dont try to update the cache when the file is locked
|
|
||||||
$contents = $cache->getFolderContents($internalPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($contents as $content) {
|
foreach ($contents as $content) {
|
||||||
if ($content['permissions'] === 0) {
|
if ($content['permissions'] === 0) {
|
||||||
$content['permissions'] = $storage->getPermissions($content['path']);
|
$content['permissions'] = $storage->getPermissions($content['path']);
|
||||||
|
|
Loading…
Reference in New Issue