22 include_once(__DIR__ .
"/../agent/version.php");
30 const RULES_FLAG =
"-r";
32 function __construct()
34 $this->Name =
"agent_decider";
35 $this->Title = _(
"Automatic Concluded License Decider, based on scanners Matches");
36 $this->AgentName = AGENT_DECIDER_NAME;
38 parent::__construct();
49 $renderer = $GLOBALS[
'container']->get(
'twig.environment');
50 $vars[
'isNinkaInstalled'] =
false;
52 $vars[
'isNinkaInstalled'] = $ninkaUi->isNinkaInstalled();
54 return $renderer->loadTemplate(
'agent_decider.html.twig')->render($vars);
77 $dependencies = array();
79 $rules = $request->get(
'deciderRules') ?: array();
80 $agents = $request->get(
'agents') ?: array();
81 if (in_array(
'agent_nomos', $agents)) {
82 $checkAgentNomos =
true;
84 $checkAgentNomos = $request->get(
'Check_agent_nomos') ?:
false;
88 foreach ($rules as $rule) {
91 $dependencies[] =
'agent_nomos';
92 $dependencies[] =
'agent_monk';
95 case 'nomosMonkNinka':
96 $dependencies[] =
'agent_nomos';
97 $dependencies[] =
'agent_monk';
98 $dependencies[] =
'agent_ninka';
102 $dependencies[] =
'agent_nomos';
103 $dependencies[] =
'agent_monk';
104 $dependencies[] =
'agent_reuser';
107 case 'ojoNoContradiction':
108 if ($checkAgentNomos) {
109 $dependencies[] =
'agent_nomos';
111 $dependencies[] =
'agent_ojo';
114 case 'wipScannerUpdates':
120 if (empty($rulebits)) {
124 $args = self::RULES_FLAG.$rulebits;
125 return parent::AgentAdd($jobId, $uploadId, $errorMsg, array_unique($dependencies), $args);
135 $agentList = $request->get(
'agents') ?: array();
136 foreach (array(
'agent_nomos',
'agent_monk',
'agent_ninka') as $agentName) {
137 if (in_array($agentName, $dependencies)) {
140 if ($request->get(
'Check_'.$agentName)) {
141 $dependencies[] = $agentName;
144 if (in_array($agentName, $agentList)) {
145 $dependencies[] = $agentName;
156 menu_insert(
"ParmAgents::" . $this->Title, 0, $this->Name);
addScannerDependencies(&$dependencies, Request $request)
Add dependencies on DeciderAgent.
UI plugin for DeciderAgent.
renderContent(&$vars)
Render HTML from template.
plugin_find($pluginName)
Given the official name of a plugin, return the $Plugins object.
renderFoot(&$vars)
Render footer HTML.
scheduleAgent($jobId, $uploadId, &$errorMsg, $request)
Schedule decider agent.