Skip to content

Commit 7a025ff

Browse files
committed
feat(preview): Make it possible to disable on preview migration
Signed-off-by: Carl Schwan <[email protected]>
1 parent 6149168 commit 7a025ff

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

core/AppInfo/ConfigLexicon.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class ConfigLexicon implements ILexicon {
3838

3939
public const LASTCRON_TIMESTAMP = 'lastcron';
4040

41+
public const ON_DEMAND_PREVIEW_MIGRATION = 'on_demand_preview_migration';
42+
4143
public function getStrictness(): Strictness {
4244
return Strictness::IGNORE;
4345
}
@@ -93,6 +95,12 @@ public function getAppConfigs(): array {
9395
new Entry(self::OCM_INVITE_ACCEPT_DIALOG, ValueType::STRING, '', 'route to local invite accept dialog', note: 'set as empty string to disable feature'),
9496
new Entry(self::UNIFIED_SEARCH_MIN_SEARCH_LENGTH, ValueType::INT, 1, 'Minimum search length to trigger the request', rename: 'unified-search.min-search-length'),
9597
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'),
98+
new Entry(
99+
key: self::ON_DEMAND_PREVIEW_MIGRATION,
100+
type: ValueType::BOOL,
101+
defaultRaw: true,
102+
definition: 'Whether on demand preview migration is enabled.'
103+
),
96104
];
97105
}
98106

lib/private/Preview/Generator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
namespace OC\Preview;
88

9+
use OC\Core\AppInfo\ConfigLexicon;
910
use OC\Preview\Db\Preview;
1011
use OC\Preview\Db\PreviewMapper;
1112
use OC\Preview\Storage\PreviewFile;
@@ -111,7 +112,7 @@ public function generatePreviews(File $file, array $specifications, ?string $mim
111112

112113
[$file->getId() => $previews] = $this->previewMapper->getAvailablePreviews([$file->getId()]);
113114

114-
if (empty($previews)) {
115+
if (empty($previews) && $this->appConfig->getValueBool('core', ConfigLexicon::ON_DEMAND_PREVIEW_MIGRATION)) {
115116
$previews = $this->migrateOldPreviews($file->getId());
116117
}
117118

@@ -201,7 +202,7 @@ public function generatePreviews(File $file, array $specifications, ?string $mim
201202
}
202203

203204
/**
204-
* @return array<string|int, string[]>
205+
* @return Preview[]
205206
*/
206207
private function migrateOldPreviews(int $fileId): array {
207208
if ($this->appConfig->getValueBool('core', 'previewMovedDone')) {

0 commit comments

Comments
 (0)