Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions lib/private/Preview/Db/Preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
* @method void setOldFileId(int $oldFileId)
* @method int getLocationId() Get the location id in the preview_locations table. Only set when using an object store as primary storage.
* @method void setLocationId(int $locationId)
* @method string getBucketName() Get the bucket name where the preview is stored. This is stored in the preview_locations table.
* @method string getObjectStoreName() Get the object store name where the preview is stored. This is stored in the preview_locations table.
* @method string|null getBucketName() Get the bucket name where the preview is stored. This is stored in the preview_locations table.
* @method string|null getObjectStoreName() Get the object store name where the preview is stored. This is stored in the preview_locations table.
* @method int getWidth() Get the width of the preview.
* @method void setWidth(int $width)
* @method int getHeight() Get the height of the preview.
Expand Down
13 changes: 10 additions & 3 deletions lib/private/Preview/Storage/ObjectStorePreviewStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public function readPreview(Preview $preview): mixed {

#[Override]
public function deletePreview(Preview $preview): void {
if (defined('PHPUNIT_RUN') && $preview->getLocationId() === null) {
// Should only be the case in unit tests when adding dummy previews in the database.
return;
}

[
'urn' => $urn,
'store' => $store,
Expand All @@ -100,10 +105,12 @@ public function migratePreview(Preview $preview, SimpleFile $file): void {
* @return ObjectStoreDefinition
*/
private function getObjectStoreInfoForExistingPreview(Preview $preview): array {
assert(!empty($preview->getObjectStoreName()));
assert(!empty($preview->getBucketName()));
$objectStoreName = $preview->getObjectStoreName();
$bucketName = $preview->getBucketName();
assert(!empty($objectStoreName));
assert(!empty($bucketName));

$config = $this->objectStoreConfig->getObjectStoreConfiguration($preview->getObjectStoreName());
$config = $this->objectStoreConfig->getObjectStoreConfiguration($objectStoreName);
$config['arguments']['bucket'] = $preview->getBucketName();
$objectStoreName = $preview->getObjectStoreName();

Expand Down
Loading