diff options
Diffstat (limited to 'lib/private/Files/ObjectStore/ObjectStoreStorage.php')
-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); |