22 public function __construct() {
23 $this->Name =
"agent_adj2nest";
24 $this->Title =
'adj2nest';
25 $this->AgentName =
"adj2nest";
27 parent::__construct();
36 $dbManager = $GLOBALS[
'container']->get(
'db.manager');
39 if (NULL == $uploadtree_tablename) strcpy($uploadtree_tablename,
"uploadtree");
42 $uploadtreeRec = $dbManager->getSingleRow(
"SELECT * FROM $uploadtree_tablename WHERE upload_fk=$1 and lft is not null",
43 array($uploadId),__METHOD__.
'.lftNotSet');
44 if (empty($uploadtreeRec))
49 $stmt = __METHOD__.$uploadtree_tablename;
50 $sql =
"SELECT parent,lft FROM $uploadtree_tablename WHERE upload_fk=$1 ORDER BY parent, ufile_mode&(1<<29) DESC, ufile_name";
51 $dbManager->prepare($stmt,$sql);
52 $res=$dbManager->execute($stmt,array($uploadId));
53 $prevRow = array(
'parent'=>0,
'lft'=>0);
55 while($row=$dbManager->fetchArray($res))
57 $wrongOrder = $prevRow[
'parent']==$row[
'parent'] && $prevRow[
'lft']>$row[
'lft'];
63 $dbManager->freeResult($res);
64 return $wrongOrder ? 2 : 1;
71 public function AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=[],
72 $arguments=
null, $request=
null, $unpackArgs=
null)
86 $dependencies[] = array(
'name' =>
"agent_unpack",
'args' => $unpackArgs);
88 $args = is_array($arguments) ?
'' : $arguments;
89 return $this->
doAgentAdd($jobId, $uploadId, $errorMsg, $dependencies,
90 $uploadId, $args, $request);
101 foreach($dependencies as $dependency)
103 if ($dependency == $agentName)
107 if (is_array($dependency) && $agentName == $dependency[
'name'])
isAgentIncluded($dependencies, $agentName)
AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=[], $arguments=null, $request=null, $unpackArgs=null)
AgentHasResults($uploadId=0)
doAgentAdd($jobId, $uploadId, &$errorMsg, $dependencies, $jqargs="", $jq_cmd_args=null, $request=null)
IsAlreadyScheduled($job_pk, $AgentName, $upload_pk)
Check if an agent is already scheduled in a job.
FUNCTION char * GetUploadtreeTableName(PGconn *pgConn, int upload_pk)
Get the uploadtree table name for this upload_pk If upload_pk does not exist, return "uploadtree".