From 656e33e8daf2be3a51285715ea9a87bf462a6c94 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Thu, 21 Aug 2025 11:18:22 +0200 Subject: [PATCH] perf(preview): Add support for multibucket storage Signed-off-by: Carl Schwan --- lib/private/Preview/Db/Preview.php | 10 ++++++++-- lib/private/Preview/Generator.php | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/private/Preview/Db/Preview.php b/lib/private/Preview/Db/Preview.php index f2f05871082..fbecd485421 100644 --- a/lib/private/Preview/Db/Preview.php +++ b/lib/private/Preview/Db/Preview.php @@ -17,6 +17,8 @@ use OCP\IPreview; /** * @method \int getFileId() * @method void setFileId(int $fileId) + * @method \int getStorageId() + * @method void setStorageId(\int $fileId) * @method \int getWidth() * @method void setWidth(int $width) * @method \int getHeight() @@ -41,6 +43,8 @@ use OCP\IPreview; class Preview extends Entity { protected ?int $fileId = null; + protected ?int $storageId = null; + protected ?int $width = null; protected ?int $height = null; @@ -56,10 +60,12 @@ class Preview extends Entity { protected ?bool $crop = null; protected ?string $etag = null; + protected ?int $version = null; public function __construct() { - $this->addType('fileId', Types::INTEGER); + $this->addType('fileId', Types::BIGINT); + $this->addType('storageId', Types::BIGINT); $this->addType('width', Types::INTEGER); $this->addType('height', Types::INTEGER); $this->addType('mimetype', Types::INTEGER); @@ -68,7 +74,7 @@ class Preview extends Entity { $this->addType('isMax', Types::BOOLEAN); $this->addType('crop', Types::BOOLEAN); $this->addType('etag', Types::STRING); - $this->addType('version', Types::INTEGER); + $this->addType('version', Types::BIGINT); } public function getName(): string { diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index 39e1de54e69..ed4e5d32177 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -552,6 +552,7 @@ class Generator { public function savePreview(File $file, int $width, int $height, bool $crop, bool $max, IImage $preview, ?int $version): Preview { $previewEntry = new Preview(); $previewEntry->setFileId($file->getId()); + $previewEntry->setStorageId((int)$file->getStorage()->getId()); $previewEntry->setWidth($width); $previewEntry->setHeight($height); $previewEntry->setVersion($version);