diff options
author | Robin Appelman <robin@icewind.nl> | 2021-03-12 16:10:18 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-12 16:10:18 +0000 |
commit | 32551b9ff7978395ec7777f11320056ab8413432 (patch) | |
tree | 54061bf67246637f3661c07fcecaead8b4de2712 /lib/private/Files/ObjectStore | |
parent | bf39adb49b5f102ef898feed6520df672612d15e (diff) | |
parent | c87b1a50d908f0d99622d4c71534d47af1ab9218 (diff) | |
download | nextcloud-server-32551b9ff7978395ec7777f11320056ab8413432.tar.gz nextcloud-server-32551b9ff7978395ec7777f11320056ab8413432.zip |
Merge pull request #25722 from nextcloud/objectstore-copy-cross
apply object store copy optimization when 'cross storage' copy is wit…
Diffstat (limited to 'lib/private/Files/ObjectStore')
-rw-r--r-- | lib/private/Files/ObjectStore/ObjectStoreStorage.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 3378f00c4dd..23483b3ab21 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -39,6 +39,7 @@ use OCP\Files\Cache\ICacheEntry; use OCP\Files\FileInfo; use OCP\Files\NotFoundException; use OCP\Files\ObjectStore\IObjectStore; +use OCP\Files\Storage\IStorage; class ObjectStoreStorage extends \OC\Files\Storage\Common { use CopyDirectory; @@ -530,6 +531,19 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common { return $this->objectStore; } + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) { + if ($sourceStorage->instanceOfStorage(ObjectStoreStorage::class)) { + /** @var ObjectStoreStorage $sourceStorage */ + if ($sourceStorage->getObjectStore()->getStorageId() === $this->getObjectStore()->getStorageId()) { + $sourceEntry = $sourceStorage->getCache()->get($sourceInternalPath); + $this->copyInner($sourceEntry, $targetInternalPath); + return true; + } + } + + return parent::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); + } + public function copy($path1, $path2) { $path1 = $this->normalizePath($path1); $path2 = $this->normalizePath($path2); |