FOSSology  4.4.0
Open Source License Compliance by Open Source Software
agent-ecc.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014-2015 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
9 
15 {
16  public function __construct()
17  {
18  $this->Name = "agent_ecc";
19  $this->Title = _("ECC Analysis, scanning for text fragments potentially relevant for export control");
20  $this->AgentName = "ecc";
21 
22  parent::__construct();
23  }
24 
29  function AgentHasResults($uploadId=0)
30  {
31  return CheckARS($uploadId, $this->AgentName, "ecc scanner", "ecc_ars");
32  }
33 
38  public function AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=array(), $arguments=null)
39  {
40  $unpackArgs = intval(@$_POST['scm']) == 1 ? '-I' : '';
41  if ($this->AgentHasResults($uploadId) == 1) {
42  return 0;
43  }
44 
45  $jobQueueId = \IsAlreadyScheduled($jobId, $this->AgentName, $uploadId);
46  if ($jobQueueId != 0) {
47  return $jobQueueId;
48  }
49 
50  $args = $unpackArgs;
51  if (!empty($unpackArgs)) {
52  return $this->doAgentAdd($jobId, $uploadId, $errorMsg, array("agent_mimetype"),$uploadId,$args);
53  } else {
54  return $this->doAgentAdd($jobId, $uploadId, $errorMsg, array("agent_adj2nest"), $uploadId);
55  }
56  }
57 
64  protected function isAgentIncluded($dependencies, $agentName)
65  {
66  foreach ($dependencies as $dependency) {
67  if ($dependency == $agentName) {
68  return true;
69  }
70  if (is_array($dependency) && $agentName == $dependency['name']) {
71  return true;
72  }
73  }
74  return false;
75  }
76 }
77 
78 register_plugin(new EccAgentPlugin());
Create UI plugin for ECC agent.
Definition: agent-ecc.php:15
isAgentIncluded($dependencies, $agentName)
Definition: agent-ecc.php:64
AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=array(), $arguments=null)
Definition: agent-ecc.php:38
AgentHasResults($uploadId=0)
Definition: agent-ecc.php:29
doAgentAdd($jobId, $uploadId, &$errorMsg, $dependencies, $jqargs="", $jq_cmd_args=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.
Definition: common-job.php:378