diff --git a/src/DependencyBuilder.php b/src/DependencyBuilder.php index d7179b8..30574a3 100644 --- a/src/DependencyBuilder.php +++ b/src/DependencyBuilder.php @@ -153,18 +153,21 @@ protected function buildDependenciesContext() } if ($this->isMboNeeded() && !isset($dependenciesContent['dependencies'][Installer::MODULE_NAME])) { - $dependenciesContent['dependencies'][] = Installer::MODULE_NAME; + $dependenciesContent['dependencies'][] = [ + 'name' => Installer::MODULE_NAME, + 'id' => Installer::MODULE_ID, + ]; } - foreach ($dependenciesContent['dependencies'] as $dependencyName) { - $dependencyData = \DbCore::getInstance()->getRow('SELECT `id_module`, `active`, `version` FROM `' . _DB_PREFIX_ . 'module` WHERE `name` = "' . pSQL((string) $dependencyName) . '"'); + foreach ($dependenciesContent['dependencies'] as $dependency) { + $dependencyData = \DbCore::getInstance()->getRow('SELECT `id_module`, `active`, `version` FROM `' . _DB_PREFIX_ . 'module` WHERE `name` = "' . pSQL((string) $dependency['name']) . '"'); - $data['dependencies'][$dependencyName] = $this->buildRoutesForModule($dependencyName); + $data['dependencies'][$dependency['name']] = array_merge($dependency, $this->buildRoutesForModule($dependency['name'])); if (!$dependencyData) { - $data['dependencies'][$dependencyName]['installed'] = false; + $data['dependencies'][$dependency['name']]['installed'] = false; continue; } - $data['dependencies'][$dependencyName] = array_merge($data['dependencies'][$dependencyName], [ + $data['dependencies'][$dependency['name']] = array_merge($data['dependencies'][$dependency['name']], [ 'installed' => true, 'enabled' => isset($dependencyData['active']) && (bool) $dependencyData['active'], 'current_version' => isset($dependencyData['version']) ? $dependencyData['version'] : null, @@ -237,6 +240,8 @@ protected function addMboInDependencies() 'current_version' => (string) $mboStatus['version'], 'installed' => (bool) $mboStatus['isInstalled'], 'enabled' => false, + 'id' => Installer::MODULE_ID, + 'name' => Installer::MODULE_NAME, ], $mboRoutes); }