From 6089372c424b4b1f3de1bea255aacb51a7fdf45a Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 12 Nov 2014 14:39:45 +0100 Subject: [PATCH] Do not define ICINGAWEB_BASEDIR in index.php There's SCRIPT_FILENAME. The constants will be removed shortly. --- library/Icinga/Application/ApplicationBootstrap.php | 9 ++++----- public/index.php | 6 +----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/library/Icinga/Application/ApplicationBootstrap.php b/library/Icinga/Application/ApplicationBootstrap.php index 0c3721294..fc124b61d 100644 --- a/library/Icinga/Application/ApplicationBootstrap.php +++ b/library/Icinga/Application/ApplicationBootstrap.php @@ -101,14 +101,13 @@ abstract class ApplicationBootstrap */ protected function __construct($configDir = null) { - $this->libDir = realpath(__DIR__ . '/../..'); - - if (! defined('ICINGAWEB_BASEDIR')) { - throw new LogicException('\'ICINGAWEB_BASEDIR\' is not defined'); - } + define('ICINGAWEB_BASEDIR', dirname($this->getBootstrapDirecory())); define('ICINGAWEB_VENDORS', ICINGAWEB_BASEDIR . '/library/vendor'); define('ICINGAWEB_APPDIR', ICINGAWEB_BASEDIR . '/application'); + $this->appDir = ICINGAWEB_APPDIR; + $this->libDir = realpath(__DIR__ . '/../..'); + if ($configDir === null) { if (array_key_exists('ICINGAWEB_CONFIGDIR', $_SERVER)) { $configDir = $_SERVER['ICINGAWEB_CONFIGDIR']; diff --git a/public/index.php b/public/index.php index 881c1318e..085f73747 100644 --- a/public/index.php +++ b/public/index.php @@ -2,11 +2,7 @@ // {{{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/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';