aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSimon L <szaimen@e.mail.de>2023-11-16 16:06:44 +0100
committerSimon L <szaimen@e.mail.de>2023-11-17 15:22:53 +0100
commit4c522f0f654ccbd1f48935a7a99324600f0a1c16 (patch)
treed90cb312715bb70260b131547083f02147a673fa /lib
parent8c24a32fda99715fdcb4020eb6f0231d13eb6e79 (diff)
downloadnextcloud-server-4c522f0f654ccbd1f48935a7a99324600f0a1c16.tar.gz
nextcloud-server-4c522f0f654ccbd1f48935a7a99324600f0a1c16.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.php8
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");
}