当前位置: 首页>>代码示例>>PHP>>正文


PHP Job::getByHandle方法代码示例

本文整理汇总了PHP中Job::getByHandle方法的典型用法代码示例。如果您正苦于以下问题:PHP Job::getByHandle方法的具体用法?PHP Job::getByHandle怎么用?PHP Job::getByHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Job的用法示例。


在下文中一共展示了Job::getByHandle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upgrade

 public function upgrade()
 {
     // In case the schema changed, drop all cobble tables
     $db = Loader::db();
     $db->Execute('DROP TABLE CobblePageThemes, CobblePageTypes, CobbleAreas, CobblePages, CobbleTemplateAreas');
     // This needs to be called AFTER dropping tables!
     parent::upgrade();
     // not using the job any more so remove it if it exists...
     Loader::model('job');
     $job = Job::getByHandle('cobble_refresh');
     if (!empty($job)) {
         $job->uninstall();
     }
 }
开发者ID:Remo,项目名称:cobble,代码行数:14,代码来源:controller.php

示例2: upgrade

 public function upgrade()
 {
     parent::upgrade();
     if (is_writable("./jobs")) {
         $job = Job::getByHandle('si_mysql_optimize');
         if ($job) {
             $job->uninstall();
         }
         @unlink("./jobs/si_mysql_optimize.php");
         // We have to uninstall the package on the upgrade because on earlier versions the job was copied in the "/job/" directory.
         // In the new version we leave it in the "job" directory in the package. But this is the only way to upgrade, because
         // otherwise we would redeclare the class (here: "/job/si_mysql_optimize.php" and there "/packages/si_mysql_optimize/jobs/si_mysql_optimize.php")
         $this->uninstall();
     }
 }
开发者ID:katzueno,项目名称:si_mysql_optimize,代码行数:15,代码来源:controller.php

示例3: 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);						
					}
				}
			}
		}
	}
开发者ID:ronlobo,项目名称:concrete5,代码行数:43,代码来源:version_562.php

