From 32d483f69f4675bea1462a4a5c65c0ec2ad8586b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 11 Nov 2014 15:22:21 +0100 Subject: [PATCH] Level up index.php This is the preparation for having the Icinga library in PHP's include path. --- public/index.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/index.php b/public/index.php index 171581155..92cd0a499 100644 --- a/public/index.php +++ b/public/index.php @@ -2,4 +2,12 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -require_once dirname(__DIR__). '/library/Icinga/Application/webrouter.php'; +define('ICINGAWEB_BASEDIR', dirname(__DIR__)); +// ICINGAWEB_BASEDIR is the parent folder for at least application, bin, modules and public + + +if (! @include_once ICINGAWEB_BASEDIR . '/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'; +}