mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 22:27:31 -04:00
do not write htaccess file if disk space is too low
Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
parent
5b16df8dd1
commit
2d2c679931
1 changed files with 8 additions and 0 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue