diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-11-04 23:58:42 -0800 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-11-04 23:58:42 -0800 |
commit | d48ba5a5bf0668690e54d4ed68f8aa31d8946cf9 (patch) | |
tree | 8c9f2e438277dfd9a1f0c9ea1f24155619ab532f /lib | |
parent | b767bbcddacc62741e8bed585c080092448bb829 (diff) | |
parent | a7cb16aab1f100995a417e74111371835622478d (diff) | |
download | nextcloud-server-d48ba5a5bf0668690e54d4ed68f8aa31d8946cf9.tar.gz nextcloud-server-d48ba5a5bf0668690e54d4ed68f8aa31d8946cf9.zip |
Merge pull request #5540 from owncloud/scanner-enhancments-master
Scanner enhancments master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/cache/cache.php | 1 | ||||
-rw-r--r-- | lib/private/files/cache/scanner.php | 19 |
2 files changed, 17 insertions, 3 deletions
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index c1e5b34c8aa..8c34fa58540 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -144,6 +144,7 @@ class Cache { $data['fileid'] = (int)$data['fileid']; $data['size'] = (int)$data['size']; $data['mtime'] = (int)$data['mtime']; + $data['storage_mtime'] = (int)$data['storage_mtime']; $data['encrypted'] = (bool)$data['encrypted']; $data['unencrypted_size'] = (int)$data['unencrypted_size']; $data['storage'] = $this->storageId; diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index f63abf2d4fc..17f99d675ae 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -62,8 +62,12 @@ class Scanner extends BasicEmitter { * @return array with metadata of the file */ public function getData($path) { + if (!$this->storage->isReadable($path)) { + //cant read, nothing we can do + \OCP\Util::writeLog('OC\Files\Cache\Scanner', "!!! Path '$path' is not readable !!!", \OCP\Util::DEBUG); + return null; + } $data = array(); - if (!$this->storage->isReadable($path)) return null; //cant read, nothing we can do $data['mimetype'] = $this->storage->getMimeType($path); $data['mtime'] = $this->storage->filemtime($path); if ($data['mimetype'] == 'httpd/unix-directory') { @@ -104,7 +108,9 @@ class Scanner extends BasicEmitter { $newData = $data; $cacheData = $this->cache->get($file); if ($cacheData) { - $this->permissionsCache->remove($cacheData['fileid']); + if (isset($cacheData['fileid'])) { + $this->permissionsCache->remove($cacheData['fileid']); + } if ($reuseExisting) { // prevent empty etag $etag = $cacheData['etag']; @@ -136,7 +142,14 @@ class Scanner extends BasicEmitter { } } // Only update metadata that has changed - $newData = array_diff($data, $cacheData); + $newData = array_diff_assoc($data, $cacheData); + if (isset($newData['etag'])) { + $cacheDataString = print_r($cacheData, true); + $dataString = print_r($data, true); + \OCP\Util::writeLog('OC\Files\Cache\Scanner', + "!!! No reuse of etag for '$file' !!! \ncache: $cacheDataString \ndata: $dataString", + \OCP\Util::DEBUG); + } } } if (!empty($newData)) { |