Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
use source cache when listing folder during recursive copy
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and juliusknorr committed Jun 19, 2023
commit 7895d98bc2dc481fda73f203ac550e74890599c4
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