diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-12-30 19:54:51 -0500 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-12-30 19:54:51 -0500 |
commit | 77f12c526bf0010219e363844b588ffae27f1251 (patch) | |
tree | c14190de830f781b7a4945293bb94aee01205e43 /lib/files | |
parent | 83064aca51db7d8382282743ade2ab9da2a6e1b0 (diff) | |
download | nextcloud-server-77f12c526bf0010219e363844b588ffae27f1251.tar.gz nextcloud-server-77f12c526bf0010219e363844b588ffae27f1251.zip |
Update etags in parent folders
Diffstat (limited to 'lib/files')
-rw-r--r-- | lib/files/cache/updater.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/files/cache/updater.php b/lib/files/cache/updater.php index fb9783023e8..d57e4a1abe6 100644 --- a/lib/files/cache/updater.php +++ b/lib/files/cache/updater.php @@ -34,6 +34,7 @@ class Updater { $scanner = new Scanner($storage); $scanner->scan($internalPath, Scanner::SCAN_SHALLOW); $cache->correctFolderSize($internalPath); + self::eTagUpdate($path); } static public function deleteUpdate($path) { @@ -45,6 +46,29 @@ class Updater { $cache = new Cache($storage); $cache->remove($internalPath); $cache->correctFolderSize($internalPath); + self::eTagUpdate($path); + } + + static public function eTagUpdate($path) { + if ($path !== '') { + $parent = dirname($path); + if ($parent === '.') { + $parent = ''; + } + /** + * @var \OC\Files\Storage\Storage $storage + * @var string $internalPath + */ + list($storage, $internalPath) = self::resolvePath($parent); + if ($storage) { + $cache = $storage->getCache(); + $id = $cache->getId($internalPath); + if ($id !== -1) { + $cache->update($id, array('etag' => $storage->getETag($internalPath))); + self::updateFolderETags($parent); + } + } + } } /** |