diff options
author | Simon L <szaimen@e.mail.de> | 2023-11-16 16:06:44 +0100 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-11-20 07:26:42 +0000 |
commit | 2d2c679931cb6b436ebdee1057e7acfa848e2860 (patch) | |
tree | 3447cf8e47bb43bcd44a20a1a6283ad1766b9a11 /lib | |
parent | 5b16df8dd1f12858c97a42c1a3e85e49382395e5 (diff) | |
download | nextcloud-server-2d2c679931cb6b436ebdee1057e7acfa848e2860.tar.gz nextcloud-server-2d2c679931cb6b436ebdee1057e7acfa848e2860.zip |
do not write htaccess file if disk space is too low
Signed-off-by: Simon L <szaimen@e.mail.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Setup.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 749d4c7bdb0..75b581db7c4 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -560,6 +560,14 @@ class Setup { } if ($content !== '') { + // Never write file back if disk space should be too low + if (function_exists('disk_free_space')) { + $df = disk_free_space(\OC::$SERVERROOT); + $size = strlen($content) + 10240; + if ($df !== false && $df < (float)$size) { + throw new \Exception(\OC::$SERVERROOT . " does not have enough space for writing the htaccess file! Not writing it back!"); + } + } //suppress errors in case we don't have permissions for it return (bool)@file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent . $content . "\n"); } |