2014-04-09 10:42:06 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$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
|
|
|
|
if (!defined('ICINGA_APPDIR')) {
|
|
|
|
define('ICINGA_APPDIR', $applicationPath);
|
|
|
|
}
|
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())));
|
|
|
|
|
|
|
|
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');
|
|
|
|
$loader->registerNamespace('Icinga\\Form', $applicationPath . '/forms');
|
|
|
|
|
|
|
|
$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);
|
|
|
|
}
|
|
|
|
|
|
|
|
$moduleTestPath = $modulePath . '/' . $module . '/test';
|
|
|
|
if (is_dir($moduleTestPath)) {
|
|
|
|
$loader->registerNamespace($moduleNamespace . '\\Test', $moduleTestPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
$moduleFormPath = $modulePath . '/' . $module . '/application/forms';
|
|
|
|
if (is_dir($moduleFormPath)) {
|
|
|
|
$loader->registerNamespace($moduleNamespace . '\\Form', $moduleFormPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$loader->register();
|
|
|
|
|
|
|
|
require_once 'Zend/Loader/Autoloader.php';
|
|
|
|
\Zend_Loader_Autoloader::getInstance();
|
|
|
|
|
|
|
|
Icinga\Application\Config::$configDir = $configPath;
|