diff options
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/lib/cache.php | 25 | ||||
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 5 |
2 files changed, 17 insertions, 13 deletions
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php index e9b2addea38..49f5a4e8e7c 100644 --- a/apps/files_sharing/lib/cache.php +++ b/apps/files_sharing/lib/cache.php @@ -235,18 +235,15 @@ class Shared_Cache extends Cache { } /** - * Move a file or folder in the cache + * Get the storage id and path needed for a move * - * @param string $source - * @param string $target + * @param string $path + * @return array [$storageId, $internalPath] */ - public function move($source, $target) { - if ($cache = $this->getSourceCache($source)) { - $file = \OC_Share_Backend_File::getSource($target, $this->storage->getMountPoint(), $this->storage->getItemType()); - if ($file && isset($file['path'])) { - $cache->move($this->files[$source], $file['path']); - } - } + protected function getMoveInfo($path) { + $cache = $this->getSourceCache($path); + $file = \OC_Share_Backend_File::getSource($path, $this->storage->getMountPoint(), $this->storage->getItemType()); + return [$cache->getNumericStorageId(), $file['path']]; } /** @@ -415,8 +412,12 @@ class Shared_Cache extends Cache { } else { // bubble up to source cache $sourceCache = $this->getSourceCache($path); - $parent = dirname($this->files[$path]); - $sourceCache->correctFolderSize($parent); + if (isset($this->files[$path])) { + $parent = dirname($this->files[$path]); + if ($sourceCache) { + $sourceCache->correctFolderSize($parent); + } + } } } diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index ffaa542c872..8c2f03b1419 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -327,7 +327,10 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { $targetFilename = basename($relPath2); list($user2, $path2) = \OCA\Files_Sharing\Helper::getUidAndFilename(dirname($relPath2)); $rootView = new \OC\Files\View(''); - return $rootView->rename('/' . $user1 . '/files/' . $path1, '/' . $user2 . '/files/' . $path2 . '/' . $targetFilename); + $rootView->getUpdater()->disable(); // dont update the cache here + $result = $rootView->rename('/' . $user1 . '/files/' . $path1, '/' . $user2 . '/files/' . $path2 . '/' . $targetFilename); + $rootView->getUpdater()->enable(); + return $result; } public function copy($path1, $path2) { |