FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
agent-demomod.php
Go to the documentation of this file.
1 <?php
2 /***********************************************************
3  Copyright (C) 2013 Hewlett-Packard Development Company, L.P.
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 
24 define("TITLE_AGENT_DEMOMOD", _("Demomod scanner"));
25 
30 class agent_demomod extends FO_Plugin {
31 
32  public $Name = "agent_demomod";
33  public $Title = TITLE_AGENT_DEMOMOD;
34  public $Version = "1.0";
35  public $Dependency = array();
37  public $AgentName = "demomod";
38 
39 
43  function RegisterMenus()
44  {
45  if ($this->State != PLUGIN_STATE_READY) { return (0); // don't run
46  }
47  menu_insert("Agents::" . $this->Title, 0, $this->Name);
48  }
49 
50 
61  function AgentHasResults($upload_pk)
62  {
63  return CheckARS($upload_pk, $this->AgentName, "demonstration module scanner", "demomod_ars");
64  } // AgentHasResults()
65 
66 
85  function AgentAdd($job_pk, $upload_pk, &$ErrorMsg, $Dependencies)
86  {
87  $Dependencies[] = "agent_adj2nest";
88  return CommonAgentAdd($this, $job_pk, $upload_pk, $ErrorMsg, $Dependencies);
89  } // AgentAdd()
90 }
91 
92 $NewPlugin = new agent_demomod;
93 
$DBaccess
DB access required.
AgentAdd($job_pk, $upload_pk, &$ErrorMsg, $Dependencies)
Queue the demomod agent.
$Name
Mod name.
CommonAgentAdd($plugin, $job_pk, $upload_pk, &$ErrorMsg, $Dependencies, $jqargs="", $jq_cmd_args=NULL)
Queue an agent. This is a simple version of AgentAdd() that can be used by multiple plugins that only...
Definition: common-job.php:435
RegisterMenus()
Register additional menus.
Definition: state.hpp:26
UI plugin for demomod (handle user requests)
$Title
Page title.
CheckARS($upload_pk, $AgentName, $AgentDesc, $AgentARSTableName)
Check the ARS table to see if an agent has successfully scanned an upload.
#define PLUGIN_DB_WRITE
Plugin requires write permission on DB.
Definition: libfossology.h:50
This is the Plugin class. All plugins should:
Definition: FO_Plugin.php:67
$Dependency
Dependecy for plugin.
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...
$AgentName
agent.agent_name
$Version
Plugin versin.
AgentHasResults($upload_pk)
Check if the upload has already been successfully scanned.