33 public function __construct() {
34 $this->Name =
"agent_adj2nest";
35 $this->Title =
'adj2nest';
36 $this->AgentName =
"adj2nest";
38 parent::__construct();
47 $dbManager = $GLOBALS[
'container']->get(
'db.manager');
50 if (NULL == $uploadtree_tablename) strcpy($uploadtree_tablename,
"uploadtree");
53 $uploadtreeRec = $dbManager->getSingleRow(
"SELECT * FROM $uploadtree_tablename WHERE upload_fk=$1 and lft is not null",
54 array($uploadId),__METHOD__.
'.lftNotSet');
55 if (empty($uploadtreeRec))
60 $stmt = __METHOD__.$uploadtree_tablename;
61 $sql =
"SELECT parent,lft FROM $uploadtree_tablename WHERE upload_fk=$1 ORDER BY parent, ufile_mode&(1<<29) DESC, ufile_name";
62 $dbManager->prepare($stmt,$sql);
63 $res=$dbManager->execute($stmt,array($uploadId));
64 $prevRow = array(
'parent'=>0,
'lft'=>0);
66 while($row=$dbManager->fetchArray($res))
68 $wrongOrder = $prevRow[
'parent']==$row[
'parent'] && $prevRow[
'lft']>$row[
'lft'];
74 $dbManager->freeResult($res);
75 return $wrongOrder ? 2 : 1;
82 public function AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=array(), $arguments=null, $unpackArgs=null)
96 $dependencies[] = array(
'name' =>
"agent_unpack",
'args' => $unpackArgs);
98 $args = is_array($arguments) ?
'' : $arguments;
99 return $this->
doAgentAdd($jobId, $uploadId, $errorMsg, $dependencies, $uploadId, $args);
110 foreach($dependencies as $dependency)
112 if ($dependency == $agentName)
116 if (is_array($dependency) && $agentName == $dependency[
'name'])
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"...
IsAlreadyScheduled($job_pk, $AgentName, $upload_pk)
Check if an agent is already scheduled in a job.
isAgentIncluded($dependencies, $agentName)
AgentHasResults($uploadId=0)
AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=array(), $arguments=null, $unpackArgs=null)
doAgentAdd($jobId, $uploadId, &$errorMsg, $dependencies, $jqargs="", $jq_cmd_args=null)