diff options
author | Simon L <szaimen@e.mail.de> | 2023-11-28 18:02:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-28 18:02:50 +0100 |
commit | c78141cec9843de4da3a6bc83faaf96a86d9ffbe (patch) | |
tree | ce6d105e3f0692fee73161c932c9fea0f9d1800c /lib | |
parent | 52eddf86756de636d30715e0d0124117dfb5a803 (diff) | |
parent | f99baf1f86e3f505ba290ca25655b5dfb977876c (diff) | |
download | nextcloud-server-c78141cec9843de4da3a6bc83faaf96a86d9ffbe.tar.gz nextcloud-server-c78141cec9843de4da3a6bc83faaf96a86d9ffbe.zip |
Merge pull request #41608 from nextcloud/backport/41544/stable27
[stable27] do not write htaccess file if disk space is too low
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"); } |