Skip to content

Commit 9b6e5c6

Browse files
committed
add a disk_free_space check before writing config
Signed-off-by: Simon L <szaimen@e.mail.de>
1 parent 936f634 commit 9b6e5c6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/private/Config.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,12 @@ private function writeData() {
285285
'This can usually be fixed by giving the webserver write access to the config directory.');
286286
}
287287

288+
// Never write file back if disk space should be low (less than 100 KiB)
289+
$df = disk_free_space($this->configDir);
290+
if ($df !== false && (int)$df < 102400) {
291+
throw new \Exception($this->configDir . " does not have enough space for writing the config file! Not writing it back!");
292+
}
293+
288294
// Try to acquire a file lock
289295
if (!flock($filePointer, LOCK_EX)) {
290296
throw new \Exception(sprintf('Could not acquire an exclusive lock on the config file %s', $this->configFilePath));

0 commit comments

Comments
 (0)