10 use Symfony\Component\HttpFoundation\Request;
12 include_once(__DIR__ .
"/../agent/version.php");
20 const RULES_FLAG =
"-r";
22 function __construct()
24 $this->Name =
"agent_decider";
25 $this->Title = _(
"Automatic Concluded License Decider, based on scanners Matches");
26 $this->AgentName = AGENT_DECIDER_NAME;
28 parent::__construct();
40 $renderer = $GLOBALS[
'container']->get(
'twig.environment');
41 $vars[
'isNinkaInstalled'] =
false;
43 $vars[
'isNinkaInstalled'] = $ninkaUi->isNinkaInstalled();
45 $vars[
'isSpacyInstalled'] = file_exists(
"/home/" .
46 $SysConf[
'DIRECTORIES'][
'PROJECTUSER'] .
"/pythondeps/bin/spacy");
47 return $renderer->load(
'agent_decider.html.twig')->render($vars);
70 $dependencies = array();
72 $rules = $request->get(
'deciderRules') ?: array();
73 $agents = $request->get(
'agents') ?: array();
74 if (in_array(
'agent_nomos', $agents)) {
75 $checkAgentNomos =
true;
77 $checkAgentNomos = $request->get(
'Check_agent_nomos') ?:
false;
80 if (in_array(
'agent_copyright', $agents)) {
81 $checkAgentCopyright =
true;
83 $checkAgentCopyright = $request->get(
'Check_agent_copyright') ?:
false;
87 foreach ($rules as $rule) {
90 $dependencies[] =
'agent_nomos';
91 $dependencies[] =
'agent_monk';
94 case 'nomosMonkNinka':
95 $dependencies[] =
'agent_nomos';
96 $dependencies[] =
'agent_monk';
97 $dependencies[] =
'agent_ninka';
101 $dependencies[] =
'agent_nomos';
102 $dependencies[] =
'agent_monk';
103 $dependencies[] =
'agent_reuser';
106 case 'ojoNoContradiction':
107 if ($checkAgentNomos) {
108 $dependencies[] =
'agent_nomos';
110 $dependencies[] =
'agent_ojo';
113 case 'wipScannerUpdates':
117 case 'copyrightDeactivation':
118 if ($checkAgentCopyright) {
119 $dependencies[] =
'agent_copyright';
123 case 'copyrightDeactivationClutterRemoval':
124 if ($checkAgentCopyright) {
125 $dependencies[] =
'agent_copyright';
132 if (empty($rulebits)) {
136 $args = self::RULES_FLAG.$rulebits;
137 return parent::AgentAdd($jobId, $uploadId, $errorMsg, array_unique($dependencies), $args);
147 $agentList = $request->get(
'agents') ?: array();
148 foreach (array(
'agent_nomos',
'agent_monk',
'agent_ninka') as $agentName) {
149 if (in_array($agentName, $dependencies)) {
152 if ($request->get(
'Check_'.$agentName)) {
153 $dependencies[] = $agentName;
156 if (in_array($agentName, $agentList)) {
157 $dependencies[] = $agentName;
168 menu_insert(
"ParmAgents::" . $this->Title, 0, $this->Name);
UI plugin for DeciderAgent.
renderFoot(&$vars)
Render footer HTML.
addScannerDependencies(&$dependencies, Request $request)
Add dependencies on DeciderAgent.
scheduleAgent($jobId, $uploadId, &$errorMsg, $request)
Schedule decider agent.
renderContent(&$vars)
Render HTML from template.
plugin_find($pluginName)
Given the official name of a plugin, return the $Plugins object.