|
|
@ -53,12 +53,36 @@ class Updater { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static public function renameUpdate($from, $to) { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @var \OC\Files\Storage\Storage $storageFrom |
|
|
|
|
|
|
|
* @var \OC\Files\Storage\Storage $storageTo |
|
|
|
|
|
|
|
* @var string $internalFrom |
|
|
|
|
|
|
|
* @var string $internalTo |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
list($storageFrom, $internalFrom) = self::resolvePath($from); |
|
|
|
|
|
|
|
list($storageTo, $internalTo) = self::resolvePath($to); |
|
|
|
|
|
|
|
if ($storageFrom && $storageTo) { |
|
|
|
|
|
|
|
if ($storageFrom === $storageTo) { |
|
|
|
|
|
|
|
$cache = $storageFrom->getCache($internalFrom); |
|
|
|
|
|
|
|
$cache->move($internalFrom, $internalTo); |
|
|
|
|
|
|
|
$cache->correctFolderSize($internalFrom); |
|
|
|
|
|
|
|
$cache->correctFolderSize($internalTo); |
|
|
|
|
|
|
|
self::correctFolder($from, time()); |
|
|
|
|
|
|
|
self::correctFolder($to, time()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
self::deleteUpdate($from); |
|
|
|
|
|
|
|
self::writeUpdate($to); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Update the mtime and ETag of all parent folders |
|
|
|
* Update the mtime and ETag of all parent folders |
|
|
|
* |
|
|
|
* |
|
|
|
* @param string $path |
|
|
|
* @param string $path |
|
|
|
* @param string $time |
|
|
|
* @param string $time |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static public function correctFolder($path, $time) { |
|
|
|
static public function correctFolder($path, $time) { |
|
|
|
if ($path !== '' && $path !== '/') { |
|
|
|
if ($path !== '' && $path !== '/') { |
|
|
|
$parent = dirname($path); |
|
|
|
$parent = dirname($path); |
|
|
@ -66,9 +90,9 @@ class Updater { |
|
|
|
$parent = ''; |
|
|
|
$parent = ''; |
|
|
|
} |
|
|
|
} |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @var \OC\Files\Storage\Storage $storage |
|
|
|
* @var \OC\Files\Storage\Storage $storage |
|
|
|
* @var string $internalPath |
|
|
|
* @var string $internalPath |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
list($storage, $internalPath) = self::resolvePath($parent); |
|
|
|
list($storage, $internalPath) = self::resolvePath($parent); |
|
|
|
if ($storage) { |
|
|
|
if ($storage) { |
|
|
|
$cache = $storage->getCache(); |
|
|
|
$cache = $storage->getCache(); |
|
|
@ -92,8 +116,7 @@ class Updater { |
|
|
|
* @param array $params |
|
|
|
* @param array $params |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static public function renameHook($params) { |
|
|
|
static public function renameHook($params) { |
|
|
|
self::deleteUpdate($params['oldpath']); |
|
|
|
self::renameUpdate($params['oldpath'], $params['newpath']); |
|
|
|
self::writeUpdate($params['newpath']); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|