mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-05-03 06:10:18 +02:00
tests: Load external libraries
This commit is contained in:
parent
47922673fc
commit
06d03dc21f
@ -41,6 +41,34 @@ $loader->registerNamespace('Tests', $testLibraryPath);
|
|||||||
$loader->registerNamespace('Icinga', $icingaLibPath);
|
$loader->registerNamespace('Icinga', $icingaLibPath);
|
||||||
$loader->registerNamespace('Icinga\\Forms', $applicationPath . '/forms');
|
$loader->registerNamespace('Icinga\\Forms', $applicationPath . '/forms');
|
||||||
|
|
||||||
|
$libraryPaths = getenv('ICINGAWEB_LIBDIR');
|
||||||
|
if ($libraryPaths !== false) {
|
||||||
|
$libraryPaths = array_filter(array_map(
|
||||||
|
'realpath',
|
||||||
|
explode(':', $libraryPaths)
|
||||||
|
), 'is_dir');
|
||||||
|
} else {
|
||||||
|
$libraryPaths = is_dir('/usr/share/icinga-php')
|
||||||
|
? ['/usr/share/icinga-php']
|
||||||
|
: [];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($libraryPaths as $externalLibraryPath) {
|
||||||
|
$libPaths = array_flip(scandir($externalLibraryPath));
|
||||||
|
unset($libPaths['.']);
|
||||||
|
unset($libPaths['..']);
|
||||||
|
$libPaths = array_keys($libPaths);
|
||||||
|
foreach ($libPaths as $libPath) {
|
||||||
|
$libPath = join(DIRECTORY_SEPARATOR, [$externalLibraryPath, $libPath]);
|
||||||
|
if (is_dir(realpath($libPath))) {
|
||||||
|
$libAutoLoader = join(DIRECTORY_SEPARATOR, [$libPath, 'vendor', 'autoload.php']);
|
||||||
|
if (file_exists($libAutoLoader)) {
|
||||||
|
require_once $libAutoLoader;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$modulePaths = getenv('ICINGAWEB_MODULE_DIRS');
|
$modulePaths = getenv('ICINGAWEB_MODULE_DIRS');
|
||||||
|
|
||||||
if ($modulePaths) {
|
if ($modulePaths) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user