Browse Source

Use typed version of IConfig::getSystemValue as much as possible

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Côme Chilliet 1 year ago
parent
commit
426c0341ff
69 changed files with 148 additions and 150 deletions
  1. 4 4
      lib/base.php
  2. 7 7
      lib/private/App/AppStore/Fetcher/Fetcher.php
  3. 1 1
      lib/private/App/Platform.php
  4. 7 7
      lib/private/AppFramework/Http/Request.php
  5. 1 1
      lib/private/Authentication/Login/FinishRememberedLoginCommand.php
  6. 5 5
      lib/private/Authentication/Token/PublicKeyTokenProvider.php
  7. 2 2
      lib/private/Collaboration/Collaborators/LookupPlugin.php
  8. 1 1
      lib/private/Console/Application.php
  9. 1 1
      lib/private/DB/Migrator.php
  10. 1 1
      lib/private/DB/OracleMigrator.php
  11. 1 1
      lib/private/DB/PgSqlTools.php
  12. 3 3
      lib/private/Encryption/Keys/Storage.php
  13. 1 1
      lib/private/Encryption/Manager.php
  14. 2 2
      lib/private/Encryption/Util.php
  15. 2 2
      lib/private/Files/Cache/Scanner.php
  16. 1 1
      lib/private/Files/Mount/CacheMountProvider.php
  17. 1 1
      lib/private/Files/Storage/Common.php
  18. 1 1
      lib/private/Files/Storage/DAV.php
  19. 2 2
      lib/private/Files/Storage/Local.php
  20. 2 2
      lib/private/Files/Template/TemplateManager.php
  21. 2 3
      lib/private/GlobalScale/Config.php
  22. 5 5
      lib/private/Http/Client/Client.php
  23. 2 2
      lib/private/IntegrityCheck/Checker.php
  24. 1 1
      lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php
  25. 6 6
      lib/private/L10N/Factory.php
  26. 1 1
      lib/private/L10N/LanguageIterator.php
  27. 1 1
      lib/private/Log/Rotate.php
  28. 10 11
      lib/private/Mail/Mailer.php
  29. 1 1
      lib/private/NavigationManager.php
  30. 2 2
      lib/private/Preview/Imaginary.php
  31. 1 1
      lib/private/PreviewManager.php
  32. 1 1
      lib/private/Repair/ClearGeneratedAvatarCache.php
  33. 3 3
      lib/private/Repair/Collation.php
  34. 2 2
      lib/private/Repair/MoveUpdaterStepFile.php
  35. 1 1
      lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php
  36. 1 1
      lib/private/Repair/NC16/ClearCollectionsAccessCache.php
  37. 1 1
      lib/private/Repair/NC18/ResetGeneratedAvatarFlag.php
  38. 1 1
      lib/private/Repair/NC20/EncryptionLegacyCipher.php
  39. 1 1
      lib/private/Repair/NC20/EncryptionMigration.php
  40. 1 1
      lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php
  41. 1 1
      lib/private/Repair/NC22/LookupServerSendCheck.php
  42. 4 4
      lib/private/Repair/NC25/AddMissingSecretJob.php
  43. 1 1
      lib/private/Repair/Owncloud/MoveAvatars.php
  44. 2 2
      lib/private/Repair/Owncloud/SaveAccountsTableData.php
  45. 1 1
      lib/private/Repair/Owncloud/UpdateLanguageCodes.php
  46. 1 1
      lib/private/Repair/RemoveLinkShares.php
  47. 1 1
      lib/private/Repair/RepairDavShares.php
  48. 1 1
      lib/private/Repair/RepairInvalidShares.php
  49. 1 1
      lib/private/Repair/RepairMimeTypes.php
  50. 1 1
      lib/private/Security/Bruteforce/Capabilities.php
  51. 2 2
      lib/private/Security/Bruteforce/Throttler.php
  52. 2 2
      lib/private/Security/CertificateManager.php
  53. 2 2
      lib/private/Security/Crypto.php
  54. 1 1
      lib/private/Security/Hasher.php
  55. 2 2
      lib/private/Security/VerificationToken/VerificationToken.php
  56. 5 5
      lib/private/Server.php
  57. 2 2
      lib/private/Setup.php
  58. 1 1
      lib/private/Share20/Manager.php
  59. 1 1
      lib/private/Support/Subscription/Registry.php
  60. 3 3
      lib/private/TemplateLayout.php
  61. 4 4
      lib/private/URLGenerator.php
  62. 4 4
      lib/private/Updater.php
  63. 1 1
      lib/private/Updater/VersionCheck.php
  64. 1 1
      lib/private/User/Database.php
  65. 3 3
      lib/private/User/Session.php
  66. 2 2
      lib/private/User/User.php
  67. 1 1
      lib/private/legacy/OC_FileChunking.php
  68. 1 1
      lib/private/legacy/OC_Helper.php
  69. 6 6
      lib/private/legacy/OC_Util.php

+ 4 - 4
lib/base.php

