Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable27] use source cache when listing folder during recursive copy #38891

Merged
merged 1 commit into from
Jun 19, 2023
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
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