[icinga-checkins] icinga.org: icingaweb2/master: Prepare icingacli for having the Icinga library in PHP's include path

git at icinga.org git at icinga.org
Wed Nov 12 13:41:52 CET 2014


Module: icingaweb2
Branch: master
Commit: 921f324d3e10cbcbe9ca661b6cc53f1de2e4e3f2
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=921f324d3e10cbcbe9ca661b6cc53f1de2e4e3f2

Author: Eric Lippmann <eric.lippmann at netways.de>
Date:   Wed Nov 12 13:13:39 2014 +0100

Prepare icingacli for having the Icinga library in PHP's include path

---

 bin/icingacli    |   17 ++++++++++++++---
 public/index.php |    2 +-
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/bin/icingacli b/bin/icingacli
index 1a07812..5bd5086 100755
--- a/bin/icingacli
+++ b/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 . '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();
diff --git a/public/index.php b/public/index.php
index 92cd0a4..881c131 100644
--- a/public/index.php
+++ b/public/index.php
@@ -3,7 +3,7 @@
 // {{{ICINGA_LICENSE_HEADER}}}
 
 define('ICINGAWEB_BASEDIR', dirname(__DIR__));
-// ICINGAWEB_BASEDIR is the parent folder for at least application, bin, modules and public
+// 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') {



More information about the icinga-checkins mailing list