diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-10-29 14:18:57 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-10-29 14:18:57 +0100 |
commit | b3626f34cd0df127d742f7a8cb2a4ddf929ff886 (patch) | |
tree | cfa75b56cfeadc36313f047ffbb2c0ca7c09a669 /lib/private/files | |
parent | b0b76fe064860d2074c91897a29e0f9ac5705db8 (diff) | |
download | nextcloud-server-b3626f34cd0df127d742f7a8cb2a4ddf929ff886.tar.gz nextcloud-server-b3626f34cd0df127d742f7a8cb2a4ddf929ff886.zip |
Update the parent folders storage_mtime on write and delete to prevent rescans
Diffstat (limited to 'lib/private/files')
-rw-r--r-- | lib/private/files/cache/updater.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php index 1f30173a8f8..b491b60b0d0 100644 --- a/lib/private/files/cache/updater.php +++ b/lib/private/files/cache/updater.php @@ -7,6 +7,7 @@ */ namespace OC\Files\Cache; + use OCP\Util; /** @@ -42,6 +43,7 @@ class Updater { $scanner->scan($internalPath, Scanner::SCAN_SHALLOW); $cache->correctFolderSize($internalPath); self::correctFolder($path, $storage->filemtime($internalPath)); + self::correctParentStorageMtime($storage, $internalPath); } } @@ -61,6 +63,7 @@ class Updater { $cache->remove($internalPath); $cache->correctFolderSize($internalPath); self::correctFolder($path, time()); + self::correctParentStorageMtime($storage, $internalPath); } } @@ -87,6 +90,8 @@ class Updater { $cache->correctFolderSize($internalTo); self::correctFolder($from, time()); self::correctFolder($to, time()); + self::correctParentStorageMtime($storageFrom, $internalFrom); + self::correctParentStorageMtime($storageTo, $internalTo); } else { self::deleteUpdate($from); self::writeUpdate($to); @@ -118,13 +123,28 @@ class Updater { $cache->update($id, array('mtime' => $time, 'etag' => $storage->getETag($internalPath))); self::correctFolder($parent, $time); } else { - Util::writeLog('core', 'Path not in cache: '.$internalPath, Util::ERROR); + Util::writeLog('core', 'Path not in cache: ' . $internalPath, Util::ERROR); } } } } /** + * update the storage_mtime of the parent + * + * @param \OC\Files\Storage\Storage $storage + * @param string $internalPath + */ + static private function correctParentStorageMtime($storage, $internalPath) { + $cache = $storage->getCache(); + $parentId = $cache->getParentId($internalPath); + $parent = dirname($internalPath); + if ($parentId != -1) { + $cache->update($parentId, array('storage_mtime' => $storage->filemtime($parent))); + } + } + + /** * @param array $params */ static public function writeHook($params) { |