FOSSology  4.4.0
Open Source License Compliance by Open Source Software
DeciderJobAgentPlugin.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014-2015 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
12 namespace Fossology\DeciderJob\UI;
13 
15 
16 include_once(__DIR__ . "/../agent/version.php");
17 
23 {
24  const CONFLICT_STRATEGY_FLAG = "-k";
25 
26  function __construct()
27  {
28  $this->Name = "agent_deciderjob";
29  $this->Title = _("Automatic User License Decider");
30  $this->AgentName = AGENT_DECIDER_JOB_NAME;
31 
32  parent::__construct();
33  }
34 
39  function preInstall()
40  {
41  // no menu entry
42  }
43 
48  public function AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=[],
49  $arguments=null, $request=null, $unpackArgs=null)
50  {
51  $dependencies[] = "agent_adj2nest";
52 
53  $jobQueueId = \IsAlreadyScheduled($jobId, $this->AgentName, $uploadId);
54  if ($jobQueueId != 0) {
55  return $jobQueueId;
56  }
57 
58  $args = ($arguments !== null) ? $this::CONFLICT_STRATEGY_FLAG.$arguments : '';
59 
60  return $this->doAgentAdd($jobId, $uploadId, $errorMsg, $dependencies,
61  $uploadId, $args, $request);
62  }
63 }
64 
65 register_plugin(new DeciderJobAgentPlugin());
AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=[], $arguments=null, $request=null, $unpackArgs=null)
doAgentAdd($jobId, $uploadId, &$errorMsg, $dependencies, $jqargs="", $jq_cmd_args=null, $request=null)
IsAlreadyScheduled($job_pk, $AgentName, $upload_pk)
Check if an agent is already scheduled in a job.
Definition: common-job.php:378
DeciderJobAgent's UI.