fix: add support of module name aliases in the router
This commit is contained in:
parent
7a34d841cc
commit
abd4773e16
1 changed files with 7 additions and 5 deletions
|
@ -29,12 +29,14 @@ function generateHelp($selectedModule) {
|
||||||
$modules = $config['modules'];
|
$modules = $config['modules'];
|
||||||
$selectedModule = null;
|
$selectedModule = null;
|
||||||
|
|
||||||
foreach ($modules as $key => $module) {
|
foreach ($modules as $moduleName => $module) {
|
||||||
if (strpos($_SERVER['HTTP_HOST'], $key . '.') === 0) {
|
foreach (array_merge([$moduleName], $module['alias'] ?? []) as $alias) {
|
||||||
|
if (strpos($_SERVER['HTTP_HOST'], $alias . '.') === 0) {
|
||||||
$selectedModule = $module;
|
$selectedModule = $module;
|
||||||
$selectedModule['key'] = $key;
|
$selectedModule['key'] = $moduleName;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($selectedModule === null) {
|
if ($selectedModule === null) {
|
||||||
|
|
Loading…
Reference in a new issue