aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-09-19 21:37:52 +0200
committerAndreas Fischer <bantu@owncloud.com>2013-09-24 00:57:58 +0200
commit235517f111a6d570e43cff1cd3701553412fc1a3 (patch)
tree7a5ea49b84fdcd63e8cdd21dc160e3e659434500 /lib
parentbc1c6039b798c9460b8bbb8ef24b0f2d12229810 (diff)
downloadnextcloud-server-235517f111a6d570e43cff1cd3701553412fc1a3.tar.gz
nextcloud-server-235517f111a6d570e43cff1cd3701553412fc1a3.zip
clear permissions cache when scanning a file
Diffstat (limited to 'lib')
-rw-r--r--lib/files/cache/scanner.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php
index a986c1ca725..af819c47c61 100644
--- a/lib/files/cache/scanner.php
+++ b/lib/files/cache/scanner.php
@@ -36,6 +36,11 @@ class Scanner extends BasicEmitter {
*/
private $cache;
+ /**
+ * @var \OC\Files\Cache\Permissions $permissionsCache
+ */
+ private $permissionsCache;
+
const SCAN_RECURSIVE = true;
const SCAN_SHALLOW = false;
@@ -46,6 +51,7 @@ class Scanner extends BasicEmitter {
$this->storage = $storage;
$this->storageId = $this->storage->getId();
$this->cache = $storage->getCache();
+ $this->permissionsCache = $storage->getPermissionsCache();
}
/**
@@ -96,7 +102,11 @@ class Scanner extends BasicEmitter {
}
}
$newData = $data;
- if ($reuseExisting and $cacheData = $this->cache->get($file)) {
+ $cacheData = $this->cache->get($file);
+ if ($cacheData) {
+ $this->permissionsCache->remove($cacheData['fileid']);
+ }
+ if ($reuseExisting and $cacheData) {
// prevent empty etag
$etag = $cacheData['etag'];
$propagateETagChange = false;
@@ -104,7 +114,6 @@ class Scanner extends BasicEmitter {
$etag = $data['etag'];
$propagateETagChange = true;
}
-
// only reuse data if the file hasn't explicitly changed
if (isset($data['mtime']) && isset($cacheData['mtime']) && $data['mtime'] === $cacheData['mtime']) {
if (($reuseExisting & self::REUSE_SIZE) && ($data['size'] === -1)) {
@@ -182,7 +191,7 @@ class Scanner extends BasicEmitter {
$newChildren = array();
if ($this->storage->is_dir($path) && ($dh = $this->storage->opendir($path))) {
\OC_DB::beginTransaction();
- if(is_resource($dh)) {
+ if (is_resource($dh)) {
while (($file = readdir($dh)) !== false) {
$child = ($path) ? $path . '/' . $file : $file;
if (!Filesystem::isIgnoredDir($file)) {