Skip to content

Commit

Permalink
✨ Adding id to the dependencies_file tpl
Browse files Browse the repository at this point in the history
  • Loading branch information
intraordinaire committed Mar 10, 2023
1 parent d54a753 commit 3972faf
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/DependencyBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 3972faf

Please sign in to comment.