Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Sep 6, 2022
1 parent 623af5c commit 4633c02
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions modules/setup/library/Setup/ModuleDependency.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,25 @@

class ModuleDependency
{
/**
* @var Module The given Module
*/
/** @var Module The given Module */
protected $module;

/**
* @var array The chosen modules
*/
/** @var array The chosen modules */
protected $checkedModules;

/**
* @param Module $module The given module
*
* @param array $checkedModules The checked modules from module page
*/
public function __construct(Module $module, array $checkedModules)
{
$this->module = $module;
$this->checkedModules = $checkedModules;
}

/** Get the module dependency requirements
/**
* Get the module dependency requirements
*
* @return RequirementSet
*/
Expand Down Expand Up @@ -59,7 +61,7 @@ public function getRequirements()
}

if (! empty($icingadbAndMonitoring)) {
$icingadbOrmonitoring = new RequirementSet(false, RequirementSet::MODE_OR);
$icingadbOrMonitoring = new RequirementSet(false, RequirementSet::MODE_OR);
foreach ($icingadbAndMonitoring as $name => $requiredVersion) {
$options = [
'alias' => $name,
Expand All @@ -72,20 +74,20 @@ public function getRequirements()
];

if (! in_array($name, $this->checkedModules)) {
$icingadbOrmonitoring->add((new ModuleMissingRequirement($options)));
$icingadbOrMonitoring->add((new ModuleMissingRequirement($options)));
} else {
$options['condition'] = [$name, $requiredVersion];
$icingadbOrmonitoring->add(new WebModuleRequirement($options));
$icingadbOrMonitoring->add(new WebModuleRequirement($options));
}
}

$set->merge($icingadbOrmonitoring);
$set->merge($icingadbOrMonitoring);

$requirement = (new SetRequirement([
'title' =>'Base Module',
'alias' => 'Monitoring OR Icingadb',
'optional' => false,
'condition' => $icingadbOrmonitoring,
'condition' => $icingadbOrMonitoring,
'description' => t('Module Monitoring OR Icingadb is required.')
]));

Expand Down

0 comments on commit 4633c02

Please sign in to comment.