FOSSology  4.4.0
Open Source License Compliance by Open Source Software
agent-spasht.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2019 Vivek Kumar <vvksindia@gmail.com>
4  Author: Vivek Kumar<vvksindia@gmail.com>
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
10 
11 include_once(dirname(__DIR__) . "/agent/version.php");
12 
14 {
15  public function __construct()
16  {
17  $this->Name = "spasht";
18  $this->Title = _("Spasht Analysis");
19  $this->AgentName = "spasht";
20 
21  parent::__construct();
22  }
23 
31  function preInstall()
32  {
33  return false;
34  }
35 
43  public function AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=[],
44  $arguments=null, $request=null, $unpackArgs=null)
45  {
46  $dependencies[] = "agent_adj2nest";
47 
48  $jobQueueId = \IsAlreadyScheduled($jobId, $this->AgentName, $uploadId);
49  if ($jobQueueId != 0) {
50  return $jobQueueId;
51  }
52 
53  $args = is_array($arguments) ? '' : $arguments;
54  return $this->doAgentAdd($jobId, $uploadId, $errorMsg, $dependencies, $uploadId, $args, $request);
55  }
56 
57 
62  function AgentHasResults($uploadId=0)
63  {
64  return CheckARS($uploadId, $this->AgentName, "spasht agent", "spasht_ars");
65  }
66 }
67 
68 register_plugin(new SpashtAgentPlugin());
doAgentAdd($jobId, $uploadId, &$errorMsg, $dependencies, $jqargs="", $jq_cmd_args=null, $request=null)
AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=[], $arguments=null, $request=null, $unpackArgs=null)
AgentHasResults($uploadId=0)
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