[icinga-checkins] icinga.org: icingaweb2/feature/include-zend-7464: Fix ICINGAWEB_APPDIR location if the Icinga library is in PHP' s include path

git at icinga.org git at icinga.org
Tue Nov 11 15:34:00 CET 2014


Module: icingaweb2
Branch: feature/include-zend-7464
Commit: 8413aa02e53fe096e0d0a2f264b068a22e02c74c
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=8413aa02e53fe096e0d0a2f264b068a22e02c74c

Author: Eric Lippmann <eric.lippmann at netways.de>
Date:   Tue Nov 11 15:30:11 2014 +0100

Fix ICINGAWEB_APPDIR location if the Icinga library is in PHP's include path

---

 library/Icinga/Application/ApplicationBootstrap.php |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/library/Icinga/Application/ApplicationBootstrap.php b/library/Icinga/Application/ApplicationBootstrap.php
index 90eef29..922378c 100644
--- a/library/Icinga/Application/ApplicationBootstrap.php
+++ b/library/Icinga/Application/ApplicationBootstrap.php
@@ -6,6 +6,7 @@ namespace Icinga\Application;
 
 use ErrorException;
 use Exception;
+use LogicException;
 use Zend_Config;
 use Icinga\Application\Modules\Manager as ModuleManager;
 use Icinga\Data\ResourceFactory;
@@ -105,13 +106,15 @@ abstract class ApplicationBootstrap
 
         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_APPDIR')) {
+            if (array_key_exists('ICINGAWEB_APPDIR', $_SERVER)) {
+                $this->appDIr = $_SERVER['ICINGAWEB_APPDIR'];
+            } else {
+                if (! defined('ICINGAWEB_BASEDIR')) {
+                    throw new LogicException('\'ICINGAWEB_BASEDIR\' is not defined');
+                }
+                $this->appDir = ICINGAWEB_BASEDIR . '/application';
+            }
             define('ICINGAWEB_APPDIR', $this->appDir);
         }
 



More information about the icinga-checkins mailing list