summaryrefslogtreecommitdiffstats
path: root/lib/private/files/view.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-10-02 17:37:33 +0200
committerRobin Appelman <icewind@owncloud.com>2014-10-24 12:32:55 +0200
commit0a3f57f832213d5b4f6678581d7c2bc8d6832542 (patch)
tree6b7d03a6d56441d0dce5c7765f247b0a6b406907 /lib/private/files/view.php
parent0525341a1243bcf1ef992407af524e391efd7624 (diff)
downloadnextcloud-server-0a3f57f832213d5b4f6678581d7c2bc8d6832542.tar.gz
nextcloud-server-0a3f57f832213d5b4f6678581d7c2bc8d6832542.zip
Pass the cached data to the filesystem watcher
Diffstat (limited to 'lib/private/files/view.php')
-rw-r--r--lib/private/files/view.php26
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 3d3406af94e..a9577b193c7 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -313,7 +313,7 @@ class View {
if (!$result) {
// If create file fails because of permissions on external storage like SMB folders,
// check file exists and return false if not.
- if(!$this->file_exists($path)){
+ if (!$this->file_exists($path)) {
return false;
}
if (is_null($mtime)) {
@@ -891,22 +891,23 @@ class View {
if ($storage) {
$cache = $storage->getCache($internalPath);
- if (!$cache->inCache($internalPath)) {
+ $data = $cache->get($internalPath);
+ $watcher = $storage->getWatcher($internalPath);
+
+ // if the file is not in the cache or needs to be updated, trigger the scanner and reload the data
+ if (!$data) {
if (!$storage->file_exists($internalPath)) {
return false;
}
$scanner = $storage->getScanner($internalPath);
$scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW);
- } else {
- $watcher = $storage->getWatcher($internalPath);
- $data = $watcher->checkUpdate($internalPath);
- }
-
- if (!is_array($data)) {
+ $data = $cache->get($internalPath);
+ } else if ($watcher->checkUpdate($internalPath, $data)) {
$data = $cache->get($internalPath);
}
if ($data and isset($data['fileid'])) {
+ // upgrades from oc6 or lower might not have the permissions set in the file cache
if ($data['permissions'] === 0) {
$data['permissions'] = $storage->getPermissions($data['path']);
$cache->update($data['fileid'], array('permissions' => $data['permissions']));
@@ -956,8 +957,9 @@ class View {
if (!Filesystem::isValidPath($directory)) {
return $result;
}
- $path = Filesystem::normalizePath($this->fakeRoot . '/' . $directory);
- list($storage, $internalPath) = Filesystem::resolvePath($path);
+ $path = $this->getAbsolutePath($directory);
+ /** @var \OC\Files\Storage\Storage $storage */
+ list($storage, $internalPath) = $this->resolvePath($directory);
if ($storage) {
$cache = $storage->getCache($internalPath);
$user = \OC_User::getUser();
@@ -975,7 +977,7 @@ class View {
* @var \OC\Files\FileInfo[] $files
*/
$files = array();
- $contents = $cache->getFolderContents($internalPath, $folderId); //TODO: mimetype_filter
+ $contents = $cache->getFolderContentsById($folderId); //TODO: mimetype_filter
foreach ($contents as $content) {
if ($content['permissions'] === 0) {
$content['permissions'] = $storage->getPermissions($content['path']);
@@ -1213,7 +1215,7 @@ class View {
* @return string|null
*/
public function getPath($id) {
- $id = (int) $id;
+ $id = (int)$id;
$manager = Filesystem::getMountManager();
$mounts = $manager->findIn($this->fakeRoot);
$mounts[] = $manager->find($this->fakeRoot);