本文整理汇总了PHP中Job::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP Job::getList方法的具体用法?PHP Job::getList怎么用?PHP Job::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job
的用法示例。
在下文中一共展示了Job::getList方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
function view()
{
Job::installByHandle('index_search');
$this->set('availableJobs', Job::getAvailableList(0));
$this->set('jobList', Job::getList());
$this->set('auth', Job::generateAuth());
}
示例2: view
function view(){
$jobObj = Loader::model("job");
Job::installByHandle('index_search');
$this->set( 'availableJobs', Job::getAvailableList(0) );
$this->set( 'jobListRS', Job::getList() );
$this->set('auth', Job::generateAuth());
}
示例3: reset
public function reset()
{
$jobs = Job::getList();
foreach ($jobs as $j) {
$j->reset();
}
$this->redirect('/dashboard/system/optimization/jobs', 'reset_complete');
}
示例4: run
public function run() {
$j = Job::getByHandle('index_search_all');
if (!is_object($j)) {
Job::installByHandle('index_search_all');
}
$js = JobSet::getByName('Default');
if (!is_object($js)) {
$js = JobSet::add('Default');
}
$js->clearJobs();
$jobs = Job::getList();
foreach($jobs as $j) {
if (!$j->supportsQueue()) {
$js->addJob($j);
}
}
// create the view page in sitemap permission
$rpk = PermissionKey::getByHandle('view_page');
$vpk = PermissionKey::getByHandle('view_page_in_sitemap');
if (!is_object($vpk)) {
$vpk = PermissionKey::add('page', 'view_page_in_sitemap', 'View Page in Sitemap', 'View Page in Sitemap and Intelligent Search.', false, false);
}
// now we have to get a list of all pages in the site that have their own permissions set.
$db = Loader::db();
$r = $db->Execute('select cID from Pages where cInheritPermissionsFrom = "OVERRIDE" order by cID asc');
while ($row = $r->Fetchrow()) {
$c = Page::getByID($row['cID']);
if (is_object($c) && !$c->isError()) {
$rpk->setPermissionObject($c);
$vpk->setPermissionObject($c);
$rpa = $rpk->getPermissionAccessObject();
if (is_object($rpa)) {
$pt = $vpk->getPermissionAssignmentObject();
if (is_object($pt)) {
$pt->clearPermissionAssignment();
$pt->assignPermissionAccess($rpa);
}
}
}
}
}
示例5: runAllJobs
public static function runAllJobs()
{
//loop through all installed jobs
$jobListRS = Job::getList();
while ($jobItem = $jobListRS->fetchRow()) {
$jobObj = Job::getJobObjByHandle($jobItem['jHandle']);
$jobObj->executeJob();
}
}
示例6: defined
<?php
defined('C5_EXECUTE') or die('Access Denied.');
if (ENABLE_JOB_SCHEDULING) {
$c = Page::getCurrentPage();
if ($c instanceof Page && !$c->isAdminArea()) {
// check for non dashboard page
$jobs = Job::getList(true);
$auth = Job::generateAuth();
$url = "";
// jobs
if (count($jobs)) {
foreach ($jobs as $j) {
if ($j->isScheduledForNow()) {
$url = BASE_URL . View::url('/tools/required/jobs/run_single?auth=' . $auth . '&jID=' . $j->getJobID());
break;
}
}
}
// job sets
if (!strlen($url)) {
$jSets = JobSet::getList();
if (is_array($jSets) && count($jSets)) {
foreach ($jSets as $set) {
if ($set->isScheduledForNow()) {
$url = BASE_URL . View::url('/tools/required/jobs?auth=' . $auth . '&jsID=' . $set->getJobSetID());
break;
}
}
}
}
示例7: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
if (!ini_get('safe_mode')) {
@set_time_limit(0);
}
$json = Loader::helper('json');
if (Job::authenticateRequest($_REQUEST['auth'])) {
$list = Job::getList();
foreach ($list as $job) {
if ($job->supportsQueue()) {
$q = $job->getQueueObject();
// don't process queues that are empty
if ($q->count() < 1) {
continue;
}
$obj = new stdClass();
$js = Loader::helper('json');
try {
$messages = $q->receive($job->getJobQueueBatchSize());
foreach ($messages as $key => $p) {
$job->processQueueItem($p);
$q->deleteMessage($p);
}
$totalItems = $q->count();
$obj->totalItems = $totalItems;
$obj->jHandle = $job->getJobHandle();
$obj->jID = $job->getJobID();
if ($q->count() == 0) {
$result = $job->finish($q);
$obj = $job->markCompleted(0, $result);
示例8: getAvailableList
public static function getAvailableList($includeConcreteDirJobs=1){
$jobObjs=array();
//get existing jobs
$existingJobHandles=array();
$existingJobs = Job::getList();
foreach($existingJobs as $j) {
$existingJobHandles[] = $j->getJobHandle();
}
if(!$includeConcreteDirJobs)
$jobClassLocations = array( DIR_FILES_JOBS );
else $jobClassLocations = Job::jobClassLocations();
foreach( $jobClassLocations as $jobClassLocation){
// Open a known directory, and proceed to read its contents
if (is_dir($jobClassLocation)) {
if ($dh = opendir($jobClassLocation)) {
while (($file = readdir($dh)) !== false) {
if( substr($file,strlen($file)-4)!='.php' ) continue;
$alreadyInstalled=0;
foreach($existingJobHandles as $existingJobHandle){
if( substr($file,0,strlen($file)-4)==$existingJobHandle){
$alreadyInstalled=1;
break;
}
}
if($alreadyInstalled) continue;
$path=$jobClassLocation .'/'. $file;
require_once( $jobClassLocation .'/'. $file );
$jHandle = substr($file,0,strlen($file)-4);
$className=Object::camelcase( $jHandle );
if(class_exists($className)){
$jobObjs[$jHandle]=new $className();
$jobObjs[$jHandle]->jHandle=$jHandle;
if(!$jobObjs[$jHandle] instanceof Job){
$jobObjs[$jHandle]->jDescription= t('Error: The Job class must be a child class of Job.');
$jobObjs[$jHandle]->invalid=1;
}
}else{
$invalidJob = new Job();
$invalidJob->jName = $className;
$invalidJob->jHandle=$jHandle;
$invalidJob->jDescription = t('Error: Invalid Job file. The class %s was not found in %s .', $className, $path);
$invalidJob->invalid=1;
$jobObjs[$jHandle] = $invalidJob;
}
}
closedir($dh);
}
}
}
return $jobObjs;
}
示例9: getListAll
public static function getListAll()
{
$jobsTotal = 1;
$jobs = [];
for ($page = 1; sizeof($jobs) < $jobsTotal; $page++) {
$jobResponse = Job::getList($page);
$jobList = $jobResponse->jobs;
$jobsTotal = $jobResponse->totalCount;
foreach ($jobList as $job) {
$jobs[] = $job;
}
}
return $jobs;
}