From c2dafb099781a31745749ae399cf864b2a195000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 6 Sep 2022 17:22:16 +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 --- lib/private/Config.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/private/Config.php b/lib/private/Config.php index 37708357339c1..ba3b8c6fe4d36 100644 --- a/lib/private/Config.php +++ b/lib/private/Config.php @@ -262,6 +262,10 @@ private function readData() { private function writeData() { $this->checkReadOnly(); + 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 = "