8 namespace Fossology\Compatibility\Ui;
11 use Symfony\Component\HttpFoundation\Request;
13 define(
"AGENT_COMPATIBILITY_NAME",
"compatibility");
18 private $compDesc =
"Checks licenses found in a file and main license and " .
19 "adds red highlight to tree view if licenses fail compatibility rules";
21 public function __construct()
23 $this->Name =
"agent_compatibility";
24 $this->Title = _(
"Compatibility License Analysis, scanning for licenses " .
25 "compatibility <img src=\"images/info_16.png\" data-toggle=\"tooltip\"" .
26 " title=\"".$this->compDesc.
"\" class=\"info-bullet\"/>");
27 $this->AgentName = AGENT_COMPATIBILITY_NAME;
29 parent::__construct();
32 public function AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies = [],
33 $arguments =
null, $request =
null, $unpackArgs =
null)
39 $compatibilityDependencies = array(
"agent_adj2nest");
41 if ($request ==
null) {
44 $compatibilityDependencies = array_merge($compatibilityDependencies,
48 if ($jobQueueId != 0) {
52 return $this->
doAgentAdd($jobId, $uploadId, $errorMsg,
53 array_unique($compatibilityDependencies), $arguments,
null, $request);
58 return CheckARS($uploadId, $this->AgentName,
"compatibility agent",
"compatibility_ars");
67 $dependencies = array();
68 if (is_object($request)) {
70 $postEmulate[
"Check_agent_nomos"] = intval($request->get(
71 "Check_agent_nomos", 0));
72 $postEmulate[
"Check_agent_monk"] = intval($request->get(
73 "Check_agent_monk", 0));
74 $postEmulate[
"Check_agent_ojo"] = intval($request->get(
75 "Check_agent_ojo", 0));
76 $postEmulate[
"Check_agent_ninka"] = intval($request->get(
77 "Check_agent_ninka", 0));
78 $request = $postEmulate;
80 if (array_key_exists(
"Check_agent_nomos", $request) && $request[
"Check_agent_nomos"] == 1) {
81 $dependencies[] =
"agent_nomos";
83 if (array_key_exists(
"Check_agent_monk", $request) && $request[
"Check_agent_monk"] == 1) {
84 $dependencies[] =
"agent_monk";
86 if (array_key_exists(
"Check_agent_ojo", $request) && $request[
"Check_agent_ojo"] == 1) {
87 $dependencies[] =
"agent_ojo";
89 if (array_key_exists(
"Check_agent_ninka", $request) && $request[
"Check_agent_ninka"] == 1) {
90 $dependencies[] =
"agent_ninka";
97 register_plugin(
new CompatibilityAgentPlugin());
AgentHasResults($uploadId=0)
getCompatibilityDependencies($request)
AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=[], $arguments=null, $request=null, $unpackArgs=null)
doAgentAdd($jobId, $uploadId, &$errorMsg, $dependencies, $jqargs="", $jq_cmd_args=null, $request=null)
CheckARS($upload_pk, $AgentName, $AgentDesc, $AgentARSTableName)
Check the ARS table to see if an agent has successfully scanned an upload.
IsAlreadyScheduled($job_pk, $AgentName, $upload_pk)
Check if an agent is already scheduled in a job.