From 168926bd4f9b2e85a82ef761f7c08c5a21c5750d Mon Sep 17 00:00:00 2001 From: Alexey Abel Date: Sat, 4 May 2024 11:06:12 +0000 Subject: [PATCH] Add warning for obsolete keys --- lib/Config.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/Config.php b/lib/Config.php index c6a8a07..d191179 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -70,10 +70,25 @@ public function __construct(LoggerInterface $logger, IConfig $nextCloudConfigura . self::CONFIG_KEY . ' which should contain the configuration ' . 'for the app user_backend_sql_raw.'); } + + $this->warnAboutObsoleteConfigKeys(); + } + + public function warnAboutObsoleteConfigKeys() + { + $obsolete_keys = array("db_type", "db_host", "db_port", "db_name", "mariadb_charset"); + foreach ($obsolete_keys as $key) { + // not using getConfigValueOrFalse() here, because we want to also catch empty strings + if (array_key_exists(key: $key, array:$this->appConfiguration)) { + $this->logger->warning("The configuration key '{$key}' has been obsolete since " + . "version 2.0.0, has no effect and can be removed."); + } + } } /** - * @return string db type to connect to + * @return string dsn to use for db connection + * @throws \UnexpectedValueException */ public function getDsn() {