@@ -569,7 +569,7 @@ class OC {
 				self::sendSameSiteCookies();
 				// Debug mode gets access to the resources without strict cookie
 				// due to the fact that the SabreDAV browser also lives there.
-				if (!$config->getSystemValue('debug', false)) {
+				if (!$config->getSystemValueBool('debug', false)) {
 					http_response_code(\OCP\AppFramework\Http::STATUS_SERVICE_UNAVAILABLE);
 					exit();
 				}
@@ -672,7 +672,7 @@ class OC {
 				\OCP\Server::get(\Psr\Log\LoggerInterface::class),
 			);
 			$exceptionHandler = [$errorHandler, 'onException'];
-			if ($config->getSystemValue('debug', false)) {
+			if ($config->getSystemValueBool('debug', false)) {
 				set_error_handler([$errorHandler, 'onAll'], E_ALL);
 				if (\OC::$CLI) {
 					$exceptionHandler = ['OC_Template', 'printExceptionErrorPage'];
@@ -733,7 +733,7 @@ class OC {
 					echo('Writing to database failed');
 				}
 				exit(1);
-			} elseif (self::$CLI && $config->getSystemValue('installed', false)) {
+			} elseif (self::$CLI && $config->getSystemValueBool('installed', false)) {
 				$config->deleteAppValue('core', 'cronErrors');
 			}
 		}
@@ -803,7 +803,7 @@ class OC {
 		 */
 		if (!OC::$CLI
 			&& !Server::get(\OC\Security\TrustedDomainHelper::class)->isTrustedDomain($host)
-			&& $config->getSystemValue('installed', false)
+			&& $config->getSystemValueBool('installed', false)
 		) {
 			// Allow access to CSS resources
 			$isScssRequest = false;

+ 7 - 7
lib/private/App/AppStore/Fetcher/Fetcher.php

@@ -62,10 +62,10 @@ abstract class Fetcher {
 	protected $fileName;
 	/** @var string */
 	protected $endpointName;
-	/** @var string */
-	protected $version;
-	/** @var string */
-	protected $channel;
+	/** @var ?string */
+	protected $version = null;
+	/** @var ?string */
+	protected $channel = null;
 
 	public function __construct(Factory $appDataFactory,
 								IClientService $clientService,
@@ -149,7 +149,7 @@ abstract class Fetcher {
 	 */
 	public function get($allowUnstable = false) {
 		$appstoreenabled = $this->config->getSystemValueBool('appstoreenabled', true);
-		$internetavailable = $this->config->getSystemValue('has_internet_connection', true);
+		$internetavailable = $this->config->getSystemValueBool('has_internet_connection', true);
 
 		if (!$appstoreenabled || !$internetavailable) {
 			return [];
@@ -218,7 +218,7 @@ abstract class Fetcher {
 	 */
 	protected function getVersion() {
 		if ($this->version === null) {
-			$this->version = $this->config->getSystemValue('version', '0.0.0');
+			$this->version = $this->config->getSystemValueString('version', '0.0.0');
 		}
 		return $this->version;
 	}
@@ -251,6 +251,6 @@ abstract class Fetcher {
 	}
 
 	protected function getEndpoint(): string {
-		return $this->config->getSystemValue('appstoreurl', 'https://apps.nextcloud.com/api/v1') . '/' . $this->endpointName;
+		return $this->config->getSystemValueString('appstoreurl', 'https://apps.nextcloud.com/api/v1') . '/' . $this->endpointName;
 	}
 }

+ 1 - 1
lib/private/App/Platform.php

@@ -56,7 +56,7 @@ class Platform {
 	}
 
 	public function getDatabase(): string {
-		$dbType = $this->config->getSystemValue('dbtype', 'sqlite');
+		$dbType = $this->config->getSystemValueString('dbtype', 'sqlite');
 		if ($dbType === 'sqlite3') {
 			$dbType = 'sqlite';
 		}

+ 7 - 7
lib/private/AppFramework/Http/Request.php

@@ -624,7 +624,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
 	 * @return bool
 	 */
 	private function isOverwriteCondition(string $type = ''): bool {
-		$regex = '/' . $this->config->getSystemValue('overwritecondaddr', '')  . '/';
+		$regex = '/' . $this->config->getSystemValueString('overwritecondaddr', '')  . '/';
 		$remoteAddr = isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : '';
 		return $regex === '//' || preg_match($regex, $remoteAddr) === 1
 		|| $type !== 'protocol';
@@ -636,9 +636,9 @@ class Request implements \ArrayAccess, \Countable, IRequest {
 	 * @return string Server protocol (http or https)
 	 */
 	public function getServerProtocol(): string {
-		if ($this->config->getSystemValue('overwriteprotocol') !== ''
+		if ($this->config->getSystemValueString('overwriteprotocol') !== ''
 			&& $this->isOverwriteCondition('protocol')) {
-			return $this->config->getSystemValue('overwriteprotocol');
+			return $this->config->getSystemValueString('overwriteprotocol');
 		}
 
 		if ($this->fromTrustedProxy() && isset($this->server['HTTP_X_FORWARDED_PROTO'])) {
@@ -696,7 +696,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
 	 */
 	public function getRequestUri(): string {
 		$uri = isset($this->server['REQUEST_URI']) ? $this->server['REQUEST_URI'] : '';
-		if ($this->config->getSystemValue('overwritewebroot') !== '' && $this->isOverwriteCondition()) {
+		if ($this->config->getSystemValueString('overwritewebroot') !== '' && $this->isOverwriteCondition()) {
 			$uri = $this->getScriptName() . substr($uri, \strlen($this->server['SCRIPT_NAME']));
 		}
 		return $uri;
@@ -764,7 +764,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
 	 */
 	public function getScriptName(): string {
 		$name = $this->server['SCRIPT_NAME'];
-		$overwriteWebRoot = $this->config->getSystemValue('overwritewebroot');
+		$overwriteWebRoot = $this->config->getSystemValueString('overwritewebroot');
 		if ($overwriteWebRoot !== '' && $this->isOverwriteCondition()) {
 			// FIXME: This code is untestable due to __DIR__, also that hardcoded path is really dangerous
 			$serverRoot = str_replace('\\', '/', substr(__DIR__, 0, -\strlen('lib/private/appframework/http/')));
@@ -859,8 +859,8 @@ class Request implements \ArrayAccess, \Countable, IRequest {
 	 * isn't met
 	 */
 	private function getOverwriteHost() {
-		if ($this->config->getSystemValue('overwritehost') !== '' && $this->isOverwriteCondition()) {
-			return $this->config->getSystemValue('overwritehost');
+		if ($this->config->getSystemValueString('overwritehost') !== '' && $this->isOverwriteCondition()) {
+			return $this->config->getSystemValueString('overwritehost');
 		}
 		return null;
 	}

+ 1 - 1
lib/private/Authentication/Login/FinishRememberedLoginCommand.php

@@ -41,7 +41,7 @@ class FinishRememberedLoginCommand extends ALoginCommand {
 	}
 
 	public function process(LoginData $loginData): LoginResult {
-		if ($loginData->isRememberLogin() && $this->config->getSystemValue('auto_logout', false) === false) {
+		if ($loginData->isRememberLogin() && !$this->config->getSystemValueBool('auto_logout', false)) {
 			$this->userSession->createRememberMeToken($loginData->getUser());
 		}
 

+ 5 - 5
lib/private/Authentication/Token/PublicKeyTokenProvider.php

@@ -265,10 +265,10 @@ class PublicKeyTokenProvider implements IProvider {
 	public function invalidateOldTokens() {
 		$this->cache->clear();
 
-		$olderThan = $this->time->getTime() - (int) $this->config->getSystemValue('session_lifetime', 60 * 60 * 24);
+		$olderThan = $this->time->getTime() - $this->config->getSystemValueInt('session_lifetime', 60 * 60 * 24);
 		$this->logger->debug('Invalidating session tokens older than ' . date('c', $olderThan), ['app' => 'cron']);
 		$this->mapper->invalidateOld($olderThan, IToken::DO_NOT_REMEMBER);
-		$rememberThreshold = $this->time->getTime() - (int) $this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15);
+		$rememberThreshold = $this->time->getTime() - $this->config->getSystemValueInt('remember_login_cookie_lifetime', 60 * 60 * 24 * 15);
 		$this->logger->debug('Invalidating remembered session tokens older than ' . date('c', $rememberThreshold), ['app' => 'cron']);
 		$this->mapper->invalidateOld($rememberThreshold, IToken::REMEMBER);
 	}
@@ -364,7 +364,7 @@ class PublicKeyTokenProvider implements IProvider {
 	}
 
 	private function encrypt(string $plaintext, string $token): string {
-		$secret = $this->config->getSystemValue('secret');
+		$secret = $this->config->getSystemValueString('secret');
 		return $this->crypto->encrypt($plaintext, $token . $secret);
 	}
 
@@ -372,7 +372,7 @@ class PublicKeyTokenProvider implements IProvider {
 	 * @throws InvalidTokenException
 	 */
 	private function decrypt(string $cipherText, string $token): string {
-		$secret = $this->config->getSystemValue('secret');
+		$secret = $this->config->getSystemValueString('secret');
 		try {
 			return $this->crypto->decrypt($cipherText, $token . $secret);
 		} catch (\Exception $ex) {
@@ -402,7 +402,7 @@ class PublicKeyTokenProvider implements IProvider {
 	}
 
 	private function hashToken(string $token): string {
-		$secret = $this->config->getSystemValue('secret');
+		$secret = $this->config->getSystemValueString('secret');
 		return hash('sha512', $token . $secret);
 	}
 

+ 2 - 2
lib/private/Collaboration/Collaborators/LookupPlugin.php

@@ -63,7 +63,7 @@ class LookupPlugin implements ISearchPlugin {
 	}
 
 	public function search($search, $limit, $offset, ISearchResult $searchResult) {
-		$isGlobalScaleEnabled = $this->config->getSystemValue('gs.enabled', false);
+		$isGlobalScaleEnabled = $this->config->getSystemValueBool('gs.enabled', false);
 		$isLookupServerEnabled = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'yes') === 'yes';
 		$hasInternetConnection = $this->config->getSystemValueBool('has_internet_connection', true);
 
@@ -72,7 +72,7 @@ class LookupPlugin implements ISearchPlugin {
 			return false;
 		}
 
-		$lookupServerUrl = $this->config->getSystemValue('lookup_server', 'https://lookup.nextcloud.com');
+		$lookupServerUrl = $this->config->getSystemValueString('lookup_server', 'https://lookup.nextcloud.com');
 		if (empty($lookupServerUrl)) {
 			return false;
 		}

+ 1 - 1
lib/private/Console/Application.php

@@ -112,7 +112,7 @@ class Application {
 
 		try {
 			require_once __DIR__ . '/../../../core/register_command.php';
-			if ($this->config->getSystemValue('installed', false)) {
+			if ($this->config->getSystemValueBool('installed', false)) {
 				if (\OCP\Util::needUpgrade()) {
 					throw new NeedsUpdateException();
 				} elseif ($this->config->getSystemValueBool('maintenance')) {

+ 1 - 1
lib/private/DB/Migrator.php

@@ -178,7 +178,7 @@ class Migrator {
 	}
 
 	protected function getFilterExpression() {
-		return '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/';
+		return '/^' . preg_quote($this->config->getSystemValueString('dbtableprefix', 'oc_')) . '/';
 	}
 
 	protected function emit(string $sql, int $step, int $max): void {

+ 1 - 1
lib/private/DB/OracleMigrator.php

@@ -216,6 +216,6 @@ class OracleMigrator extends Migrator {
 	}
 
 	protected function getFilterExpression() {
-		return '/^"' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/';
+		return '/^"' . preg_quote($this->config->getSystemValueString('dbtableprefix', 'oc_')) . '/';
 	}
 }

+ 1 - 1
lib/private/DB/PgSqlTools.php

@@ -53,7 +53,7 @@ class PgSqlTools {
 		$databaseName = $conn->getDatabase();
 		$conn->getConfiguration()->setSchemaAssetsFilter(function ($asset) {
 			/** @var string|AbstractAsset $asset */
-			$filterExpression = '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/';
+			$filterExpression = '/^' . preg_quote($this->config->getSystemValueString('dbtableprefix', 'oc_')) . '/';
 			if ($asset instanceof AbstractAsset) {
 				return preg_match($filterExpression, $asset->getName()) !== false;
 			}

+ 3 - 3
lib/private/Encryption/Keys/Storage.php

@@ -237,7 +237,7 @@ class Storage implements IStorage {
 
 		if (!array_key_exists('uid', $data) || $data['uid'] !== $uid) {
 			// If the migration is done we error out
-			$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
+			$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0.0');
 			if (version_compare($versionFromBeforeUpdate, '20.0.0.1', '<=')) {
 				return $data['key'];
 			}
@@ -272,7 +272,7 @@ class Storage implements IStorage {
 				$data = $this->view->file_get_contents($path);
 
 				// Version <20.0.0.1 doesn't have this
-				$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
+				$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0.0');
 				if (version_compare($versionFromBeforeUpdate, '20.0.0.1', '<=')) {
 					$key = [
 						'key' => base64_encode($data),
@@ -335,7 +335,7 @@ class Storage implements IStorage {
 	private function setKey($path, $key) {
 		$this->keySetPreparation(dirname($path));
 
-		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
+		$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0.0');
 		if (version_compare($versionFromBeforeUpdate, '20.0.0.1', '<=')) {
 			// Only store old format if this happens during the migration.
 			// TODO: Remove for 21

+ 1 - 1
lib/private/Encryption/Manager.php

@@ -73,7 +73,7 @@ class Manager implements IManager {
 	 * @return bool true if enabled, false if not
 	 */
 	public function isEnabled() {
-		$installed = $this->config->getSystemValue('installed', false);
+		$installed = $this->config->getSystemValueBool('installed', false);
 		if (!$installed) {
 			return false;
 		}

+ 2 - 2
lib/private/Encryption/Util.php

@@ -70,7 +70,7 @@ class Util {
 	protected $config;
 
 	/** @var array paths excluded from encryption */
-	protected $excludedPaths;
+	protected array $excludedPaths = [];
 	protected IGroupManager $groupManager;
 	protected IUserManager $userManager;
 
@@ -94,7 +94,7 @@ class Util {
 		$this->config = $config;
 
 		$this->excludedPaths[] = 'files_encryption';
-		$this->excludedPaths[] = 'appdata_' . $config->getSystemValue('instanceid', null);
+		$this->excludedPaths[] = 'appdata_' . $config->getSystemValueString('instanceid');
 		$this->excludedPaths[] = 'files_external';
 	}
 

+ 2 - 2
lib/private/Files/Cache/Scanner.php

@@ -91,7 +91,7 @@ class Scanner extends BasicEmitter implements IScanner {
 		$this->storage = $storage;
 		$this->storageId = $this->storage->getId();
 		$this->cache = $storage->getCache();
-		$this->cacheActive = !\OC::$server->getConfig()->getSystemValue('filesystem_cache_readonly', false);
+		$this->cacheActive = !\OC::$server->getConfig()->getSystemValueBool('filesystem_cache_readonly', false);
 		$this->lockingProvider = \OC::$server->getLockingProvider();
 	}
 
@@ -219,7 +219,7 @@ class Scanner extends BasicEmitter implements IScanner {
 						$newData['parent'] = $parentId;
 						$data['fileid'] = $this->addToCache($file, $newData, $fileId);
 					}
-					
+
 					$data['oldSize'] = ($cacheData && isset($cacheData['size'])) ? $cacheData['size'] : 0;
 
 					if ($cacheData && isset($cacheData['encrypted'])) {

+ 1 - 1
lib/private/Files/Mount/CacheMountProvider.php

@@ -52,7 +52,7 @@ class CacheMountProvider implements IMountProvider {
 	 * @return \OCP\Files\Mount\IMountPoint[]
 	 */
 	public function getMountsForUser(IUser $user, IStorageFactory $loader) {
-		$cacheBaseDir = $this->config->getSystemValue('cache_path', '');
+		$cacheBaseDir = $this->config->getSystemValueString('cache_path', '');
 		if ($cacheBaseDir !== '') {
 			$cacheDir = rtrim($cacheBaseDir, '/') . '/' . $user->getUID();
 			if (!file_exists($cacheDir)) {

+ 1 - 1
lib/private/Files/Storage/Common.php

@@ -834,7 +834,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
 
 	private function getLockLogger(): ?LoggerInterface {
 		if (is_null($this->shouldLogLocks)) {
-			$this->shouldLogLocks = \OC::$server->getConfig()->getSystemValue('filelocking.debug', false);
+			$this->shouldLogLocks = \OC::$server->getConfig()->getSystemValueBool('filelocking.debug', false);
 			$this->logger = $this->shouldLogLocks ? \OC::$server->get(LoggerInterface::class) : null;
 		}
 		return $this->logger;

+ 1 - 1
lib/private/Files/Storage/DAV.php

@@ -145,7 +145,7 @@ class DAV extends Common {
 			$settings['authType'] = $this->authType;
 		}
 
-		$proxy = \OC::$server->getConfig()->getSystemValue('proxy', '');
+		$proxy = \OC::$server->getConfig()->getSystemValueString('proxy', '');
 		if ($proxy !== '') {
 			$settings['proxy'] = $proxy;
 		}

+ 2 - 2
lib/private/Files/Storage/Local.php

@@ -93,7 +93,7 @@ class Local extends \OC\Files\Storage\Common {
 		$this->defUMask = $this->config->getSystemValue('localstorage.umask', 0022);
 
 		// support Write-Once-Read-Many file systems
-		$this->unlinkOnTruncate = $this->config->getSystemValue('localstorage.unlink_on_truncate', false);
+		$this->unlinkOnTruncate = $this->config->getSystemValueBool('localstorage.unlink_on_truncate', false);
 	}
 
 	public function __destruct() {
@@ -486,7 +486,7 @@ class Local extends \OC\Files\Storage\Common {
 
 		$fullPath = $this->datadir . $path;
 		$currentPath = $path;
-		$allowSymlinks = $this->config->getSystemValue('localstorage.allowsymlinks', false);
+		$allowSymlinks = $this->config->getSystemValueBool('localstorage.allowsymlinks', false);
 		if ($allowSymlinks || $currentPath === '') {
 			return $fullPath;
 		}

+ 2 - 2
lib/private/Files/Template/TemplateManager.php

@@ -268,8 +268,8 @@ class TemplateManager implements ITemplateManager {
 
 		$defaultSkeletonDirectory = \OC::$SERVERROOT . '/core/skeleton';
 		$defaultTemplateDirectory = \OC::$SERVERROOT . '/core/skeleton/Templates';
-		$skeletonPath = $this->config->getSystemValue('skeletondirectory', $defaultSkeletonDirectory);
-		$skeletonTemplatePath = $this->config->getSystemValue('templatedirectory', $defaultTemplateDirectory);
+		$skeletonPath = $this->config->getSystemValueString('skeletondirectory', $defaultSkeletonDirectory);
+		$skeletonTemplatePath = $this->config->getSystemValueString('templatedirectory', $defaultTemplateDirectory);
 		$isDefaultSkeleton = $skeletonPath === $defaultSkeletonDirectory;
 		$isDefaultTemplates = $skeletonTemplatePath === $defaultTemplateDirectory;
 		$userLang = $this->l10nFactory->getUserLanguage($this->userManager->get($this->userId));

+ 2 - 3
lib/private/GlobalScale/Config.php

@@ -44,8 +44,7 @@ class Config implements \OCP\GlobalScale\IConfig {
 	 * @return bool
 	 */
 	public function isGlobalScaleEnabled() {
-		$enabled = $this->config->getSystemValue('gs.enabled', false);
-		return $enabled !== false;
+		return $this->config->getSystemValueBool('gs.enabled', false);
 	}
 
 	/**
@@ -61,7 +60,7 @@ class Config implements \OCP\GlobalScale\IConfig {
 			return false;
 		}
 
-		$enabled = $this->config->getSystemValue('gs.federation', 'internal');
+		$enabled = $this->config->getSystemValueString('gs.federation', 'internal');
 
 		return $enabled === 'internal';
 	}

+ 5 - 5
lib/private/Http/Client/Client.php

@@ -122,7 +122,7 @@ class Client implements IClient {
 		// If the instance is not yet setup we need to use the static path as
 		// $this->certificateManager->getAbsoluteBundlePath() tries to instantiate
 		// a view
-		if ($this->config->getSystemValue('installed', false) === false) {
+		if (!$this->config->getSystemValueBool('installed', false)) {
 			return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
 		}
 
@@ -145,14 +145,14 @@ class Client implements IClient {
 	 *
 	 */
 	private function getProxyUri(): ?array {
-		$proxyHost = $this->config->getSystemValue('proxy', '');
+		$proxyHost = $this->config->getSystemValueString('proxy', '');
 
-		if ($proxyHost === '' || $proxyHost === null) {
+		if ($proxyHost === '') {
 			return null;
 		}
 
-		$proxyUserPwd = $this->config->getSystemValue('proxyuserpwd', '');
-		if ($proxyUserPwd !== '' && $proxyUserPwd !== null) {
+		$proxyUserPwd = $this->config->getSystemValueString('proxyuserpwd', '');
+		if ($proxyUserPwd !== '') {
 			$proxyHost = $proxyUserPwd . '@' . $proxyHost;
 		}
 

+ 2 - 2
lib/private/IntegrityCheck/Checker.php

@@ -116,9 +116,9 @@ class Checker {
 		 */
 		$isIntegrityCheckDisabled = false;
 		if ($this->config !== null) {
-			$isIntegrityCheckDisabled = $this->config->getSystemValue('integrity.check.disabled', false);
+			$isIntegrityCheckDisabled = $this->config->getSystemValueBool('integrity.check.disabled', false);
 		}
-		if ($isIntegrityCheckDisabled === true) {
+		if ($isIntegrityCheckDisabled) {
 			return false;
 		}
 

+ 1 - 1
lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php

@@ -51,7 +51,7 @@ class ExcludeFoldersByPathFilterIterator extends \RecursiveFilterIterator {
 			rtrim($root . '/updater', '/'),
 			rtrim($root . '/_oc_upgrade', '/'),
 		];
-		$customDataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', '');
+		$customDataDir = \OC::$server->getConfig()->getSystemValueString('datadirectory', '');
 		if ($customDataDir !== '') {
 			$excludedFolders[] = rtrim($customDataDir, '/');
 		}

+ 6 - 6
lib/private/L10N/Factory.php

@@ -195,7 +195,7 @@ class Factory implements IFactory {
 		 *
 		 * @link https://github.com/owncloud/core/issues/21955
 		 */
-		if ($this->config->getSystemValue('installed', false)) {
+		if ($this->config->getSystemValueBool('installed', false)) {
 			$userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() :  null;
 			if (!is_null($userId)) {
 				$userLang = $this->config->getUserValue($userId, 'core', 'lang', null);
@@ -247,7 +247,7 @@ class Factory implements IFactory {
 		}
 
 		// Step 3.1: Check if Nextcloud is already installed before we try to access user info
-		if (!$this->config->getSystemValue('installed', false)) {
+		if (!$this->config->getSystemValueBool('installed', false)) {
 			return 'en';
 		}
 		// Step 3.2: Check the current user (if any) for their preferred language
@@ -282,7 +282,7 @@ class Factory implements IFactory {
 			return $forceLocale;
 		}
 
-		if ($this->config->getSystemValue('installed', false)) {
+		if ($this->config->getSystemValueBool('installed', false)) {
 			$userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() :  null;
 			$userLocale = null;
 			if (null !== $userId) {
@@ -366,7 +366,7 @@ class Factory implements IFactory {
 		}
 
 		// merge with translations from theme
-		$theme = $this->config->getSystemValue('theme');
+		$theme = $this->config->getSystemValueString('theme');
 		if (!empty($theme)) {
 			$themeDir = $this->serverRoot . '/themes/' . $theme . substr($dir, strlen($this->serverRoot));
 
@@ -452,7 +452,7 @@ class Factory implements IFactory {
 			}
 		}
 
-		return $this->config->getSystemValue('default_language', 'en');
+		return $this->config->getSystemValueString('default_language', 'en');
 	}
 
 	/**
@@ -576,7 +576,7 @@ class Factory implements IFactory {
 		}
 
 		// merge with translations from theme
-		$theme = $this->config->getSystemValue('theme');
+		$theme = $this->config->getSystemValueString('theme');
 		if (!empty($theme)) {
 			$transFile = $this->serverRoot . '/themes/' . $theme . substr($transFile, strlen($this->serverRoot));
 			if (file_exists($transFile)) {

+ 1 - 1
lib/private/L10N/LanguageIterator.php

@@ -93,7 +93,7 @@ class LanguageIterator implements ILanguageIterator {
 				$this->next();
 				// no break
 			case 4:
-				return $this->config->getSystemValue('default_language', 'en');
+				return $this->config->getSystemValueString('default_language', 'en');
 				/** @noinspection PhpMissingBreakStatementInspection */
 			case 5:
 				$defaultLang = $this->config->getSystemValue('default_language', 'en');

+ 1 - 1
lib/private/Log/Rotate.php

@@ -39,7 +39,7 @@ class Rotate extends \OCP\BackgroundJob\Job {
 		$systemConfig = \OC::$server->getSystemConfig();
 		$this->filePath = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log');
 
-		$this->maxSize = \OC::$server->getConfig()->getSystemValue('log_rotate_size', 100 * 1024 * 1024);
+		$this->maxSize = \OC::$server->getConfig()->getSystemValueInt('log_rotate_size', 100 * 1024 * 1024);
 		if ($this->shouldRotateBySize()) {
 			$rotatedFile = $this->rotate();
 			$msg = 'Log file "'.$this->filePath.'" was over '.$this->maxSize.' bytes, moved to "'.$rotatedFile.'"';

+ 10 - 11
lib/private/Mail/Mailer.php

@@ -57,7 +57,6 @@ use Symfony\Component\Mailer\Transport\SendmailTransport;
 use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
 use Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream;
 use Symfony\Component\Mime\Email;
-use Symfony\Component\Mime\Exception\InvalidArgumentException;
 use Symfony\Component\Mime\Exception\RfcComplianceException;
 
 /**
@@ -110,7 +109,7 @@ class Mailer implements IMailer {
 	 * @return Message
 	 */
 	public function createMessage(): Message {
-		$plainTextOnly = $this->config->getSystemValue('mail_send_plaintext_only', false);
+		$plainTextOnly = $this->config->getSystemValueBool('mail_send_plaintext_only', false);
 		return new Message(new Email(), $plainTextOnly);
 	}
 
@@ -144,7 +143,7 @@ class Mailer implements IMailer {
 	 * @since 12.0.0
 	 */
 	public function createEMailTemplate(string $emailId, array $data = []): IEMailTemplate {
-		$class = $this->config->getSystemValue('mail_template_class', '');
+		$class = $this->config->getSystemValueString('mail_template_class', '');
 
 		if ($class !== '' && class_exists($class) && is_a($class, EMailTemplate::class, true)) {
 			return new $class(
@@ -176,10 +175,10 @@ class Mailer implements IMailer {
 	 * @return string[] $failedRecipients
 	 */
 	public function send(IMessage $message): array {
-		$debugMode = $this->config->getSystemValue('mail_smtpdebug', false);
+		$debugMode = $this->config->getSystemValueBool('mail_smtpdebug', false);
 
 		if (!($message instanceof Message)) {
-			throw new InvalidArgumentException('Object not of type ' . Message::class);
+			throw new \InvalidArgumentException('Object not of type ' . Message::class);
 		}
 
 		if (empty($message->getFrom())) {
@@ -192,7 +191,7 @@ class Mailer implements IMailer {
 
 		try {
 			$message->setRecipients();
-		} catch (InvalidArgumentException|RfcComplianceException $e) {
+		} catch (\InvalidArgumentException|RfcComplianceException $e) {
 			$logMessage = sprintf(
 				'Could not send mail to "%s" with subject "%s" as validation for address failed',
 				print_r(array_merge($message->getTo(), $message->getCc(), $message->getBcc()), true),
@@ -267,7 +266,7 @@ class Mailer implements IMailer {
 
 		$transport = null;
 
-		switch ($this->config->getSystemValue('mail_smtpmode', 'smtp')) {
+		switch ($this->config->getSystemValueString('mail_smtpmode', 'smtp')) {
 			case 'sendmail':
 				$transport = $this->getSendMailInstance();
 				break;
@@ -294,7 +293,7 @@ class Mailer implements IMailer {
 		$mailSmtpsecure = ($this->config->getSystemValue('mail_smtpsecure', null) === 'ssl') ? true : null;
 		$transport = new EsmtpTransport(
 			$this->config->getSystemValue('mail_smtphost', '127.0.0.1'),
-			(int)$this->config->getSystemValue('mail_smtpport', 25),
+			$this->config->getSystemValueInt('mail_smtpport', 25),
 			$mailSmtpsecure,
 			null,
 			$this->logger
@@ -304,7 +303,7 @@ class Mailer implements IMailer {
 		/** @psalm-suppress InternalMethod */
 		$stream->setTimeout($this->config->getSystemValue('mail_smtptimeout', 10));
 
-		if ($this->config->getSystemValue('mail_smtpauth', false)) {
+		if ($this->config->getSystemValueBool('mail_smtpauth', false)) {
 			$transport->setUsername($this->config->getSystemValue('mail_smtpname', ''));
 			$transport->setPassword($this->config->getSystemValue('mail_smtppassword', ''));
 		}
@@ -338,7 +337,7 @@ class Mailer implements IMailer {
 	 * @return SendmailTransport
 	 */
 	protected function getSendMailInstance(): SendmailTransport {
-		switch ($this->config->getSystemValue('mail_smtpmode', 'smtp')) {
+		switch ($this->config->getSystemValueString('mail_smtpmode', 'smtp')) {
 			case 'qmail':
 				$binaryPath = '/var/qmail/bin/sendmail';
 				break;
@@ -351,7 +350,7 @@ class Mailer implements IMailer {
 				break;
 		}
 
-		switch ($this->config->getSystemValue('mail_sendmailmode', 'smtp')) {
+		switch ($this->config->getSystemValueString('mail_sendmailmode', 'smtp')) {
 			case 'pipe':
 				$binaryParam = ' -t';
 				break;

+ 1 - 1
lib/private/NavigationManager.php

@@ -189,7 +189,7 @@ class NavigationManager implements INavigationManager {
 		$this->init = true;
 
 		$l = $this->l10nFac->get('lib');
-		if ($this->config->getSystemValue('knowledgebaseenabled', true)) {
+		if ($this->config->getSystemValueBool('knowledgebaseenabled', true)) {
 			$this->add([
 				'type' => 'settings',
 				'id' => 'help',

+ 2 - 2
lib/private/Preview/Imaginary.php

@@ -61,7 +61,7 @@ class Imaginary extends ProviderV2 {
 	}
 
 	public function getCroppedThumbnail(File $file, int $maxX, int $maxY, bool $crop): ?IImage {
-		$maxSizeForImages = $this->config->getSystemValue('preview_max_filesize_image', 50);
+		$maxSizeForImages = $this->config->getSystemValueInt('preview_max_filesize_image', 50);
 
 		$size = $file->getSize();
 
@@ -105,7 +105,7 @@ class Imaginary extends ProviderV2 {
 			default:
 				$mimeType = 'jpeg';
 		}
-		
+
 		$operations = [];
 
 		if ($convert) {

+ 1 - 1
lib/private/PreviewManager.php

@@ -113,7 +113,7 @@ class PreviewManager implements IPreview {
 	 * @return void
 	 */
 	public function registerProvider($mimeTypeRegex, \Closure $callable): void {
-		if (!$this->config->getSystemValue('enable_previews', true)) {
+		if (!$this->config->getSystemValueBool('enable_previews', true)) {
 			return;
 		}
 

+ 1 - 1
lib/private/Repair/ClearGeneratedAvatarCache.php

@@ -49,7 +49,7 @@ class ClearGeneratedAvatarCache implements IRepairStep {
 	 * Check if this repair step should run
 	 */
 	private function shouldRun(): bool {
-		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
+		$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0.0');
 
 		// was added to 25.0.0.10
 		return version_compare($versionFromBeforeUpdate, '25.0.0.10', '<=');

+ 3 - 3
lib/private/Repair/Collation.php

@@ -74,7 +74,7 @@ class Collation implements IRepairStep {
 			return;
 		}
 
-		$characterSet = $this->config->getSystemValue('mysql.utf8mb4', false) ? 'utf8mb4' : 'utf8';
+		$characterSet = $this->config->getSystemValueBool('mysql.utf8mb4', false) ? 'utf8mb4' : 'utf8';
 
 		$tables = $this->getAllNonUTF8BinTables($this->connection);
 		foreach ($tables as $table) {
@@ -112,8 +112,8 @@ class Collation implements IRepairStep {
 	 * @return string[]
 	 */
 	protected function getAllNonUTF8BinTables(IDBConnection $connection) {
-		$dbName = $this->config->getSystemValue("dbname");
-		$characterSet = $this->config->getSystemValue('mysql.utf8mb4', false) ? 'utf8mb4' : 'utf8';
+		$dbName = $this->config->getSystemValueString("dbname");
+		$characterSet = $this->config->getSystemValueBool('mysql.utf8mb4', false) ? 'utf8mb4' : 'utf8';
 
 		// fetch tables by columns
 		$statement = $connection->executeQuery(

+ 2 - 2
lib/private/Repair/MoveUpdaterStepFile.php

@@ -43,9 +43,9 @@ class MoveUpdaterStepFile implements IRepairStep {
 
 	public function run(IOutput $output) {
 		$updateDir = $this->config->getSystemValue('updatedirectory', null) ?? $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data');
-		$instanceId = $this->config->getSystemValue('instanceid', null);
+		$instanceId = $this->config->getSystemValueString('instanceid');
 
-		if (!is_string($instanceId) || empty($instanceId)) {
+		if (empty($instanceId)) {
 			return;
 		}
 

+ 1 - 1
lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php

@@ -96,7 +96,7 @@ class CleanupCardDAVPhotoCache implements IRepairStep {
 
 	private function shouldRun(): bool {
 		return version_compare(
-			$this->config->getSystemValue('version', '0.0.0.0'),
+			$this->config->getSystemValueString('version', '0.0.0.0'),
 			'16.0.0.0',
 			'<='
 		);

+ 1 - 1
lib/private/Repair/NC16/ClearCollectionsAccessCache.php

@@ -48,7 +48,7 @@ class ClearCollectionsAccessCache implements IRepairStep {
 	}
 
 	private function shouldRun(): bool {
-		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
+		$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0.0');
 		return version_compare($versionFromBeforeUpdate, '17.0.0.3', '<=');
 	}
 

+ 1 - 1
lib/private/Repair/NC18/ResetGeneratedAvatarFlag.php

@@ -47,7 +47,7 @@ class ResetGeneratedAvatarFlag implements IRepairStep {
 	}
 
 	private function shouldRun(): bool {
-		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
+		$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0.0');
 		return version_compare($versionFromBeforeUpdate, '18.0.0.5', '<=');
 	}
 

+ 1 - 1
lib/private/Repair/NC20/EncryptionLegacyCipher.php

@@ -48,7 +48,7 @@ class EncryptionLegacyCipher implements IRepairStep {
 	}
 
 	private function shouldRun(): bool {
-		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
+		$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0.0');
 		return version_compare($versionFromBeforeUpdate, '20.0.0.0', '<=');
 	}
 

+ 1 - 1
lib/private/Repair/NC20/EncryptionMigration.php

@@ -48,7 +48,7 @@ class EncryptionMigration implements IRepairStep {
 	}
 
 	private function shouldRun(): bool {
-		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
+		$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0.0');
 		return version_compare($versionFromBeforeUpdate, '20.0.0.1', '<=');
 	}
 

+ 1 - 1
lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php

@@ -44,7 +44,7 @@ class AddCheckForUserCertificatesJob implements IRepairStep {
 	}
 
 	private function shouldRun() {
-		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
+		$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0.0');
 
 		// was added to 21.0.0.2
 		return version_compare($versionFromBeforeUpdate, '21.0.0.2', '<');

+ 1 - 1
lib/private/Repair/NC22/LookupServerSendCheck.php

@@ -46,7 +46,7 @@ class LookupServerSendCheck implements IRepairStep {
 	}
 
 	private function shouldRun(): bool {
-		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
+		$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0.0');
 
 		// was added to 22.0.0.3
 		return (version_compare($versionFromBeforeUpdate, '22.0.0.3', '<') && version_compare($versionFromBeforeUpdate, '22.0.0.0', '>='))

+ 4 - 4
lib/private/Repair/NC25/AddMissingSecretJob.php

@@ -42,8 +42,8 @@ class AddMissingSecretJob implements IRepairStep {
 	}
 
 	public function run(IOutput $output): void {
-		$passwordSalt = $this->config->getSystemValue('passwordsalt', null);
-		if ($passwordSalt === null || $passwordSalt === '') {
+		$passwordSalt = $this->config->getSystemValueString('passwordsalt', '');
+		if ($passwordSalt === '') {
 			try {
 				$this->config->setSystemValue('passwordsalt', $this->random->generate(30));
 			} catch (HintException $e) {
@@ -51,8 +51,8 @@ class AddMissingSecretJob implements IRepairStep {
 			}
 		}
 
-		$secret = $this->config->getSystemValue('secret', null);
-		if ($secret === null || $secret === '') {
+		$secret = $this->config->getSystemValueString('secret', '');
+		if ($secret === '') {
 			try {
 				$this->config->setSystemValue('secret', $this->random->generate(48));
 			} catch (HintException $e) {

+ 1 - 1
lib/private/Repair/Owncloud/MoveAvatars.php

@@ -59,7 +59,7 @@ class MoveAvatars implements IRepairStep {
 			$output->info('Repair step already executed');
 			return;
 		}
-		if ($this->config->getSystemValue('enable_avatars', true) === false) {
+		if (!$this->config->getSystemValueBool('enable_avatars', true)) {
 			$output->info('Avatars are disabled');
 		} else {
 			$output->info('Add background job');

+ 2 - 2
lib/private/Repair/Owncloud/SaveAccountsTableData.php

@@ -79,7 +79,7 @@ class SaveAccountsTableData implements IRepairStep {
 		}
 
 		// oc_persistent_locks will be removed later on anyways so we can just drop and ignore any foreign key constraints here
-		$tableName = $this->config->getSystemValue('dbtableprefix', 'oc_') . 'persistent_locks';
+		$tableName = $this->config->getSystemValueString('dbtableprefix', 'oc_') . 'persistent_locks';
 		$schema = $this->db->createSchema();
 		$table = $schema->getTable($tableName);
 		foreach ($table->getForeignKeys() as $foreignKey) {
@@ -99,7 +99,7 @@ class SaveAccountsTableData implements IRepairStep {
 	 */
 	protected function shouldRun() {
 		$schema = $this->db->createSchema();
-		$prefix = $this->config->getSystemValue('dbtableprefix', 'oc_');
+		$prefix = $this->config->getSystemValueString('dbtableprefix', 'oc_');
 
 		$tableName = $prefix . 'accounts';
 		if (!$schema->hasTable($tableName)) {

+ 1 - 1
lib/private/Repair/Owncloud/UpdateLanguageCodes.php

@@ -56,7 +56,7 @@ class UpdateLanguageCodes implements IRepairStep {
 	 * {@inheritdoc}
 	 */
 	public function run(IOutput $output) {
-		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
+		$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0');
 
 		if (version_compare($versionFromBeforeUpdate, '12.0.0.13', '>')) {
 			return;

+ 1 - 1
lib/private/Repair/RemoveLinkShares.php

@@ -71,7 +71,7 @@ class RemoveLinkShares implements IRepairStep {
 	}
 
 	private function shouldRun(): bool {
-		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
+		$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0');
 
 		if (version_compare($versionFromBeforeUpdate, '14.0.11', '<')) {
 			return true;

+ 1 - 1
lib/private/Repair/RepairDavShares.php

@@ -125,7 +125,7 @@ class RepairDavShares implements IRepairStep {
 	 * @inheritDoc
 	 */
 	public function run(IOutput $output) {
-		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
+		$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0');
 		if (version_compare($versionFromBeforeUpdate, '20.0.8', '<')
 			&& $this->repairUnencodedGroupShares()
 		) {

+ 1 - 1
lib/private/Repair/RepairInvalidShares.php

@@ -110,7 +110,7 @@ class RepairInvalidShares implements IRepairStep {
 	}
 
 	public function run(IOutput $out) {
-		$ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
+		$ocVersionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0');
 		if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.11', '<')) {
 			$this->adjustFileSharePermissions($out);
 		}

+ 1 - 1
lib/private/Repair/RepairMimeTypes.php

@@ -234,7 +234,7 @@ class RepairMimeTypes implements IRepairStep {
 	 * Fix mime types
 	 */
 	public function run(IOutput $out) {
-		$ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
+		$ocVersionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0');
 
 		// NOTE TO DEVELOPERS: when adding new mime types, please make sure to
 		// add a version comparison to avoid doing it every time

+ 1 - 1
lib/private/Security/Bruteforce/Capabilities.php

@@ -51,7 +51,7 @@ class Capabilities implements IPublicCapability, IInitialStateExcludedCapability
 	}
 
 	public function getCapabilities(): array {
-		if (version_compare(\OC::$server->getConfig()->getSystemValue('version', '0.0.0.0'), '12.0.0.0', '<')) {
+		if (version_compare(\OC::$server->getConfig()->getSystemValueString('version', '0.0.0.0'), '12.0.0.0', '<')) {
 			return [];
 		}
 

+ 2 - 2
lib/private/Security/Bruteforce/Throttler.php

@@ -112,7 +112,7 @@ class Throttler implements IThrottler {
 									string $ip,
 									array $metadata = []): void {
 		// No need to log if the bruteforce protection is disabled
-		if ($this->config->getSystemValue('auth.bruteforce.protection.enabled', true) === false) {
+		if (!$this->config->getSystemValueBool('auth.bruteforce.protection.enabled', true)) {
 			return;
 		}
 
@@ -151,7 +151,7 @@ class Throttler implements IThrottler {
 	 * @return bool
 	 */
 	private function isIPWhitelisted(string $ip): bool {
-		if ($this->config->getSystemValue('auth.bruteforce.protection.enabled', true) === false) {
+		if (!$this->config->getSystemValueBool('auth.bruteforce.protection.enabled', true)) {
 			return true;
 		}
 

+ 2 - 2
lib/private/Security/CertificateManager.php

@@ -67,7 +67,7 @@ class CertificateManager implements ICertificateManager {
 	 * @return \OCP\ICertificate[]
 	 */
 	public function listCertificates(): array {
-		if (!$this->config->getSystemValue('installed', false)) {
+		if (!$this->config->getSystemValueBool('installed', false)) {
 			return [];
 		}
 
@@ -93,7 +93,7 @@ class CertificateManager implements ICertificateManager {
 	}
 
 	private function hasCertificates(): bool {
-		if (!$this->config->getSystemValue('installed', false)) {
+		if (!$this->config->getSystemValueBool('installed', false)) {
 			return false;
 		}
 

+ 2 - 2
lib/private/Security/Crypto.php

@@ -70,7 +70,7 @@ class Crypto implements ICrypto {
 	 */
 	public function calculateHMAC(string $message, string $password = ''): string {
 		if ($password === '') {
-			$password = $this->config->getSystemValue('secret');
+			$password = $this->config->getSystemValueString('secret');
 		}
 
 		// Append an "a" behind the password and hash it to prevent reusing the same password as for encryption
@@ -92,7 +92,7 @@ class Crypto implements ICrypto {
 	 */
 	public function encrypt(string $plaintext, string $password = ''): string {
 		if ($password === '') {
-			$password = $this->config->getSystemValue('secret');
+			$password = $this->config->getSystemValueString('secret');
 		}
 		$keyMaterial = hash_hkdf('sha512', $password);
 		$this->cipher->setPassword(substr($keyMaterial, 0, 32));

+ 1 - 1
lib/private/Security/Hasher.php

@@ -209,7 +209,7 @@ class Hasher implements IHasher {
 		}
 
 		// Check if we should use PASSWORD_DEFAULT
-		if ($this->config->getSystemValue('hashing_default_password', false) === true) {
+		if ($this->config->getSystemValueBool('hashing_default_password', false)) {
 			$default = PASSWORD_DEFAULT;
 		}
 

+ 2 - 2
lib/private/Security/VerificationToken/VerificationToken.php

@@ -82,7 +82,7 @@ class VerificationToken implements IVerificationToken {
 		}
 
 		try {
-			$decryptedToken = $this->crypto->decrypt($encryptedToken, $passwordPrefix.$this->config->getSystemValue('secret'));
+			$decryptedToken = $this->crypto->decrypt($encryptedToken, $passwordPrefix.$this->config->getSystemValueString('secret'));
 		} catch (\Exception $e) {
 			// Retry with empty secret as a fallback for instances where the secret might not have been set by accident
 			try {
@@ -115,7 +115,7 @@ class VerificationToken implements IVerificationToken {
 			ISecureRandom::CHAR_UPPER
 		);
 		$tokenValue = $this->timeFactory->getTime() .':'. $token;
-		$encryptedValue = $this->crypto->encrypt($tokenValue, $passwordPrefix . $this->config->getSystemValue('secret'));
+		$encryptedValue = $this->crypto->encrypt($tokenValue, $passwordPrefix . $this->config->getSystemValueString('secret'));
 		$this->config->setUserValue($user->getUID(), 'core', $subject, $encryptedValue);
 		$jobArgs = json_encode([
 			'userId' => $user->getUID(),

+ 5 - 5
lib/private/Server.php

@@ -726,7 +726,7 @@ class Server extends ServerContainer implements IServerContainer {
 			/** @var \OCP\IConfig $config */
 			$config = $c->get(\OCP\IConfig::class);
 
-			if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
+			if ($config->getSystemValueBool('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
 				if (!$config->getSystemValueBool('log_query')) {
 					$v = \OC_App::getAppVersions();
 				} else {
@@ -988,7 +988,7 @@ class Server extends ServerContainer implements IServerContainer {
 		/** @deprecated 20.0.0 */
 		$this->registerDeprecatedAlias('IniWrapper', IniGetWrapper::class);
 		$this->registerService(IBus::class, function (ContainerInterface $c) {
-			$busClass = $c->get(\OCP\IConfig::class)->getSystemValue('commandbus');
+			$busClass = $c->get(\OCP\IConfig::class)->getSystemValueString('commandbus');
 			if ($busClass) {
 				[$app, $class] = explode('::', $busClass, 2);
 				if ($c->get(IAppManager::class)->isInstalled($app)) {
@@ -1107,8 +1107,8 @@ class Server extends ServerContainer implements IServerContainer {
 		$this->registerService(ILockingProvider::class, function (ContainerInterface $c) {
 			$ini = $c->get(IniGetWrapper::class);
 			$config = $c->get(\OCP\IConfig::class);
-			$ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
-			if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
+			$ttl = $config->getSystemValueInt('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
+			if ($config->getSystemValueBool('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
 				/** @var \OC\Memcache\Factory $memcacheFactory */
 				$memcacheFactory = $c->get(ICacheFactory::class);
 				$memcache = $memcacheFactory->createLocking('lock');
@@ -1208,7 +1208,7 @@ class Server extends ServerContainer implements IServerContainer {
 				$classExists = false;
 			}
 
-			if ($classExists && $c->get(\OCP\IConfig::class)->getSystemValue('installed', false) && $c->get(IAppManager::class)->isInstalled('theming') && $c->getTrustedDomainHelper()->isTrustedDomain($c->getRequest()->getInsecureServerHost())) {
+			if ($classExists && $c->get(\OCP\IConfig::class)->getSystemValueBool('installed', false) && $c->get(IAppManager::class)->isInstalled('theming') && $c->getTrustedDomainHelper()->isTrustedDomain($c->getRequest()->getInsecureServerHost())) {
 				$imageManager = new ImageManager(
 					$c->get(\OCP\IConfig::class),
 					$c->getAppDataDir('theming'),

+ 2 - 2
lib/private/Setup.php

@@ -410,7 +410,7 @@ class Setup {
 
 			// create empty file in data dir, so we can later find
 			// out that this is indeed an ownCloud data directory
-			file_put_contents($config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
+			file_put_contents($config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
 
 			// Update .htaccess files
 			self::updateHtaccess();
@@ -585,7 +585,7 @@ class Setup {
 		$content .= "  IndexIgnore *\n";
 		$content .= "</IfModule>";
 
-		$baseDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data');
+		$baseDir = \OC::$server->getConfig()->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data');
 		file_put_contents($baseDir . '/.htaccess', $content);
 		file_put_contents($baseDir . '/index.html', '');
 	}

+ 1 - 1
lib/private/Share20/Manager.php

@@ -1179,7 +1179,7 @@ class Manager implements IManager {
 	 * Set the share's password expiration time
 	 */
 	private function setSharePasswordExpirationTime(IShare $share): void {
-		if (!$this->config->getSystemValue('sharing.enable_mail_link_password_expiration', false)) {
+		if (!$this->config->getSystemValueBool('sharing.enable_mail_link_password_expiration', false)) {
 			// Sets password expiration date to NULL
 			$share->setPasswordExpirationTime();
 			return;

+ 1 - 1
lib/private/Support/Subscription/Registry.php

@@ -176,7 +176,7 @@ class Registry implements IRegistry {
 		}
 
 		$userCount = $this->getUserCount();
-		$hardUserLimit = $this->config->getSystemValue('one-click-instance.user-limit', 50);
+		$hardUserLimit = $this->config->getSystemValueInt('one-click-instance.user-limit', 50);
 
 		$userLimitReached = $userCount >= $hardUserLimit;
 		if ($userLimitReached && $notificationManager instanceof IManager) {

+ 3 - 3
lib/private/TemplateLayout.php

@@ -221,7 +221,7 @@ class TemplateLayout extends \OC_Template {
 		// TODO: remove deprecated OC_Util injection
 		$jsFiles = self::findJavascriptFiles(array_merge(\OC_Util::$scripts, Util::getScripts()));
 		$this->assign('jsfiles', []);
-		if ($this->config->getSystemValue('installed', false) && $renderAs != TemplateResponse::RENDER_AS_ERROR) {
+		if ($this->config->getSystemValueBool('installed', false) && $renderAs != TemplateResponse::RENDER_AS_ERROR) {
 			// this is on purpose outside of the if statement below so that the initial state is prefilled (done in the getConfig() call)
 			// see https://github.com/nextcloud/server/pull/22636 for details
 			$jsConfigHelper = new JSConfigHelper(
@@ -304,14 +304,14 @@ class TemplateLayout extends \OC_Template {
 	 * @return string
 	 */
 	protected function getVersionHashSuffix($path = false, $file = false) {
-		if ($this->config->getSystemValue('debug', false)) {
+		if ($this->config->getSystemValueBool('debug', false)) {
 			// allows chrome workspace mapping in debug mode
 			return "";
 		}
 		$themingSuffix = '';
 		$v = [];
 
-		if ($this->config->getSystemValue('installed', false)) {
+		if ($this->config->getSystemValueBool('installed', false)) {
 			if (\OC::$server->getAppManager()->isInstalled('theming')) {
 				$themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
 			}

+ 4 - 4
lib/private/URLGenerator.php

@@ -141,7 +141,7 @@ class URLGenerator implements IURLGenerator {
 	 * Returns a url to the given app and file.
 	 */
 	public function linkTo(string $appName, string $file, array $args = []): string {
-		$frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true');
+		$frontControllerActive = ($this->config->getSystemValueBool('htaccess.IgnoreFrontController', false) || getenv('front_controller_active') === 'true');
 
 		if ($appName !== '') {
 			$app_path = $this->getAppManager()->getAppPath($appName);
@@ -214,7 +214,7 @@ class URLGenerator implements IURLGenerator {
 
 		// Check if the app is in the app folder
 		$path = '';
-		$themingEnabled = $this->config->getSystemValue('installed', false) && $this->getAppManager()->isEnabledForUser('theming');
+		$themingEnabled = $this->config->getSystemValueBool('installed', false) && $this->getAppManager()->isEnabledForUser('theming');
 		$themingImagePath = false;
 		if ($themingEnabled) {
 			$themingDefaults = \OC::$server->getThemingDefaults();
@@ -275,7 +275,7 @@ class URLGenerator implements IURLGenerator {
 		$separator = strpos($url, '/') === 0 ? '' : '/';
 
 		if (\OC::$CLI && !\defined('PHPUNIT_RUN')) {
-			return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/') . '/' . ltrim($url, '/');
+			return rtrim($this->config->getSystemValueString('overwrite.cli.url'), '/') . '/' . ltrim($url, '/');
 		}
 		// The ownCloud web root can already be prepended.
 		if (\OC::$WEBROOT !== '' && strpos($url, \OC::$WEBROOT) === 0) {
@@ -313,7 +313,7 @@ class URLGenerator implements IURLGenerator {
 
 		$appId = $this->getAppManager()->getDefaultAppForUser();
 
-		if ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true
+		if ($this->config->getSystemValueBool('htaccess.IgnoreFrontController', false)
 			|| getenv('front_controller_active') === 'true') {
 			return $this->getAbsoluteURL('/apps/' . $appId . '/');
 		}

+ 4 - 4
lib/private/Updater.php

@@ -129,7 +129,7 @@ class Updater extends BasicEmitter {
 			}
 		}
 
-		$installedVersion = $this->config->getSystemValue('version', '0.0.0');
+		$installedVersion = $this->config->getSystemValueString('version', '0.0.0');
 		$currentVersion = implode('.', \OCP\Util::getVersion());
 
 		$this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, ['app' => 'core']);
@@ -216,7 +216,7 @@ class Updater extends BasicEmitter {
 		if ($currentVendor === 'nextcloud') {
 			return isset($allowedPreviousVersions[$currentVendor][$majorMinor])
 				&& (version_compare($oldVersion, $newVersion, '<=') ||
-					$this->config->getSystemValue('debug', false));
+					$this->config->getSystemValueBool('debug', false));
 		}
 
 		// Check if the instance can be migrated
@@ -251,7 +251,7 @@ class Updater extends BasicEmitter {
 		// create empty file in data dir, so we can later find
 		// out that this is indeed an ownCloud data directory
 		// (in case it didn't exist before)
-		file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
+		file_put_contents($this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
 
 		// pre-upgrade repairs
 		$repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class), \OC::$server->get(LoggerInterface::class));
@@ -399,7 +399,7 @@ class Updater extends BasicEmitter {
 	 * @return bool
 	 */
 	private function isCodeUpgrade(): bool {
-		$installedVersion = $this->config->getSystemValue('version', '0.0.0');
+		$installedVersion = $this->config->getSystemValueString('version', '0.0.0');
 		$currentVersion = implode('.', Util::getVersion());
 		if (version_compare($currentVersion, $installedVersion, '>')) {
 			return true;

+ 1 - 1
lib/private/Updater/VersionCheck.php

@@ -64,7 +64,7 @@ class VersionCheck {
 			return json_decode($this->config->getAppValue('core', 'lastupdateResult'), true);
 		}
 
-		$updaterUrl = $this->config->getSystemValue('updater.server.url', 'https://updates.nextcloud.com/updater_server/');
+		$updaterUrl = $this->config->getSystemValueString('updater.server.url', 'https://updates.nextcloud.com/updater_server/');
 
 		$this->config->setAppValue('core', 'lastupdatedat', (string)time());
 

+ 1 - 1
lib/private/User/Database.php

@@ -447,7 +447,7 @@ class Database extends ABackend implements
 	 */
 	public function getHome(string $uid) {
 		if ($this->userExists($uid)) {
-			return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $uid;
+			return \OC::$server->getConfig()->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $uid;
 		}
 
 		return false;

+ 3 - 3
lib/private/User/Session.php

@@ -491,8 +491,8 @@ class Session implements IUserSession, Emitter {
 		return false;
 	}
 
-	private function isTokenAuthEnforced() {
-		return $this->config->getSystemValue('token_auth_enforced', false);
+	private function isTokenAuthEnforced(): bool {
+		return $this->config->getSystemValueBool('token_auth_enforced', false);
 	}
 
 	protected function isTwoFactorEnforced($username) {
@@ -958,7 +958,7 @@ class Session implements IUserSession, Emitter {
 			$webRoot = '/';
 		}
 
-		$maxAge = $this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15);
+		$maxAge = $this->config->getSystemValueInt('remember_login_cookie_lifetime', 60 * 60 * 24 * 15);
 		\OC\Http\CookieHelper::setCookie(
 			'nc_username',
 			$username,

+ 2 - 2
lib/private/User/User.php

@@ -363,7 +363,7 @@ class User implements IUser {
 			if (($this->backend instanceof IGetHomeBackend || $this->backend->implementsActions(Backend::GET_HOME)) && $home = $this->backend->getHome($this->uid)) {
 				$this->home = $home;
 			} elseif ($this->config) {
-				$this->home = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $this->uid;
+				$this->home = $this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $this->uid;
 			} else {
 				$this->home = \OC::$SERVERROOT . '/data/' . $this->uid;
 			}
@@ -416,7 +416,7 @@ class User implements IUser {
 	 * @return bool
 	 */
 	public function canChangeDisplayName() {
-		if ($this->config->getSystemValue('allow_user_to_change_display_name') === false) {
+		if (!$this->config->getSystemValueBool('allow_user_to_change_display_name')) {
 			return false;
 		}
 		return $this->backend->implementsActions(Backend::SET_DISPLAYNAME);

+ 1 - 1
lib/private/legacy/OC_FileChunking.php

@@ -49,7 +49,7 @@ class OC_FileChunking {
 	 */
 	public function __construct($info) {
 		$this->info = $info;
-		$this->ttl = \OC::$server->getConfig()->getSystemValue('cache_chunk_gc_ttl', 86400);
+		$this->ttl = \OC::$server->getConfig()->getSystemValueInt('cache_chunk_gc_ttl', 86400);
 	}
 
 	public function getPrefix() {

+ 1 - 1
lib/private/legacy/OC_Helper.php

@@ -634,6 +634,6 @@ class OC_Helper {
 	 * @return bool
 	 */
 	public static function isReadOnlyConfigEnabled() {
-		return \OC::$server->getConfig()->getSystemValue('config_is_read_only', false);
+		return \OC::$server->getConfig()->getSystemValueBool('config_is_read_only', false);
 	}
 }

+ 6 - 6
lib/private/legacy/OC_Util.php

@@ -185,7 +185,7 @@ class OC_Util {
 		/** @var LoggerInterface $logger */
 		$logger = \OC::$server->get(LoggerInterface::class);
 
-		$plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton');
+		$plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValueString('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton');
 		$userLang = \OC::$server->getL10NFactory()->findLanguage();
 		$skeletonDirectory = str_replace('{lang}', $userLang, $plainSkeletonDirectory);
 
@@ -306,7 +306,7 @@ class OC_Util {
 	 */
 	public static function getChannel() {
 		OC_Util::loadVersion();
-		return \OC::$server->getConfig()->getSystemValue('updater.release.channel', self::$versionCache['OC_Channel']);
+		return \OC::$server->getConfig()->getSystemValueString('updater.release.channel', self::$versionCache['OC_Channel']);
 	}
 
 	/**
@@ -783,7 +783,7 @@ class OC_Util {
 	 * @return array arrays with error messages and hints
 	 */
 	public static function checkDataDirectoryPermissions($dataDirectory) {
-		if (\OC::$server->getConfig()->getSystemValue('check_data_directory_permissions', true) === false) {
+		if (!\OC::$server->getConfig()->getSystemValueBool('check_data_directory_permissions', true)) {
 			return  [];
 		}
 
@@ -957,7 +957,7 @@ class OC_Util {
 		$testContent = 'This is used for testing whether htaccess is properly enabled to disallow access from the outside. This file can be safely removed.';
 
 		// creating a test file
-		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName;
+		$testFile = $config->getSystemValueString('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName;
 
 		if (file_exists($testFile)) {// already running this test, possible recursive call
 			return false;
@@ -983,7 +983,7 @@ class OC_Util {
 	 * @throws \OCP\HintException If the test file can't get written.
 	 */
 	public function isHtaccessWorking(\OCP\IConfig $config) {
-		if (\OC::$CLI || !$config->getSystemValue('check_for_working_htaccess', true)) {
+		if (\OC::$CLI || !$config->getSystemValueBool('check_for_working_htaccess', true)) {
 			return true;
 		}
 
@@ -993,7 +993,7 @@ class OC_Util {
 		}
 
 		$fileName = '/htaccesstest.txt';
-		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName;
+		$testFile = $config->getSystemValueString('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName;
 
 		// accessing the file via http
 		$url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT . '/data' . $fileName);