feat(preview): Make it possible to disable on preview migration

Signed-off-by: Carl Schwan <carlschwan@kde.org>
This commit is contained in:
Carl Schwan 2026-01-12 13:54:58 +01:00
parent 6149168129
commit 7a025ffb0b
No known key found for this signature in database
GPG key ID: 02325448204E452A
2 changed files with 11 additions and 2 deletions

View file

@ -38,6 +38,8 @@ class ConfigLexicon implements ILexicon {
public const LASTCRON_TIMESTAMP = 'lastcron';
public const ON_DEMAND_PREVIEW_MIGRATION = 'on_demand_preview_migration';
public function getStrictness(): Strictness {
return Strictness::IGNORE;
}
@ -93,6 +95,12 @@ class ConfigLexicon implements ILexicon {
new Entry(self::OCM_INVITE_ACCEPT_DIALOG, ValueType::STRING, '', 'route to local invite accept dialog', note: 'set as empty string to disable feature'),
new Entry(self::UNIFIED_SEARCH_MIN_SEARCH_LENGTH, ValueType::INT, 1, 'Minimum search length to trigger the request', rename: 'unified-search.min-search-length'),
new Entry(self::UNIFIED_SEARCH_MAX_RESULTS_PER_REQUEST, ValueType::INT, 25, 'Maximum results returned per search request', rename: 'unified-search.max-results-per-request'),
new Entry(
key: self::ON_DEMAND_PREVIEW_MIGRATION,
type: ValueType::BOOL,
defaultRaw: true,
definition: 'Whether on demand preview migration is enabled.'
),
];
}

View file

@ -6,6 +6,7 @@
*/
namespace OC\Preview;
use OC\Core\AppInfo\ConfigLexicon;
use OC\Preview\Db\Preview;
use OC\Preview\Db\PreviewMapper;
use OC\Preview\Storage\PreviewFile;
@ -111,7 +112,7 @@ class Generator {
[$file->getId() => $previews] = $this->previewMapper->getAvailablePreviews([$file->getId()]);
if (empty($previews)) {
if (empty($previews) && $this->appConfig->getValueBool('core', ConfigLexicon::ON_DEMAND_PREVIEW_MIGRATION)) {
$previews = $this->migrateOldPreviews($file->getId());
}
@ -201,7 +202,7 @@ class Generator {
}
/**
* @return array<string|int, string[]>
* @return Preview[]
*/
private function migrateOldPreviews(int $fileId): array {
if ($this->appConfig->getValueBool('core', 'previewMovedDone')) {