FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
agent-pkgagent.php
Go to the documentation of this file.
1 <?php
2 /***********************************************************
3  Copyright (C) 2009-2013 Hewlett-Packard Development Company, L.P.
4  Copyright (C) 2015, Siemens AG
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  version 2 as published by the Free Software Foundation.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  ***********************************************************/
19 
21 
31 {
32  public function __construct() {
33  $this->Name = "agent_pkgagent";
34  $this->Title = _("Package Analysis (Parse package headers)");
35  $this->AgentName = "pkgagent";
36 
37  parent::__construct();
38  }
39 
44  function AgentHasResults($uploadId=0)
45  {
46  return CheckARS($uploadId, $this->AgentName, "package meta data scanner", "pkgagent_ars");
47  }
48 
53  function preInstall()
54  {
55  $dbManager = $GLOBALS['container']->get('db.manager');
56  $latestPkgAgent = $dbManager->getSingleRow("SELECT agent_enabled FROM agent WHERE agent_name=$1 ORDER BY agent_ts LIMIT 1",array('pkgagent'));
57  if (isset($latestPkgAgent) && !$dbManager->booleanFromDb($latestPkgAgent['agent_enabled']))
58  {
59  return 0;
60  }
61  menu_insert("Agents::" . $this->Title, 0, $this->Name);
62  }
63 
64 }
65 
66 register_plugin(new PkgAgentPlugin());
UI plugin of pkgagent.
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...
AgentHasResults($uploadId=0)