Skip to content

Commit

Permalink
Merge pull request #38894 from nextcloud/obj-store-copy-list-source-c…
Browse files Browse the repository at this point in the history
…ache-24
  • Loading branch information
juliusknorr authored Jun 19, 2023
2 parents 935287c + 7895d98 commit 5f49416
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/private/Files/ObjectStore/ObjectStoreStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use OC\Files\Cache\Cache;
use OC\Files\Cache\CacheEntry;
use OC\Files\Storage\PolyFill\CopyDirectory;
use OCP\Files\Cache\ICache;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\FileInfo;
use OCP\Files\NotFoundException;
Expand Down Expand Up @@ -550,7 +551,7 @@ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $t
if (is_array($sourceEntryData) && array_key_exists('scan_permissions', $sourceEntryData)) {
$sourceEntry['permissions'] = $sourceEntryData['scan_permissions'];
}
$this->copyInner($sourceEntry, $targetInternalPath);
$this->copyInner($sourceStorage->getCache(), $sourceEntry, $targetInternalPath);
return true;
}
}
Expand All @@ -568,12 +569,12 @@ public function copy($path1, $path2) {
throw new NotFoundException('Source object not found');
}

$this->copyInner($sourceEntry, $path2);
$this->copyInner($cache, $sourceEntry, $path2);

return true;
}

private function copyInner(ICacheEntry $sourceEntry, string $to) {
private function copyInner(ICache $sourceCache, ICacheEntry $sourceEntry, string $to) {
$cache = $this->getCache();

if ($sourceEntry->getMimeType() === FileInfo::MIMETYPE_FOLDER) {
Expand All @@ -582,8 +583,8 @@ private function copyInner(ICacheEntry $sourceEntry, string $to) {
}
$this->mkdir($to);

foreach ($cache->getFolderContentsById($sourceEntry->getId()) as $child) {
$this->copyInner($child, $to . '/' . $child->getName());
foreach ($sourceCache->getFolderContentsById($sourceEntry->getId()) as $child) {
$this->copyInner($sourceCache, $child, $to . '/' . $child->getName());
}
} else {
$this->copyFile($sourceEntry, $to);
Expand Down

0 comments on commit 5f49416

Please sign in to comment.