mirror of
https://github.com/nextcloud/all-in-one.git
synced 2024-09-21 23:36:31 +08:00
Merge pull request #1981 from nextcloud/enh/noid/increase-free-disk-check
check size of config and only write back if space is sufficient
This commit is contained in:
commit
775889edc4
|
@ -453,10 +453,12 @@ class ConfigurationManager
|
|||
throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . " does not exist! Something was set up falsely!");
|
||||
}
|
||||
$df = disk_free_space(DataConst::GetDataDirectory());
|
||||
if ($df !== false && (int)$df < 10240) {
|
||||
$content = json_encode($config, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
||||
$size = strlen($content) + 10240;
|
||||
if ($df !== false && (int)$df < $size) {
|
||||
throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . " does not have enough space for writing the config file! Not writing it back!");
|
||||
}
|
||||
file_put_contents(DataConst::GetConfigFile(), json_encode($config, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT));
|
||||
file_put_contents(DataConst::GetConfigFile(), $content);
|
||||
}
|
||||
|
||||
private function GetEnvironmentalVariableOrConfig(string $envVariableName, string $configName, string $defaultValue) : string {
|
||||
|
|
Loading…
Reference in a new issue