37 const NAME =
"upload_agent_options";
39 public function __construct()
41 parent::__construct(self::NAME, array(
42 self::TITLE => _(
"List Agents for an Upload as Options"),
56 $sql =
"select count(*) from job inner join jobqueue on job_pk=jq_job_fk " 57 .
"where job_upload_fk=$1 and jq_endtext is null and jq_type=$2";
58 $queued = $GLOBALS[
'container']->get(
'db.manager')->getSingleRow($sql,array($uploadId,$agentName));
59 return $queued[
'count']==0;
62 protected function handle(Request $request)
64 $uploadId = intval($request->get(
"upload"));
65 if (empty($uploadId)) {
66 throw new Exception(
'missing upload id');
69 $parmAgentList = MenuHook::getAgentPluginNames(
"ParmAgents");
70 $plainAgentList = MenuHook::getAgentPluginNames(
"Agents");
71 $agentList = array_merge($plainAgentList, $parmAgentList);
72 $skipAgents = array(
"agent_unpack",
"wget_agent");
74 $relevantAgents = array();
75 foreach ($agentList as $agent) {
76 if (array_search($agent, $skipAgents) !==
false) {
80 if (($plugin->AgentHasResults($uploadId) != 1) &&
82 $out .=
"<option value='" . $agent .
"'>";
83 $out .= htmlentities($plugin->Title);
84 $out .=
"</option>\n";
85 $relevantAgents[$agent] = $plugin->Title;
89 $out =
'<select multiple size="10" id="agents" name="agents[]">' .$out.
'</select>';
90 return new Response($out, Response::HTTP_OK, array(
'Content-Type'=>
'text/plain'));
jobNotYetScheduled($agentName, $uploadId)
This function checks if the current job was not already scheduled, or did already fail (You can resch...
plugin_find($pluginName)
Given the official name of a plugin, return the $Plugins object.
#define PERM_READ
Read-only permission.