Use File::create() in Config::saveIni() to create missing nested directories
refs #8219
This commit is contained in:
parent
fdcec046e0
commit
9426a5bd23
|
@ -8,6 +8,7 @@ use Iterator;
|
||||||
use Countable;
|
use Countable;
|
||||||
use LogicException;
|
use LogicException;
|
||||||
use UnexpectedValueException;
|
use UnexpectedValueException;
|
||||||
|
use Icinga\Util\File;
|
||||||
use Icinga\Data\ConfigObject;
|
use Icinga\Data\ConfigObject;
|
||||||
use Icinga\File\Ini\IniWriter;
|
use Icinga\File\Ini\IniWriter;
|
||||||
use Icinga\Exception\NotReadableError;
|
use Icinga\Exception\NotReadableError;
|
||||||
|
@ -320,6 +321,10 @@ class Config implements Countable, Iterator
|
||||||
throw new LogicException('You need to pass $filePath or set a path using Config::setConfigFile()');
|
throw new LogicException('You need to pass $filePath or set a path using Config::setConfigFile()');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! file_exists($filePath)) {
|
||||||
|
File::create($filePath, $fileMode);
|
||||||
|
}
|
||||||
|
|
||||||
$this->getIniWriter($filePath, $fileMode)->write();
|
$this->getIniWriter($filePath, $fileMode)->write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue