mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix(lexicon): switch bool value to non-lazy
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
parent
37df347c12
commit
ee9d5b96b4
6 changed files with 30 additions and 55 deletions
|
|
@ -49,7 +49,7 @@ class ConfigLexicon implements ILexicon {
|
|||
type: ValueType::BOOL,
|
||||
defaultRaw: true,
|
||||
definition: 'adds share permission to public shares to allow adding them to your Nextcloud (federation)',
|
||||
lazy: true,
|
||||
lazy: false,
|
||||
),
|
||||
new Entry(
|
||||
key: self::SHARE_CUSTOM_TOKEN,
|
||||
|
|
@ -59,7 +59,7 @@ class ConfigLexicon implements ILexicon {
|
|||
default => false,
|
||||
},
|
||||
definition: 'Allow users to customize share URL',
|
||||
lazy: true,
|
||||
lazy: false,
|
||||
note: 'Shares with guessable tokens may be accessed easily. Shares with custom tokens will continue to be accessible after this setting has been disabled.',
|
||||
),
|
||||
new Entry(self::SHARE_LINK_PASSWORD_DEFAULT, ValueType::BOOL, false, 'Ask for a password when sharing document by default'),
|
||||
|
|
@ -91,8 +91,8 @@ class ConfigLexicon implements ILexicon {
|
|||
definition: 'Enforce expiration date for shares via link or mail'
|
||||
),
|
||||
new Entry(self::LASTCRON_TIMESTAMP, ValueType::INT, 0, 'timestamp of last cron execution'),
|
||||
new Entry(self::OCM_DISCOVERY_ENABLED, ValueType::BOOL, true, 'enable/disable OCM', lazy: true),
|
||||
new Entry(self::OCM_INVITE_ACCEPT_DIALOG, ValueType::STRING, '', 'route to local invite accept dialog', lazy: true, note: 'set as empty string to disable feature'),
|
||||
new Entry(self::OCM_DISCOVERY_ENABLED, ValueType::BOOL, true, 'enable/disable OCM', lazy: false),
|
||||
new Entry(self::OCM_INVITE_ACCEPT_DIALOG, ValueType::STRING, '', 'route to local invite accept dialog', lazy: false, 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', lazy: false, rename: 'unified-search.min-search-length'),
|
||||
new Entry(self::UNIFIED_SEARCH_MAX_RESULTS_PER_REQUEST, ValueType::INT, 25, 'Maximum results returned per search request', lazy: false, rename: 'unified-search.max-results-per-request'),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1946,7 +1946,6 @@ return array(
|
|||
'OC\\Remote\\User' => $baseDir . '/lib/private/Remote/User.php',
|
||||
'OC\\Repair' => $baseDir . '/lib/private/Repair.php',
|
||||
'OC\\RepairException' => $baseDir . '/lib/private/RepairException.php',
|
||||
'OC\\Repair\\AddAppConfigLazyMigration' => $baseDir . '/lib/private/Repair/AddAppConfigLazyMigration.php',
|
||||
'OC\\Repair\\AddBruteForceCleanupJob' => $baseDir . '/lib/private/Repair/AddBruteForceCleanupJob.php',
|
||||
'OC\\Repair\\AddCleanupDeletedUsersBackgroundJob' => $baseDir . '/lib/private/Repair/AddCleanupDeletedUsersBackgroundJob.php',
|
||||
'OC\\Repair\\AddCleanupUpdaterBackupsJob' => $baseDir . '/lib/private/Repair/AddCleanupUpdaterBackupsJob.php',
|
||||
|
|
|
|||
|
|
@ -1987,7 +1987,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
|
|||
'OC\\Remote\\User' => __DIR__ . '/../../..' . '/lib/private/Remote/User.php',
|
||||
'OC\\Repair' => __DIR__ . '/../../..' . '/lib/private/Repair.php',
|
||||
'OC\\RepairException' => __DIR__ . '/../../..' . '/lib/private/RepairException.php',
|
||||
'OC\\Repair\\AddAppConfigLazyMigration' => __DIR__ . '/../../..' . '/lib/private/Repair/AddAppConfigLazyMigration.php',
|
||||
'OC\\Repair\\AddBruteForceCleanupJob' => __DIR__ . '/../../..' . '/lib/private/Repair/AddBruteForceCleanupJob.php',
|
||||
'OC\\Repair\\AddCleanupDeletedUsersBackgroundJob' => __DIR__ . '/../../..' . '/lib/private/Repair/AddCleanupDeletedUsersBackgroundJob.php',
|
||||
'OC\\Repair\\AddCleanupUpdaterBackupsJob' => __DIR__ . '/../../..' . '/lib/private/Repair/AddCleanupUpdaterBackupsJob.php',
|
||||
|
|
|
|||
|
|
@ -85,15 +85,39 @@ class ConfigManager {
|
|||
/**
|
||||
* Upgrade stored data in case of changes in the lexicon.
|
||||
* Heavy process to be executed on core and app upgrade.
|
||||
*
|
||||
* - upgrade UserConfig entries if set as indexed
|
||||
*/
|
||||
public function updateLexiconEntries(string $appId): void {
|
||||
$this->loadConfigServices();
|
||||
$this->updateLexiconAppConfigEntries($appId);
|
||||
$this->updateLexiconUserConfigEntries($appId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply modification on the lexicon to the stored app config values:
|
||||
*
|
||||
* - Upgrade AppConfig entries if set as lazy/not-lazy
|
||||
*/
|
||||
private function updateLexiconAppConfigEntries(string $appId): void {
|
||||
$lexicon = $this->appConfig->getConfigDetailsFromLexicon($appId);
|
||||
foreach ($lexicon['entries'] as $entry) {
|
||||
// update laziness
|
||||
$this->appConfig->updateLazy($appId, $entry->getKey(), $entry->isLazy());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply modification on the lexicon to the stored user preferences values:
|
||||
*
|
||||
* - Upgrade UserConfig entries if set as indexed/not-indexed
|
||||
* - Upgrade UserConfig entries if set as lazy/not-lazy
|
||||
*/
|
||||
private function updateLexiconUserConfigEntries(string $appId): void {
|
||||
$lexicon = $this->userConfig->getConfigDetailsFromLexicon($appId);
|
||||
foreach ($lexicon['entries'] as $entry) {
|
||||
// upgrade based on index flag
|
||||
$this->userConfig->updateGlobalIndexed($appId, $entry->getKey(), $entry->isFlagged(IUserConfig::FLAG_INDEXED));
|
||||
// update laziness
|
||||
$this->userConfig->updateGlobalLazy($appId, $entry->getKey(), $entry->isLazy());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
namespace OC;
|
||||
|
||||
use OC\DB\ConnectionAdapter;
|
||||
use OC\Repair\AddAppConfigLazyMigration;
|
||||
use OC\Repair\AddBruteForceCleanupJob;
|
||||
use OC\Repair\AddCleanupDeletedUsersBackgroundJob;
|
||||
use OC\Repair\AddCleanupUpdaterBackupsJob;
|
||||
|
|
@ -194,7 +193,6 @@ class Repair implements IOutput {
|
|||
\OCP\Server::get(AddMissingSecretJob::class),
|
||||
\OCP\Server::get(AddRemoveOldTasksBackgroundJob::class),
|
||||
\OCP\Server::get(AddMetadataGenerationJob::class),
|
||||
\OCP\Server::get(AddAppConfigLazyMigration::class),
|
||||
\OCP\Server::get(RepairLogoDimension::class),
|
||||
\OCP\Server::get(RemoveLegacyDatadirFile::class),
|
||||
\OCP\Server::get(AddCleanupDeletedUsersBackgroundJob::class),
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
namespace OC\Repair;
|
||||
|
||||
use OCP\IAppConfig;
|
||||
use OCP\Migration\IOutput;
|
||||
use OCP\Migration\IRepairStep;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class AddAppConfigLazyMigration implements IRepairStep {
|
||||
/**
|
||||
* Just add config values that needs to be migrated to lazy loading
|
||||
*/
|
||||
private static array $lazyAppConfig = [
|
||||
'core' => [
|
||||
'oc.integritycheck.checker',
|
||||
],
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
private IAppConfig $appConfig,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return 'migrate lazy config values';
|
||||
}
|
||||
|
||||
public function run(IOutput $output) {
|
||||
$c = 0;
|
||||
foreach (self::$lazyAppConfig as $appId => $configKeys) {
|
||||
foreach ($configKeys as $configKey) {
|
||||
$c += (int)$this->appConfig->updateLazy($appId, $configKey, true);
|
||||
}
|
||||
}
|
||||
|
||||
$this->logger->notice('core/BackgroundJobs/AppConfigLazyMigration: ' . $c . ' config values updated');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue