diff --git a/CHANGELOG.md b/CHANGELOG.md index cedd3fd2f0..b37064b2c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/protected/humhub/components/bootstrap/ModuleAutoLoader.php b/protected/humhub/components/bootstrap/ModuleAutoLoader.php index c56775a724..b717b4cd59 100644 --- a/protected/humhub/components/bootstrap/ModuleAutoLoader.php +++ b/protected/humhub/components/bootstrap/ModuleAutoLoader.php @@ -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); }