Use File::create() in Config::saveIni() to create missing nested directories

refs #8219
This commit is contained in:
Johannes Meyer 2015-01-30 15:43:02 +01:00
parent fdcec046e0
commit 9426a5bd23
1 changed files with 5 additions and 0 deletions

View File

@ -8,6 +8,7 @@ use Iterator;
use Countable;
use LogicException;
use UnexpectedValueException;
use Icinga\Util\File;
use Icinga\Data\ConfigObject;
use Icinga\File\Ini\IniWriter;
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()');
}
if (! file_exists($filePath)) {
File::create($filePath, $fileMode);
}
$this->getIniWriter($filePath, $fileMode)->write();
}