parent
a090907373
commit
8dc9928cb3
|
@ -314,9 +314,7 @@ class Config implements Countable, Iterator, Selectable
|
|||
if ($filepath === false) {
|
||||
$emptyConfig->setConfigFile($file);
|
||||
} elseif (is_readable($filepath)) {
|
||||
$config = static::fromArray(IniParser::parseIniFile($filepath)->toArray());
|
||||
$config->setConfigFile($filepath);
|
||||
return $config;
|
||||
return IniParser::parseIniFile($filepath);
|
||||
} elseif (@file_exists($filepath)) {
|
||||
throw new NotReadableError(t('Cannot read config file "%s". Permission denied'), $filepath);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ use Icinga\File\Ini\Dom\Directive;
|
|||
use Icinga\Application\Logger;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Exception\NotReadableError;
|
||||
use Icinga\Application\Config;
|
||||
|
||||
class IniParser
|
||||
{
|
||||
|
@ -246,7 +247,7 @@ class IniParser
|
|||
*
|
||||
* @param string $file The ini file to read
|
||||
*
|
||||
* @return Document A mutable DOM object
|
||||
* @return Config
|
||||
* @throws NotReadableError When the file cannot be read
|
||||
*/
|
||||
public static function parseIniFile($file)
|
||||
|
@ -259,6 +260,6 @@ class IniParser
|
|||
throw new NotReadableError('Couldn\'t read the file `%s\'', $path);
|
||||
}
|
||||
|
||||
return self::parseIni($content);
|
||||
return Config::fromArray(self::parseIni($content)->toArray())->setConfigFile($file);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue