2014-04-09 10:42:06 +02:00
|
|
|
<?php
|
2014-07-15 13:39:22 +02:00
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
2014-04-09 10:42:06 +02:00
|
|
|
|
|
|
|
$applicationPath = realpath(dirname(__FILE__) . '/../../application/');
|
|
|
|
$modulePath = realpath(dirname(__FILE__) . '/../../modules/');
|
|
|
|
$libraryPath = realpath(dirname(__FILE__) . '/../../library/');
|
2014-04-09 14:18:14 +02:00
|
|
|
$testLibraryPath = realpath(dirname(__FILE__) . '/library/');
|
2014-04-09 10:42:06 +02:00
|
|
|
$configPath = realpath($libraryPath . '/../config');
|
|
|
|
|
|
|
|
// Is usually done in the application's bootstrap and is used by some of our internals
|
2014-06-04 23:11:27 +02:00
|
|
|
if (!defined('ICINGAWEB_APPDIR')) {
|
|
|
|
define('ICINGAWEB_APPDIR', $applicationPath);
|
2014-04-09 10:42:06 +02:00
|
|
|
}
|
2014-04-09 14:18:14 +02:00
|
|
|
if (!defined('ICINGA_LIBDIR')) {
|
|
|
|
define('ICINGA_LIBDIR', $libraryPath);
|
|
|
|
}
|
2014-04-09 10:42:06 +02:00
|
|
|
|
|
|
|
// This is needed to get the Zend Plugin loader working
|
|
|
|
set_include_path(implode(PATH_SEPARATOR, array($libraryPath, get_include_path())));
|
|
|
|
|
2014-04-11 09:35:19 +02:00
|
|
|
require_once 'Mockery/Loader.php';
|
|
|
|
$mockeryLoader = new \Mockery\Loader;
|
|
|
|
$mockeryLoader->register();
|
|
|
|
|
2014-04-09 10:42:06 +02:00
|
|
|
require_once($libraryPath . '/Icinga/Application/Loader.php');
|
|
|
|
|
|
|
|
$loader = new Icinga\Application\Loader();
|
2014-04-09 14:18:14 +02:00
|
|
|
$loader->registerNamespace('Tests', $testLibraryPath);
|
2014-04-09 10:42:06 +02:00
|
|
|
$loader->registerNamespace('Icinga', $libraryPath . '/Icinga');
|
2014-11-14 10:57:14 +01:00
|
|
|
$loader->registerNamespace('Icinga\\Forms', $applicationPath . '/forms');
|
2014-04-09 10:42:06 +02:00
|
|
|
|
|
|
|
$modules = scandir($modulePath);
|
|
|
|
foreach ($modules as $module) {
|
|
|
|
if ($module === '.' || $module === '..') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$moduleNamespace = 'Icinga\\Module\\' . ucfirst($module);
|
|
|
|
$moduleLibraryPath = $modulePath . '/' . $module . '/library/' . ucfirst($module);
|
|
|
|
|
|
|
|
if (is_dir($moduleLibraryPath)) {
|
|
|
|
$loader->registerNamespace($moduleNamespace, $moduleLibraryPath);
|
|
|
|
}
|
|
|
|
|
2014-04-10 14:52:08 +02:00
|
|
|
$moduleTestPath = $modulePath . '/' . $module . '/test/php';
|
2014-04-09 10:42:06 +02:00
|
|
|
if (is_dir($moduleTestPath)) {
|
2014-04-10 14:52:08 +02:00
|
|
|
$loader->registerNamespace('Tests\\' . $moduleNamespace, $moduleTestPath);
|
2014-04-09 10:42:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$moduleFormPath = $modulePath . '/' . $module . '/application/forms';
|
|
|
|
if (is_dir($moduleFormPath)) {
|
2014-11-14 11:30:44 +01:00
|
|
|
$loader->registerNamespace($moduleNamespace . '\\Forms', $moduleFormPath);
|
2014-04-09 10:42:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$loader->register();
|
|
|
|
|
2014-11-27 11:37:02 +01:00
|
|
|
set_include_path(
|
|
|
|
implode(
|
|
|
|
PATH_SEPARATOR,
|
|
|
|
array($libraryPath . '/vendor', get_include_path())
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2014-04-09 10:42:06 +02:00
|
|
|
require_once 'Zend/Loader/Autoloader.php';
|
|
|
|
\Zend_Loader_Autoloader::getInstance();
|
|
|
|
|
|
|
|
Icinga\Application\Config::$configDir = $configPath;
|