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


PHP Scheduler类代码示例

本文整理汇总了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();
}
开发者ID:hrach,项目名称:async-task-tree,代码行数:7,代码来源:functions.php

示例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();
    }
}
开发者ID:BMLP,项目名称:memoryhole-ansible,代码行数:28,代码来源:AdvancedOpenDiscovery.php

示例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();
    }
}
开发者ID:omusico,项目名称:SelkirkCRM,代码行数:26,代码来源:AdvancedOpenDiscovery.php

示例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();
    }
}
开发者ID:JimMackin,项目名称:SuiteCRM-Build-Maker,代码行数:10,代码来源:AdvancedOpenPortal.php

示例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();
    }
}
开发者ID:omusico,项目名称:suitecrm-docker,代码行数:16,代码来源:AdvancedOpenReports.php

示例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;
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:47,代码来源:SchedulersJob.php

示例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.");
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:8,代码来源:Bug44819Test.php

示例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();
    }
}
开发者ID:BMLP,项目名称:memoryhole-ansible,代码行数:19,代码来源:AdvancedOpenWorkflow.php

示例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();
    }
}
开发者ID:omusico,项目名称:suitecrm-docker,代码行数:21,代码来源:AdvancedOpenPortal.php

示例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]);
 }
开发者ID:neostoic,项目名称:sharemeal,代码行数:13,代码来源:MemberSessionController.php

示例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);
    }
}
开发者ID:michaelprem,项目名称:phc,代码行数:27,代码来源:test_richards.php

示例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;
 }
开发者ID:DBezemer,项目名称:server,代码行数:50,代码来源:BatchControlService.php

示例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;
     }
 }
开发者ID:johngrange,项目名称:wookeyholeweb,代码行数:23,代码来源:text.php

示例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>
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:RebuildSchedulers.php

示例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')
    {
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:31,代码来源:performSetup.php


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