mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
Merge pull request #3734 from nextcloud/enh/noid/add-json-decode-and-encode
This commit is contained in:
commit
ea5965c149
1 changed files with 2 additions and 2 deletions
|
|
@ -12,7 +12,7 @@ class ConfigurationManager
|
||||||
if(file_exists(DataConst::GetConfigFile()))
|
if(file_exists(DataConst::GetConfigFile()))
|
||||||
{
|
{
|
||||||
$configContent = file_get_contents(DataConst::GetConfigFile());
|
$configContent = file_get_contents(DataConst::GetConfigFile());
|
||||||
return json_decode($configContent, true);
|
return json_decode($configContent, true, 512, JSON_THROW_ON_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
|
|
@ -514,7 +514,7 @@ class ConfigurationManager
|
||||||
throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . " does not exist! Something was set up falsely!");
|
throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . " does not exist! Something was set up falsely!");
|
||||||
}
|
}
|
||||||
$df = disk_free_space(DataConst::GetDataDirectory());
|
$df = disk_free_space(DataConst::GetDataDirectory());
|
||||||
$content = json_encode($config, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
$content = json_encode($config, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR);
|
||||||
$size = strlen($content) + 10240;
|
$size = strlen($content) + 10240;
|
||||||
if ($df !== false && (int)$df < $size) {
|
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!");
|
throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . " does not have enough space for writing the config file! Not writing it back!");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue