Skip to content

Commit

Permalink
use source cache when listing folder during recursive copy
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 authored and juliushaertl committed Jun 19, 2023
1 parent 4bfd7ee commit de85610
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 @@ -38,6 +38,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\GenericFileException;
Expand Down Expand Up @@ -593,7 +594,7 @@ public function copyFromStorage(
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 @@ -611,12 +612,12 @@ public function copy($source, $target) {
throw new NotFoundException('Source object not found');
}

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

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 @@ -625,8 +626,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 de85610

Please sign in to comment.