FOSSology  4.4.0
Open Source License Compliance by Open Source Software
agent-ninka.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014-2015 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
8 namespace Fossology\Ninka\Ui;
9 
11 
13 {
14  public function __construct() {
15  $this->Name = "agent_ninka";
16  $this->Title = _("Ninka License Analysis");
17  $this->AgentName = "ninka";
18 
19  parent::__construct();
20  }
21 
22  function AgentHasResults($uploadId=0)
23  {
24  return CheckARS($uploadId, $this->AgentName, "ninka agent", "ninka_ars");
25  }
26 
27  function preInstall()
28  {
29  if ($this->isNinkaInstalled()) {
30  menu_insert("Agents::" . $this->Title, 0, $this->Name);
31  }
32  }
33 
34  public function isNinkaInstalled()
35  {
36  exec('which ninka', $lines, $returnVar);
37  return (0==$returnVar);
38  }
39 }
40 
41 register_plugin(new NinkaAgentPlugin());
CheckARS($upload_pk, $AgentName, $AgentDesc, $AgentARSTableName)
Check the ARS table to see if an agent has successfully scanned an upload.
menu_insert($Path, $LastOrder=0, $URI=NULL, $Title=NULL, $Target=NULL, $HTML=NULL)
Given a Path, order level for the last item, and optional plugin name, insert the menu item.