Skip to content

Commit

Permalink
Merge branch 'master' into feature/setup-wizard-7163
Browse files Browse the repository at this point in the history
  • Loading branch information
lippserd committed Nov 12, 2014
2 parents 62aacce + a081db0 commit b27d1d0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 22 deletions.
17 changes: 14 additions & 3 deletions bin/icingacli
@@ -1,6 +1,17 @@
#!/usr/bin/php

<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}

define('ICINGAWEB_BASEDIR', dirname(__DIR__));
// ICINGAWEB_BASEDIR is the parent folder for at least application, bin, modules, library/vendor and public


if (! @include_once ICINGAWEB_BASEDIR . '/library/Icinga/Application/Cli.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/Cli.php';
}

use Icinga\Application\Cli;
require_once dirname(__DIR__) . '/library/Icinga/Application/Cli.php';
Cli::start()->dispatch();
Icinga\Application\Cli::start()->dispatch();
24 changes: 8 additions & 16 deletions library/Icinga/Application/ApplicationBootstrap.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion library/Icinga/Data/Filter/Filter.php
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion library/Icinga/Web/Widget/Tab.php
Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion public/index.php
Expand Up @@ -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';
}

0 comments on commit b27d1d0

Please sign in to comment.