]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge branch 'filesystem' into filesystem-etags
authorMichael Gapczynski <mtgap@owncloud.com>
Mon, 31 Dec 2012 02:26:48 +0000 (21:26 -0500)
committerMichael Gapczynski <mtgap@owncloud.com>
Mon, 31 Dec 2012 02:26:48 +0000 (21:26 -0500)
Conflicts:
lib/files/cache/updater.php

1  2 
lib/files/cache/updater.php

index 7fc9bd382feb169464e3d3e42f62cb0b7a04436e,c8c96a97eea9e352e57e889981f3360597800bac..26041590091c8edf3ab081c18f13978b52eddfec
@@@ -30,11 -30,12 +30,13 @@@ class Updater 
                 * @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);
 +                              }
 +                      }
                }
        }