示例4: updateJobs

 protected function updateJobs()
 {
     $this->output(t('Updating jobs...'));
     if (!($job = \Job::getByHandle('update_statistics'))) {
         \Job::installByHandle('update_statistics');
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:7,代码来源:Version20160725000000.php

示例5: 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'])) {
    if (strlen($_REQUEST['jHandle']) > 0 || intval($_REQUEST['jID']) > 0) {
        if ($_REQUEST['jHandle']) {
            $job = Job::getByHandle($_REQUEST['jHandle']);
        } else {
            $job = Job::getByID(intval($_REQUEST['jID']));
        }
    }
}
if (is_object($job)) {
    if ($job->supportsQueue()) {
        $q = $job->getQueueObject();
        if ($_POST['process']) {
            $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;
                if ($q->count() == 0) {
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:31,代码来源:run_single.php

示例6: installJobs

 private function installJobs($pkg)
 {
     Loader::model('job');
     //Make sure the job isn't already installed
     $dumpSample = Job::getByHandle('dump_sample_table');
     if (!is_object($dumpSample)) {
         Job::installByPackage('dump_sample_table', $pkg);
     }
 }
开发者ID:janzenz,项目名称:c5_boilerplate,代码行数:9,代码来源:controller.php

示例7: Area

                $block_type = BlockType::getByHandle($b['btHandle']);
                $area = new Area($b['areaHandle']);
                $p->addBlock($block_type, $area, array("strTitle" => ''));
            }
        }
    }
    echo 'Done<br/>';
    flush();
    ob_flush();
}
// install jobs
echo '<br/>';
echo 'Installing jobs... <br/>';
$jobs = array('stat_user_activities');
foreach ($jobs as $j) {
    $jb = Job::getByHandle($j);
    if (is_object($jb)) {
        echo "Job {$j} had been installed; skip intalling. <br/>";
    } else {
        #Job::installByPackage($j, $pkg);
        Job::installByHandle($j);
        echo "Job {$j} newly installed. <br/>";
    }
    flush();
    ob_flush();
}
// Apply full_stack_style as the site theme
echo '<br/>';
echo 'Applying full_stack_style as site theme...';
$pt = PageTheme::getByHandle('full_stack_style');
$pt->applyToSite();
开发者ID:rratcliffe,项目名称:fsen,代码行数:31,代码来源:install.php

示例8: handleSynchronizeRequest

 public static function handleSynchronizeRequest()
 {
     // read request/response configuration
     $pretend = !empty($_REQUEST['pretend']);
     if (static::peekPath() == 'json' || static::peekPath() == 'text') {
         static::$responseMode = static::shiftPath();
     }
     if ($jobHandle = static::shiftPath()) {
         if (!($Job = Job::getByHandle($jobHandle))) {
             return static::throwNotFoundError('Job not found');
         }
         if (static::$synchronizeRequiredAccountLevel) {
             $GLOBALS['Session']->requireAccountLevel(static::$synchronizeRequiredAccountLevel);
         }
         if (static::peekPath() == 'log') {
             $logPath = $Job->getLogPath() . '.bz2';
             if (file_exists($logPath)) {
                 header('Content-Type: application/json');
                 header(sprintf('Content-Disposition: attachment; filename="%s-%u.json"', $Job->Connector, $Job->ID));
                 passthru("bzcat {$logPath}");
                 exit;
             } else {
                 return static::throwNotFoundError('Log not available');
             }
         }
         return static::respond('jobStatus', array('data' => $Job));
     }
     // authenticate and create job or copy template
     if (!empty($_REQUEST['template'])) {
         $TemplateJob = Job::getByHandle($_REQUEST['template']);
         if (!$TemplateJob || $TemplateJob->Status != 'Template' || $TemplateJob->Connector != get_called_class()) {
             return static::throwNotFoundError('Template job not found');
         }
         $Job = Job::create(array('Connector' => $TemplateJob->Connector, 'Template' => $TemplateJob, 'Config' => $TemplateJob->Config));
     } else {
         if (static::$synchronizeRequiredAccountLevel) {
             $GLOBALS['Session']->requireAccountLevel(static::$synchronizeRequiredAccountLevel);
         }
         $Job = Job::create(array('Connector' => get_called_class(), 'Config' => static::_getJobConfig($_REQUEST)));
         if (!empty($_REQUEST['createTemplate'])) {
             if ($pretend) {
                 return static::throwInvalidRequestError('Cannot combine pretend and createTemplate');
             }
             $Job->Status = 'Template';
             $Job->save();
             return static::respond('templateCreated', array('data' => $Job));
         }
     }
     // show template if not a post
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         return static::respond('createJob', array('data' => $Job, 'templates' => Job::getAllByWhere(array('Status' => 'Template', 'Connector' => get_called_class()))));
     }
     // save job in pending state before starting
     if (!$pretend) {
         $Job->save();
     }
     // close connection to client
     if (!empty($_REQUEST['fork'])) {
         header('Location: ' . static::_getConnectorBaseUrl(true) . '/' . $Job->Handle, true, 201);
         print json_encode(array('data' => $Job->getData()));
         fastcgi_finish_request();
     }
     // update execution time limit
     set_time_limit(static::$synchronizeTimeLimit);
     // execute synchronization
     try {
         $success = static::synchronize($Job, $pretend);
     } catch (Exception $e) {
         $Job->logException($e);
         $success = false;
     }
     if (!$success) {
         $Job->Status = 'Failed';
     }
     // save job if not pretend
     if (!$pretend) {
         $Job->save();
         $Job->writeLog();
         // email report
         if (!empty($Job->Config['reportTo'])) {
             \Emergence\Mailer\Mailer::sendFromTemplate($Job->Config['reportTo'], 'syncronizeComplete', array('Job' => $Job, 'connectorBaseUrl' => static::_getConnectorBaseUrl(true)));
         }
     }
     // all done, respond
     return static::respond('syncronizeComplete', array('data' => $Job, 'success' => $success, 'pretend' => $pretend));
 }
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:86,代码来源:AbstractConnector.php

示例9: importJobSets

 protected function importJobSets(SimpleXMLElement $sx)
 {
     if (isset($sx->jobsets)) {
         foreach ($sx->jobsets->jobset as $js) {
             $pkg = ContentImporter::getPackageObject($js['package']);
             $jso = JobSet::getByName((string) $js['name']);
             if (!is_object($jso)) {
                 $jso = JobSet::add((string) $js['name']);
             }
             foreach ($js->children() as $jsk) {
                 $j = Job::getByHandle((string) $jsk['handle']);
                 if (is_object($j)) {
                     $jso->addJob($j);
                 }
             }
         }
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:18,代码来源:importer.php


注:本文中的Job::getByHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。