FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
These are common functions used by analysis agents. More...
Go to the source code of this file.
Functions | |
AgentCheckBoxMake ($upload_pk, $SkipAgents=array(), $specified_username="") | |
Generate a checkbox list of available agents. More... | |
AgentCheckBoxDo ($job_pk, $upload_pk) | |
Assume someone called AgentCheckBoxMake() and submitted the HTML form. Run AgentAdd() for each of the checked agents. More... | |
AgentSchedule ($jobId, $uploadId, $agents) | |
Schedule all given agents. More... | |
FindDependent ($UploadPk, $list=NULL) | |
Find the jobs in the job and jobqueue table to be dependent on. More... | |
GetAgentKey ($agentName, $agentDesc) | |
Get the latest enabled agent_pk for a given agent. More... | |
LatestAgentpk ($upload_pk, $arsTableName, $arsSuccess=false) | |
Given an upload_pk, find the latest enabled agent_pk with results. More... | |
AgentSelect ($TableName, $upload_pk, $SLName, &$agent_pk, $extra="") | |
userAgents ($agents=null) | |
Read the UI form and format the user selected agents into a comma separated list. More... | |
checkedAgents ($agents=null) | |
read the UI form and return array of user selected agents Because input comes from the user, validate that everything is legitimate. More... | |
listAgents () | |
Search in available plugins and return all agents. More... | |
CheckARS ($upload_pk, $AgentName, $AgentDesc, $AgentARSTableName) | |
Check the ARS table to see if an agent has successfully scanned an upload. More... | |
These are common functions used by analysis agents.
Analysis Agents should register themselves in the menu structure under the top-level "Agents" menu.
Every analysis agent should have a function called "AgentAdd()" that takes an Upload_pk and an optional array of dependent agents ids.
This function should return:
0 = not scheduled
1 = scheduled
2 = completed
Definition in file common-agents.php.
AgentCheckBoxDo | ( | $job_pk, | |
$upload_pk | |||
) |
Assume someone called AgentCheckBoxMake() and submitted the HTML form. Run AgentAdd() for each of the checked agents.
int | $job_pk | Job ID |
int | $upload_pk | Upload ID |
Definition at line 121 of file common-agents.php.
AgentCheckBoxMake | ( | $upload_pk, | |
$SkipAgents = array() , |
|||
$specified_username = "" |
|||
) |
Generate a checkbox list of available agents.
Only agents that are not already scheduled are added. If $upload_pk == -1, then list all. User agent preferences will be checked as long as the agent is not already scheduled.
int | $upload_pk | Upload id |
array | $SkipAgents | Array of agent names to omit from the checkboxes |
string | $specified_username | If not empty, use the specified username instead of username stored in session. |
Definition at line 40 of file common-agents.php.
AgentSchedule | ( | $jobId, | |
$uploadId, | |||
$agents | |||
) |
Schedule all given agents.
int | $jobId | |
int | $uploadId | |
array | $agents | Array of agent plugin, mapped by name as in listAgents() |
Definition at line 137 of file common-agents.php.
AgentSelect | ( | $TableName, | |
$upload_pk, | |||
$SLName, | |||
& | $agent_pk, | ||
$extra = "" |
|||
) |
The purpose of this function is to return a pulldown select list for users to be able to select the dataset results they want to see.
This is for _ars tables only, for example, nomos_ars and bucket_ars. The _ars tables have a standard format with optional agent_fk's named agent_fk2, agent_fk3, ...
string | $TableName | Name of the ars table (e.g. nomos_ars) |
int | $upload_pk | |
string | $SLName | Select list element name |
string | &$agent_pk | Return which agent is selected |
string | $extra | Extra info for the select element, e.g. "onclick=..." |
Definition at line 320 of file common-agents.php.
CheckARS | ( | $upload_pk, | |
$AgentName, | |||
$AgentDesc, | |||
$AgentARSTableName | |||
) |
Check the ARS table to see if an agent has successfully scanned an upload.
int | $upload_pk | The upload will be checked |
string | $AgentName | Agent name, eg "nomos" |
string | $AgentDesc | Agent description, eg "license scanner" |
string | $AgentARSTableName | Agent ars table name, eg "nomos_ars" |
Definition at line 432 of file common-agents.php.
checkedAgents | ( | $agents = null | ) |
read the UI form and return array of user selected agents Because input comes from the user, validate that everything is legitimate.
Definition at line 372 of file common-agents.php.
FindDependent | ( | $UploadPk, | |
$list = NULL |
|||
) |
Find the jobs in the job and jobqueue table to be dependent on.
int | $UploadPk | The upload PK |
array | $list | An optional array of jobs to use instead of all jobs associated with the upload |
Definition at line 157 of file common-agents.php.
GetAgentKey | ( | $agentName, | |
$agentDesc | |||
) |
Get the latest enabled agent_pk for a given agent.
This needs to match the C version of same function in libfossagent This will create an agent record if one doesn't already exist.
string | $agentName | The name of the agent e.g. nomos |
string | $agentDesc | The agent_desc colunm |
Definition at line 223 of file common-agents.php.
LatestAgentpk | ( | $upload_pk, | |
$arsTableName, | |||
$arsSuccess = false |
|||
) |
Given an upload_pk, find the latest enabled agent_pk with results.
int | $upload_pk | Upload id |
string | $arsTableName | Name of ars table to check for the requested agent |
bool | $arsSuccess | Need only success results? |
Definition at line 291 of file common-agents.php.
listAgents | ( | ) |
Search in available plugins and return all agents.
Definition at line 397 of file common-agents.php.
userAgents | ( | $agents = null | ) |
Read the UI form and format the user selected agents into a comma separated list.
Definition at line 361 of file common-agents.php.