* @var string $internalPath
*/
list($storage, $internalPath) = self::resolvePath($path);
- $cache = new Cache($storage);
- $scanner = new Scanner($storage);
- $scanner->scan($internalPath, Scanner::SCAN_SHALLOW);
- $cache->correctFolderSize($internalPath);
- self::eTagUpdate($path);
+ if ($storage) {
+ $cache = $storage->getCache();
+ $scanner = $storage->getScanner();
+ $scanner->scan($internalPath, Scanner::SCAN_SHALLOW);
+ $cache->correctFolderSize($internalPath);
++ self::eTagUpdate($path);
+ }
}
static public function deleteUpdate($path) {
* @var string $internalPath
*/
list($storage, $internalPath) = self::resolvePath($path);
- $cache = new Cache($storage);
- $cache->remove($internalPath);
- $cache->correctFolderSize($internalPath);
- self::eTagUpdate($path);
+ if ($storage) {
+ $cache = $storage->getCache();
+ $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::eTagUpdate($parent);
+ }
+ }
}
}