Skip to content

Commit

Permalink
Merge pull request #33921 from nextcloud/fix/fix-config-file-emptied
Browse files Browse the repository at this point in the history
Do not empty config.php file if reading failed for any reason
  • Loading branch information
come-nc authored Sep 12, 2022
2 parents 1a6d7dc + c2dafb0 commit 1f7e769
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/private/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<?php\n";
$content .= '$CONFIG = ';
Expand Down

0 comments on commit 1f7e769

Please sign in to comment.