Skip to content

Commit

Permalink
add a check for disk_free_space in Config.php
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L <szaimen@e.mail.de>
  • Loading branch information
szaimen committed Mar 7, 2023
1 parent 55db978 commit e87d968
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/private/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,12 @@ private function writeData() {
}

// Never write file back if disk space should be too low
$df = disk_free_space($this->configDir);
$size = strlen($content) + 10240;
if ($df !== false && $df < (float)$size) {
throw new \Exception($this->configDir . " does not have enough space for writing the config file! Not writing it back!");
if (function_exists('disk_free_space')) {
$df = disk_free_space($this->configDir);
$size = strlen($content) + 10240;
if ($df !== false && $df < (float)$size) {
throw new \Exception($this->configDir . " does not have enough space for writing the config file! Not writing it back!");
}
}

// Try to acquire a file lock
Expand Down

0 comments on commit e87d968

Please sign in to comment.