fix: add support of module name aliases in the router

This commit is contained in:
Matthieu Bessat 2021-08-08 20:29:34 +02:00
parent 7a34d841cc
commit abd4773e16

View file

@ -29,12 +29,14 @@ function generateHelp($selectedModule) {
$modules = $config['modules'];
$selectedModule = null;
foreach ($modules as $key => $module) {
if (strpos($_SERVER['HTTP_HOST'], $key . '.') === 0) {
foreach ($modules as $moduleName => $module) {
foreach (array_merge([$moduleName], $module['alias'] ?? []) as $alias) {
if (strpos($_SERVER['HTTP_HOST'], $alias . '.') === 0) {
$selectedModule = $module;
$selectedModule['key'] = $key;
$selectedModule['key'] = $moduleName;
break;
}
}
}
if ($selectedModule === null) {