mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
feat(preview): Make it possible to disable on preview migration
Signed-off-by: Carl Schwan <carlschwan@kde.org>
This commit is contained in:
parent
6149168129
commit
7a025ffb0b
2 changed files with 11 additions and 2 deletions
|
|
@ -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.'
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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')) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue