FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
agent-ninka.php
1 <?php
2 /***********************************************************
3  * Copyright (C) 2014-2015, Siemens AG
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * version 2 as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  ***********************************************************/
18 
19 namespace Fossology\Ninka\Ui;
20 
22 
24 {
25  public function __construct() {
26  $this->Name = "agent_ninka";
27  $this->Title = _("Ninka License Analysis");
28  $this->AgentName = "ninka";
29 
30  parent::__construct();
31  }
32 
33  function AgentHasResults($uploadId=0)
34  {
35  return CheckARS($uploadId, $this->AgentName, "ninka agent", "ninka_ars");
36  }
37 
38  function preInstall()
39  {
40  if ($this->isNinkaInstalled()) {
41  menu_insert("Agents::" . $this->Title, 0, $this->Name);
42  }
43  }
44 
45  public function isNinkaInstalled()
46  {
47  exec('which ninka', $lines, $returnVar);
48  return (0==$returnVar);
49  }
50 }
51 
52 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...