Merge pull request #45 from nextcloud/make-more-robust

make the datadirectory more robust
This commit is contained in:
szaimen 2021-12-04 11:04:30 +01:00 committed by GitHub
commit 02365fdd3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -10,6 +10,9 @@ print_green() {
if ! [ -a "/var/run/docker.sock" ]; then
echo "Docker socket is not available. Cannot continue."
exit 1
elif ! mountpoint -q "/mnt/docker-aio-config"; then
echo "/mnt/docker-aio-config is not a mountpoint. Cannot proceed!"
exit 1
elif ! sudo -u www-data test -r /var/run/docker.sock; then
echo "Trying to fix docker.sock permissions internally..."
GROUP="$(stat -c '%g' /var/run/docker.sock)"

View file

@ -193,9 +193,12 @@ class ConfigurationManager
$this->WriteConfig($config);
}
/**
* @throws InvalidSettingConfigurationException
*/
public function WriteConfig(array $config) : void {
if(!is_dir(DataConst::GetDataDirectory())) {
mkdir(DataConst::GetDataDirectory());
throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . " does not exist! Something was set up falsely!");
}
file_put_contents(DataConst::GetConfigFile(), json_encode($config));
}