Update etags in parent folders

This commit is contained in:
Michael Gapczynski 2012-12-30 19:54:51 -05:00
parent 83064aca51
commit 77f12c526b
1 changed files with 24 additions and 0 deletions

View File

@ -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);
}
}
}
}
/**