From: szaimen Date: Mon, 12 Sep 2022 09:01:38 +0000 (+0200) Subject: Do not empty config.php file if reading failed for any reason X-Git-Tag: v23.0.10rc1~30^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F34025%2Fhead;p=nextcloud-server.git Do not empty config.php file if reading failed for any reason Signed-off-by: Côme Chilliet Signed-off-by: szaimen --- diff --git a/lib/private/Config.php b/lib/private/Config.php index 2a83d2300dc..a1753c8be31 100644 --- a/lib/private/Config.php +++ b/lib/private/Config.php @@ -239,6 +239,10 @@ class Config { * @throws \Exception If no file lock can be acquired */ private function writeData() { + if (!is_file(\OC::$configDir.'/CAN_INSTALL') && !isset($this->cache['version'])) { + throw new HintException(sprintf('Configuration was not read or initialized correctly, not overwriting %s', $this->configFilePath)); + } + // Create a php file ... $content = "