diff --git a/library/Icinga/Application/ApplicationBootstrap.php b/library/Icinga/Application/ApplicationBootstrap.php index 89597be3d..e9b6028bb 100644 --- a/library/Icinga/Application/ApplicationBootstrap.php +++ b/library/Icinga/Application/ApplicationBootstrap.php @@ -151,9 +151,9 @@ abstract class ApplicationBootstrap $configDir = '/etc/icingaweb'; } } - $canonical = realpath($configDir); - if ($canonical) { - $this->configDir = $canonical; + $this->configDir = realpath($configDir); + if (!$this->configDir) { + $this->configDir = '/etc/icingaweb'; } $this->setupAutoloader(); diff --git a/library/Icinga/Application/Config.php b/library/Icinga/Application/Config.php index 8771faa10..7070e982c 100644 --- a/library/Icinga/Application/Config.php +++ b/library/Icinga/Application/Config.php @@ -165,6 +165,16 @@ class Config extends Zend_Config */ public static function resolvePath($path) { - return self::$configDir . DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR); + if (Platform::isWindows()) { + throw new ProgrammingError('Windows support has not yet been implemented'); + } + + if (strpos(dirname($path), DIRECTORY_SEPARATOR) === 0) { + return $path; + } + + $path = self::$configDir . DIRECTORY_SEPARATOR . $path; + $canonical = realpath($path); + return ($canonical === false) ? $path : $canonical; } } diff --git a/library/Icinga/User/Preferences/PreferencesStore.php b/library/Icinga/User/Preferences/PreferencesStore.php index 81d47b394..410e8f26e 100644 --- a/library/Icinga/User/Preferences/PreferencesStore.php +++ b/library/Icinga/User/Preferences/PreferencesStore.php @@ -132,7 +132,7 @@ abstract class PreferencesStore } if ($type === 'Ini') { - $config->location = IcingaConfig::resolvePath('preferences'); + $config->location = $config->config_path; } elseif ($type === 'Db') { $config->connection = new DbConnection(ResourceFactory::getResourceConfig($config->resource)); }