Prevent double module registration (#4804)

Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
This commit is contained in:
Yuriy Bakhtin 2021-01-29 17:47:15 +03:00 committed by GitHub
parent 14c7fc5428
commit 286b2cc7b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -6,6 +6,7 @@ HumHub Changelog
- Fix #4792: Guest access to user profile home page
- Fix #4794: CountrySelect profile field broken
- Fix #4793: Form labels (HForm) are not displayed correctly
- Fix #4569: Prevent double module registration
- Fix #4389: Require to check a checkbox if the profile field is required

View File

@ -70,10 +70,17 @@ class ModuleAutoLoader implements BootstrapInterface
}
$modules = [];
$moduleIdFolders = [];
foreach ($folders as $folder) {
try {
/** @noinspection PhpIncludeInspection */
$modules[$folder] = require $folder . DIRECTORY_SEPARATOR . self::CONFIGURATION_FILE;
$moduleConfig = require $folder . DIRECTORY_SEPARATOR . self::CONFIGURATION_FILE;
if (isset($moduleIdFolders[$moduleConfig['id']])) {
Yii::error('Duplicated module "' . $moduleConfig['id'] . '"(' . $folder . ') is already loaded from the folder "' . $moduleIdFolders[$moduleConfig['id']] . '"');
} else {
$modules[$folder] = $moduleConfig;
$moduleIdFolders[$moduleConfig['id']] = $folder;
}
} catch (\Throwable $e) {
Yii::error($e);
}