本文整理汇总了PHP中Scheduler类的典型用法代码示例。如果您正苦于以下问题:PHP Scheduler类的具体用法?PHP Scheduler怎么用?PHP Scheduler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Scheduler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
$default = TasksHolder::$tasks['default'];
$scheduler = new Scheduler();
$scheduler->newTask($default);
$scheduler->run();
}
示例2: addAODSchedulers
function addAODSchedulers()
{
require_once 'modules/Schedulers/Scheduler.php';
$scheduler = new Scheduler();
$scheduler->retrieve_by_string_fields(array('job' => 'function::aodIndexUnindexed'));
if ($scheduler->id == '') {
$scheduler->name = "Perform Lucene Index";
$scheduler->date_time_start = "2005-01-01 11:15:00";
$scheduler->date_time_end = null;
$scheduler->job_interval = "0::0::*::*::*";
$scheduler->job = "function::aodIndexUnindexed";
$scheduler->status = "Active";
$scheduler->catch_up = 1;
$scheduler->save();
}
$scheduler = new Scheduler();
$scheduler->retrieve_by_string_fields(array('job' => 'function::aodOptimiseIndex'));
if ($scheduler->id == '') {
$scheduler->name = "Optimise AOD Index";
$scheduler->date_time_start = "2005-01-01 11:15:00";
$scheduler->date_time_end = null;
$scheduler->job_interval = "0::*/3::*::*::*";
$scheduler->job = "function::aodOptimiseIndex";
$scheduler->status = "Active";
$scheduler->catch_up = 1;
$scheduler->save();
}
}
示例3: addAODSchedulers
function addAODSchedulers()
{
require_once 'modules/Schedulers/Scheduler.php';
$scheduler = new Scheduler();
if (!count($scheduler->get_full_list('', 'job = "function::aodIndexUnindexed"'))) {
$scheduler->name = "Perform Lucene Index";
$scheduler->date_time_start = "2005-01-01 11:15:00";
$scheduler->date_time_end = null;
$scheduler->job_interval = "0::0::*::*::*";
$scheduler->job = "function::aodIndexUnindexed";
$scheduler->status = "Active";
$scheduler->catch_up = 1;
$scheduler->save();
}
$scheduler = new Scheduler();
if (!count($scheduler->get_full_list('', 'job = "function::aodOptimiseIndex"'))) {
$scheduler->name = "Optimise AOD Index";
$scheduler->date_time_start = "2005-01-01 11:15:00";
$scheduler->date_time_end = null;
$scheduler->job_interval = "0::*/3::*::*::*";
$scheduler->job = "function::aodOptimiseIndex";
$scheduler->status = "Active";
$scheduler->catch_up = 1;
$scheduler->save();
}
}
示例4: updateScheduler
function updateScheduler()
{
require_once 'modules/Schedulers/Scheduler.php';
$scheduler = new Scheduler();
$schedulers = $scheduler->get_full_list('', 'job = "function::pollMonitoredInboxesCustomAOP"');
foreach ($schedulers as $scheduler) {
$scheduler->job = "function::pollMonitoredInboxesAOP";
$scheduler->save();
}
}
示例5: install_aor
function install_aor()
{
require_once 'modules/Schedulers/Scheduler.php';
$scheduler = new Scheduler();
$scheduler->retrieve_by_string_fields(array('job' => 'function::aorRunScheduledReports'));
if ($scheduler->id == '') {
$scheduler->name = "Run Scheduled Reports";
$scheduler->date_time_start = "2005-01-01 11:15:00";
$scheduler->date_time_end = null;
$scheduler->job_interval = "*::*::*::*::*";
$scheduler->job = "function::aorRunScheduledReports";
$scheduler->status = "Active";
$scheduler->catch_up = 1;
$scheduler->save();
}
}
示例6: fireSelf
function fireSelf($id)
{
require_once 'modules/Schedulers/Scheduler.php';
$sched = new Scheduler();
$sched->retrieve($id);
$exJob = explode('::', $sched->job);
if (is_array($exJob)) {
$this->scheduler_id = $sched->id;
$this->scheduler = $sched;
$this->execute_time = $this->handleDateFormat('now');
$this->save();
if ($exJob[0] == 'function') {
$GLOBALS['log']->debug('----->Scheduler found a job of type FUNCTION');
require_once 'modules/Schedulers/_AddJobsHere.php';
$this->setJobFlag(1);
$func = $exJob[1];
$GLOBALS['log']->debug('----->SchedulersJob firing ' . $func);
$res = call_user_func($func);
if ($res) {
$this->setJobFlag(2);
$this->finishJob();
return true;
} else {
$this->setJobFlag(3);
return false;
}
} elseif ($exJob[0] == 'url') {
if (function_exists('curl_init')) {
$GLOBALS['log']->debug('----->SchedulersJob found a job of type URL');
$this->setJobFlag(1);
$GLOBALS['log']->debug('----->SchedulersJob firing URL job: ' . $exJob[1]);
if ($this->fireUrl($exJob[1])) {
$this->setJobFlag(2);
$this->finishJob();
return true;
} else {
$this->setJobFlag(3);
return false;
}
} else {
$this->setJobFlag(4);
return false;
}
}
}
return false;
}
示例7: testInitUser
public function testInitUser()
{
// Check if the initUser() function returns an Admin user
$user = Scheduler::initUser();
$this->assertNotEquals(false, $user, "No admnin users found in the system.");
$this->assertEquals(1, $user->is_admin, "User returned is not admin.");
$this->assertEquals("Active", $user->status, "User returned is not active.");
}
示例8: AddScheduler
function AddScheduler()
{
include_once 'install/install_utils.php';
require_once 'modules/Schedulers/Scheduler.php';
$scheduler = new Scheduler();
$scheduler->retrieve_by_string_fields(array('job' => 'function::processAOW_Workflow'));
if ($scheduler->id == '') {
$scheduler->name = 'Run AOW WorkFlow';
$scheduler->job = 'function::processAOW_Workflow';
$scheduler->date_time_start = create_date(2005, 1, 1) . ' ' . create_time(0, 0, 1);
$scheduler->date_time_end = create_date(2020, 12, 31) . ' ' . create_time(23, 59, 59);
$scheduler->job_interval = '*::*::*::*::*';
$scheduler->status = 'Active';
$scheduler->created_by = '1';
$scheduler->modified_user_id = '1';
$scheduler->catch_up = '0';
$scheduler->save();
}
}
示例9: updateScheduler
function updateScheduler()
{
require_once 'modules/Schedulers/Scheduler.php';
$scheduler = new Scheduler();
if (count($scheduler->get_full_list('', "job = 'function::pollMonitoredInboxesAOP'"))) {
return;
}
$scheduler->name = "AOP Check Inbound Mailboxes";
$scheduler->date_time_start = "2005-01-01 11:15:00";
$scheduler->date_time_end = "2020-12-31 00:00:00";
$scheduler->job_interval = "*/1::*::*::*::*";
$scheduler->job = "function::pollMonitoredInboxesAOP";
$scheduler->status = "Active";
$scheduler->catch_up = 0;
$scheduler->save();
$oldSchedules = $scheduler->get_full_list('', "job = 'function::pollMonitoredInboxes'");
foreach ($oldSchedules as $oldSchedule) {
$oldSchedule->status = "Inactive";
$oldSchedule->save();
}
}
示例10: index
public function index()
{
if (!Auth::check()) {
return Redirect::to('/');
}
$user = Auth::user();
if (Scheduler::where('uid', '=', $user->id)->count() > 0) {
return Redirect::to('/inline');
}
$count_matches = History::where('uid', '=', $user->id)->count();
//return Scheduler::where('uid', '=', $user->id)->count();
return View::make('sessions.index', ['count' => $count_matches]);
}
示例11: runRichards
/**
* The Richards benchmark simulates the task dispatcher of an
* operating system.
**/
function runRichards()
{
$scheduler = new Scheduler();
$scheduler->addIdleTask(ID_IDLE, 0, NULL, COUNT);
$queue = new Packet(NULL, ID_WORKER, KIND_WORK);
$queue = new Packet($queue, ID_WORKER, KIND_WORK);
$scheduler->addWorkerTask(ID_WORKER, 1000, $queue);
$queue = new Packet(NULL, ID_DEVICE_A, KIND_DEVICE);
$queue = new Packet($queue, ID_DEVICE_A, KIND_DEVICE);
$queue = new Packet($queue, ID_DEVICE_A, KIND_DEVICE);
$scheduler->addHandlerTask(ID_HANDLER_A, 2000, $queue);
$queue = new Packet(NULL, ID_DEVICE_B, KIND_DEVICE);
$queue = new Packet($queue, ID_DEVICE_B, KIND_DEVICE);
$queue = new Packet($queue, ID_DEVICE_B, KIND_DEVICE);
$scheduler->addHandlerTask(ID_HANDLER_B, 3000, $queue);
$scheduler->addDeviceTask(ID_DEVICE_A, 4000, NULL);
$scheduler->addDeviceTask(ID_DEVICE_B, 5000, NULL);
$scheduler->schedule();
if ($scheduler->queueCount != EXPECTED_QUEUE_COUNT || $scheduler->holdCount != EXPECTED_HOLD_COUNT) {
$error = "Error during execution: queueCount = " . $scheduler->queueCount . ", holdCount = " . $scheduler->holdCount . ".";
throw new Exception($error);
}
}
示例12: getOrCreateWorker
/**
* batch getOrCreateWorker returns a worker by name, create it if doesnt exist
*
* @param Scheduler $scheduler The scheduler object
* @param int $workerConfigId The worker configured id
* @param KalturaBatchJobType $workerType The type of the remote worker
* @param string $workerName The name of the remote worker
* @return Worker
*/
private function getOrCreateWorker(Scheduler $scheduler, $workerConfigId, $workerType = null, $workerName = null)
{
if (!is_null($workerType) && !is_numeric($workerType)) {
$workerType = kPluginableEnumsManager::apiToCore('BatchJobType', $workerType);
}
$c = new Criteria();
$c->add(SchedulerWorkerPeer::SCHEDULER_CONFIGURED_ID, $scheduler->getConfiguredId());
$c->add(SchedulerWorkerPeer::CONFIGURED_ID, $workerConfigId);
$workerDb = SchedulerWorkerPeer::doSelectOne($c, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
if ($workerDb) {
$shouldSave = false;
if (!is_null($workerName) && $workerDb->getName() != $workerName) {
$workerDb->setName($workerName);
$shouldSave = true;
}
if (!is_null($workerType) && $workerDb->getType() != $workerType) {
$workerDb->setType($workerType);
$shouldSave = true;
}
if ($shouldSave) {
$workerDb->save();
}
return $workerDb;
}
$workerDb = new SchedulerWorker();
$workerDb->setLastStatus(time());
$workerDb->setCreatedBy("Scheduler: " . $scheduler->getName());
$workerDb->setUpdatedBy("Scheduler: " . $scheduler->getName());
$workerDb->setSchedulerId($scheduler->getId());
$workerDb->setSchedulerConfiguredId($scheduler->getConfiguredId());
$workerDb->setConfiguredId($workerConfigId);
$workerDb->setDescription('');
if (!is_null($workerType)) {
$workerDb->setType($workerType);
}
if (!is_null($workerName)) {
$workerDb->setName($workerName);
}
$workerDb->save();
return $workerDb;
}
示例13: nextScheduledDate
/**
* nextScheduledDate
*
* @param string $unix_mhdmd Param
* @param string $now Param
*
* @return string
*/
public static function nextScheduledDate($unix_mhdmd, $now = 'now')
{
JLoader::import('extly.scheduler.scheduler');
try {
$cron = Scheduler::getParser($unix_mhdmd);
$cron->setExpression($unix_mhdmd);
$nextDate = $cron->getNextRunDate($now)->getTimestamp();
$nextDate = JFactory::getDate($nextDate);
return $nextDate;
} catch (Exception $e) {
$logger = AutotweetLogger::getInstance();
$logger->log(JLog::ERROR, 'nextScheduledDate: ' . $e->getMessage());
return null;
}
}
示例14: get_module_title
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
echo get_module_title('Administration', $mod_strings['LBL_REBUILD_SCHEDULERS_TITLE'] . ":", true);
if (isset($_REQUEST['perform_rebuild']) && $_REQUEST['perform_rebuild'] == 'true') {
require_once 'install/install_utils.php';
$focus = new Scheduler();
$focus->rebuildDefaultSchedulers();
$admin_mod_strings = return_module_language($current_language, 'Administration');
?>
<table cellspacing="{CELLSPACING}" class="otherview">
<tr>
<td scope="row" width="35%"><?php
echo $admin_mod_strings['LBL_REBUILD_SCHEDULERS_DESC_SUCCESS'];
?>
</td>
<td><a href="index.php?module=Administration&action=Upgrade"><?php
echo $admin_mod_strings['LBL_RETURN'];
?>
</a></td>
</tr>
</table>
示例15: installLog
installLog($mod_strings['LBL_PERFORM_DEFAULT_USERS']);
create_default_users();
echo $mod_strings['LBL_PERFORM_DONE'];
} else {
echo $line_entry_format . $mod_strings['LBL_PERFORM_ADMIN_PASSWORD'] . $line_exit_format;
installLog($mod_strings['LBL_PERFORM_ADMIN_PASSWORD']);
$db->setUserName($setup_db_sugarsales_user);
$db->setUserPassword($setup_db_sugarsales_password);
set_admin_password($setup_site_admin_password);
echo $mod_strings['LBL_PERFORM_DONE'];
}
installerHook('post_createUsers');
// default OOB schedulers
echo $line_entry_format . $mod_strings['LBL_PERFORM_DEFAULT_SCHEDULER'] . $line_exit_format;
installLog($mod_strings['LBL_PERFORM_DEFAULT_SCHEDULER']);
$scheduler = new Scheduler();
installerHook('pre_createDefaultSchedulers');
$scheduler->rebuildDefaultSchedulers();
installerHook('post_createDefaultSchedulers');
echo $mod_strings['LBL_PERFORM_DONE'];
// Enable Sugar Feeds and add all feeds by default
installLog("Enable SugarFeeds");
enableSugarFeeds();
// Enable the InsideView connector and add all modules
installLog("Enable InsideView Connector");
enableInsideViewConnector();
// Install the logic hook for FTS
installLog("Creating FTS logic hook");
if (!function_exists('createFTSLogicHook')) {
function createFTSLogicHook($filePath = 'application/Ext/LogicHooks/logichooks.ext.php')
{