when a file is locked use old cache data

This commit is contained in:
Robin Appelman 2015-11-04 14:45:10 +01:00
parent 0a56313ca4
commit c487f0f138
1 changed files with 37 additions and 29 deletions

View File

@ -1194,6 +1194,7 @@ class View {
$data = $cache->get($internalPath);
$watcher = $storage->getWatcher($internalPath);
try {
// if the file is not in the cache or needs to be updated, trigger the scanner and reload the data
if (!$data) {
$this->lockFile($relativePath, ILockingProvider::LOCK_SHARED);
@ -1212,6 +1213,9 @@ class View {
$data = $cache->get($internalPath);
$this->unlockFile($relativePath, ILockingProvider::LOCK_SHARED);
}
} catch (LockedException $e) {
// if the file is locked we just use the old cache info
}
if ($data and isset($data['fileid'])) {
// upgrades from oc6 or lower might not have the permissions set in the file cache
@ -1278,6 +1282,7 @@ class View {
$data = $cache->get($internalPath);
$watcher = $storage->getWatcher($internalPath);
try {
if (!$data or $data['size'] === -1) {
$this->lockFile($directory, ILockingProvider::LOCK_SHARED);
if (!$storage->file_exists($internalPath)) {
@ -1295,6 +1300,9 @@ class View {
$data = $cache->get($internalPath);
$this->unlockFile($directory, ILockingProvider::LOCK_SHARED);
}
} catch (LockedException $e) {
// if the file is locked we just use the old cache info
}
$folderId = $data['fileid'];
$contents = $cache->getFolderContentsById($folderId); //TODO: mimetype_filter