Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
perf: set the folder size in the same query as we create it
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and artonge committed Jun 2, 2025
commit 7eb607c8b9da0445f3b07c304882fba5675020f7
10 changes: 3 additions & 7 deletions lib/private/Files/ObjectStore/ObjectStoreStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __construct($params) {
$this->logger = \OCP\Server::get(LoggerInterface::class);
}

public function mkdir($path, bool $force = false) {
public function mkdir($path, bool $force = false, array $metadata = []) {
$path = $this->normalizePath($path);
if (!$force && $this->file_exists($path)) {
$this->logger->warning("Tried to create an object store folder that already exists: $path");
Expand All @@ -75,7 +75,7 @@ public function mkdir($path, bool $force = false) {
$mTime = time();
$data = [
'mimetype' => 'httpd/unix-directory',
'size' => 0,
'size' => $metadata['size'] ?? 0,
'mtime' => $mTime,
'storage_mtime' => $mTime,
'permissions' => \OCP\Constants::PERMISSION_ALL,
Expand Down Expand Up @@ -712,11 +712,7 @@ private function copyInner(ICache $sourceCache, ICacheEntry $sourceEntry, string
if ($cache->inCache($to)) {
$cache->remove($to);
}
$this->mkdir($to);
$cacheEntry = $cache->get(($to));
$cache->update($cacheEntry->getId(), [
'size' => $sourceEntry->getSize(),
]);
$this->mkdir($to, false, ['size' => $sourceEntry->getSize()]);

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