/** * \brief Queue the unpack and adj2nest agents. * Before queuing, check if agent needs to be queued. It doesn't need to be queued if: * - It is already queued * - It has already been run by the latest agent version * * \param $job_pk * \param $upload_pk * \param $ErrorMsg - error message on failure * \param $Dependencies - array of plugin names representing dependencies. * This is for dependencies that this plugin cannot know about ahead of time. * * \returns * - jq_pk Successfully queued * - 0 Not queued, latest version of agent has previously run successfully * - -1 Not queued, error, error string in $ErrorMsg **/ function AgentAdd($job_pk, $upload_pk, &$ErrorMsg, $Dependencies) { return CommonAgentAdd($this, $job_pk, $upload_pk, $ErrorMsg, $Dependencies); }
/** * \brief Queue the copyright agent. * Before queuing, check if agent needs to be queued. It doesn't need to be queued if: * - It is already queued * - It has already been run by the latest agent version * * \param $job_pk * \param $upload_pk * \param $ErrorMsg - error message on failure * \param $Dependencies - array of plugin names representing dependencies. * This is for dependencies that this plugin cannot know about ahead of time. * * \returns * - jq_pk Successfully queued * - 0 Not queued, latest version of agent has previously run successfully * - -1 Not queued, error, error string in $ErrorMsg **/ function AgentAdd($job_pk, $upload_pk, &$ErrorMsg, $Dependencies) { $Dependencies[] = "agent_adj2nest"; return CommonAgentAdd($this, $job_pk, $upload_pk, $ErrorMsg, $Dependencies); }
/** * \brief Queue the bucket agent. * * \param $job_pk * \param $upload_pk - upload_pk * \param $ErrorMsg - error message on failure * \param $Dependencies - array of plugin names representing dependencies. * This is for dependencies that this plugin cannot know about ahead of time. * * \returns * - jq_pk Successfully queued * - 0 Not queued, latest version of agent has previously run successfully * - -1 Not queued, error, error string in $ErrorMsg */ function AgentAdd($job_pk, $upload_pk, &$ErrorMsg, $Dependencies) { global $Plugins; global $SysConf; $Dep = array(); $jqDeps = array(); $EmptyDeps = array(); /* Is the user authenticated? If not, then fail * because we won't know which bucketpool to use. */ $user_pk = $SysConf['auth']['UserId']; if (empty($user_pk)) { $ErrorMsg = _("Session is unauthenticated, bucket agent cannot run without knowing who the user is."); return -1; } /* get the default_bucketpool_fk from the users record */ $usersRec = GetSingleRec("users", "where user_pk='{$user_pk}'"); $default_bucketpool_fk = $usersRec['default_bucketpool_fk']; if (!$default_bucketpool_fk) { $ErrorMsg = _("User does not have a default bucketpool. Bucket agent cannot be scheduled without this."); return -1; } /* schedule buckets */ /* queue up dependencies */ $Dependencies[] = "agent_nomos"; $Dependencies[] = "agent_pkgagent"; $jqargs = "bppk={$default_bucketpool_fk}, upk={$upload_pk}"; return CommonAgentAdd($this, $job_pk, $upload_pk, $ErrorMsg, $Dependencies, $jqargs); }