FOSSology  4.4.0
Open Source License Compliance by Open Source Software
agent-pkgagent.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2009-2013 Hewlett-Packard Development Company, L.P.
4  SPDX-FileCopyrightText: © 2015 Siemens AG
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
10 
20 {
22  private $pkgagentDesc = "Parse package headers. for example if files are rpm package listed, display their package information";
23 
24  public function __construct() {
25  $this->Name = "agent_pkgagent";
26  $this->Title = _("Package Analysis <img src=\"images/info_16.png\" data-toggle=\"tooltip\" title=\"".$this->pkgagentDesc."\" class=\"info-bullet\"/>");
27  $this->AgentName = "pkgagent";
28 
29  parent::__construct();
30  }
31 
36  function AgentHasResults($uploadId=0)
37  {
38  return CheckARS($uploadId, $this->AgentName, "package meta data scanner", "pkgagent_ars");
39  }
40 
45  function preInstall()
46  {
47  $dbManager = $GLOBALS['container']->get('db.manager');
48  $latestPkgAgent = $dbManager->getSingleRow("SELECT agent_enabled FROM agent WHERE agent_name=$1 ORDER BY agent_ts LIMIT 1",array('pkgagent'));
49  if (!empty($latestPkgAgent) && !$dbManager->booleanFromDb($latestPkgAgent['agent_enabled']))
50  {
51  return 0;
52  }
53  menu_insert("Agents::" . $this->Title, 0, $this->Name);
54  }
55 
56 }
57 
58 register_plugin(new PkgAgentPlugin());
UI plugin of pkgagent.
AgentHasResults($uploadId=0)
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.