From 5851c265a1009e88e4018f44cb1b76fa21e9cbc2 Mon Sep 17 00:00:00 2001 From: szaimen Date: Mon, 12 Sep 2022 11:01:38 +0200 Subject: [PATCH] Do not empty config.php file if reading failed for any reason MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet Signed-off-by: szaimen --- lib/private/Config.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/private/Config.php b/lib/private/Config.php index 2a83d2300dcd4..a1753c8be3189 100644 --- a/lib/private/Config.php +++ b/lib/private/Config.php @@ -239,6 +239,10 @@ private function readData() { * @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 = "