diff options
author | Simon L <szaimen@e.mail.de> | 2023-11-20 08:14:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-20 08:14:57 +0100 |
commit | 753e7c2dfff1b7c760384688ec378942bbd59e4a (patch) | |
tree | baa0808a450d3c2379cc39305483b2c402f7c0c3 /lib | |
parent | da162190f4acf807896af4287c76935a7928666e (diff) | |
parent | 3f6caa46f34a1575dc332f9ce1a2edaba99a1b11 (diff) | |
download | nextcloud-server-753e7c2dfff1b7c760384688ec378942bbd59e4a.tar.gz nextcloud-server-753e7c2dfff1b7c760384688ec378942bbd59e4a.zip |
Merge pull request #41544 from nextcloud/enh/noid/updatehtaccess-disk-space-check
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 e763b6d39c1..4fea5d72591 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"); } |