Merge pull request #34025 from nextcloud/backport/34021/stable23

[stable23] Do not empty config.php file if reading failed for any reason
This commit is contained in:
Simon L 2022-09-12 16:46:35 +02:00 committed by GitHub
commit c11682d0c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 = "<?php\n";
$content .= '$CONFIG = ';