diff --git a/bin/icingacli b/bin/icingacli index 1a0781222b..3f3cc47f17 100755 --- a/bin/icingacli +++ b/bin/icingacli @@ -1,6 +1,17 @@ #!/usr/bin/php + dispatch(); +Icinga\Application\Cli::start()->dispatch(); diff --git a/library/Icinga/Application/ApplicationBootstrap.php b/library/Icinga/Application/ApplicationBootstrap.php index f7b2b0c90d..ebd5641635 100644 --- a/library/Icinga/Application/ApplicationBootstrap.php +++ b/library/Icinga/Application/ApplicationBootstrap.php @@ -6,6 +6,7 @@ use ErrorException; use Exception; +use LogicException; use Icinga\Application\Modules\Manager as ModuleManager; use Icinga\Data\ResourceFactory; use Icinga\Exception\ConfigurationError; @@ -101,23 +102,14 @@ abstract class ApplicationBootstrap */ protected function __construct($configDir = null) { - $this->libDir = realpath(__DIR__ . '/../..'); - - if (!defined('ICINGA_LIBDIR')) { - define('ICINGA_LIBDIR', $this->libDir); - } - - if (defined('ICINGAWEB_APPDIR')) { - $this->appDir = ICINGAWEB_APPDIR; - } elseif (array_key_exists('ICINGAWEB_APPDIR', $_SERVER)) { - $this->appDir = $_SERVER['ICINGAWEB_APPDIR']; - } else { - $this->appDir = realpath($this->libDir. '/../application'); + if (! defined('ICINGAWEB_BASEDIR')) { + define('ICINGAWEB_BASEDIR', dirname($this->getBootstrapDirecory())); } + define('ICINGAWEB_VENDORS', ICINGAWEB_BASEDIR . '/library/vendor'); + define('ICINGAWEB_APPDIR', ICINGAWEB_BASEDIR . '/application'); - if (!defined('ICINGAWEB_APPDIR')) { - define('ICINGAWEB_APPDIR', $this->appDir); - } + $this->appDir = ICINGAWEB_APPDIR; + $this->libDir = realpath(__DIR__ . '/../..'); if ($configDir === null) { if (array_key_exists('ICINGAWEB_CONFIGDIR', $_SERVER)) { @@ -416,7 +408,7 @@ protected function setupErrorHandling() */ protected function setupLogger() { - if (($loggingConfig = $this->config->get('logging')) !== null) { + if (($loggingConfig = $this->config->logging) !== null) { try { Logger::create($loggingConfig); } catch (ConfigurationError $e) { diff --git a/library/Icinga/Data/Filter/Filter.php b/library/Icinga/Data/Filter/Filter.php index 64607a4a0c..99b0290f15 100644 --- a/library/Icinga/Data/Filter/Filter.php +++ b/library/Icinga/Data/Filter/Filter.php @@ -79,7 +79,7 @@ public function applyChanges($changes) } } - krsort($operators, SORT_NATURAL); + krsort($operators, version_compare(PHP_VERSION, '5.4.0') >= 0 ? SORT_NATURAL : SORT_REGULAR); foreach ($operators as $id => $operator) { $f = $filter->getById($id); if ($f->getOperatorName() !== $operator) { diff --git a/library/Icinga/Web/Widget/Tab.php b/library/Icinga/Web/Widget/Tab.php index 92a1a99543..28c04e6abe 100644 --- a/library/Icinga/Web/Widget/Tab.php +++ b/library/Icinga/Web/Widget/Tab.php @@ -201,7 +201,7 @@ public function render() $caption = $view->escape($this->title); if ($this->icon !== null) { - $caption = $view->img($this->icon, array('class' => 'icon')) . ' ' . $caption; + $caption = $view->img($this->icon, array('class' => 'icon')) . $caption; } if ($this->url !== null) { $this->url->overwriteParams($this->urlParams); diff --git a/public/index.php b/public/index.php index 1715811553..085f737473 100644 --- a/public/index.php +++ b/public/index.php @@ -2,4 +2,8 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -require_once dirname(__DIR__). '/library/Icinga/Application/webrouter.php'; +if (! @include_once dirname(__DIR__) . '/library/Icinga/Application/webrouter.php') { + // If the Icinga library wasn't found under ICINGAWEB_BASEDIR, require that the Icinga library is found in PHP's + // include path which is the case if Icinga Web 2 is installed via packages + require_once 'Icinga/Application/webrouter.php'; +}