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


PHP Scheduler::retrieve方法代码示例

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


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

示例1: 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

示例2: Scheduler

 *    (ii) the SugarCRM copyright notice
 * in the same form as they appear in the distribution.  See full license for
 * requirements.
 *
 * The Original Code is: SugarCRM Open Source
 * The Initial Developer of the Original Code is SugarCRM, Inc.
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 ********************************************************************************/
/*********************************************************************************
 * Description:  
 ********************************************************************************/
require_once 'modules/Schedulers/Scheduler.php';
$focus = new Scheduler();
$focus->retrieve($_REQUEST['record']);
// deal with empty values
if (!empty($_REQUEST['date_end']) && !empty($_REQUEST['time_hour_end']) && !empty($_REQUEST['time_minute_end'])) {
    $date_time_end = $_REQUEST['date_end'] . " " . str_pad($_REQUEST['time_hour_end'], 2, '0', STR_PAD_LEFT) . ":" . str_pad($_REQUEST['time_minute_end'], 2, '0', STR_PAD_LEFT) . $_REQUEST['time_end_meridiem'];
} else {
    $date_time_end = '';
}
if ((!empty($_REQUEST['time_hour_from']) || $_REQUEST['time_hour_from'] == '0') && (!empty($_REQUEST['time_minute_from']) || $_REQUEST['time_minute_from'] == '0')) {
    $time_from = str_pad($_REQUEST['time_hour_from'], 2, '0', STR_PAD_LEFT) . ":" . str_pad($_REQUEST['time_minute_from'], 2, '0', STR_PAD_LEFT);
    if (!empty($_REQUEST['time_from_meridiem'])) {
        $time_from .= $_REQUEST['time_from_meridiem'];
    }
} else {
    $time_from = '';
}
if ((!empty($_REQUEST['time_hour_to']) || $_REQUEST['time_hour_to'] == '0') && (!empty($_REQUEST['time_minute_to']) || $_REQUEST['time_minute_to'] == '0')) {
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:Save.php

示例3: retrieveSchedulers

 /**
  * This function retrieves valid jobs, parses the cron format, then returns
  * an array of [JOB_ID][EXEC_TIME][JOB]
  * 
  * @return	$executeJobs	multi-dimensional array 
  * 							[job_id][execute_time]
  */
 function retrieveSchedulers()
 {
     $GLOBALS['log']->info('Gathering Schedulers');
     $executeJobs = array();
     $query = "SELECT id " . "FROM schedulers " . "WHERE deleted=0 " . "AND status = 'Active' " . "AND date_time_start < " . db_convert("'" . gmdate('Y-m-d H:i:s') . "'", 'datetime') . " " . "AND (date_time_end > " . db_convert("'" . gmdate('Y-m-d H:i:s') . "'", 'datetime') . " OR date_time_end IS NULL)";
     $result = $this->db->query($query);
     $rows = 0;
     $executeTimes = array();
     $executeIds = array();
     $executeJobTimes = array();
     while (($arr = $this->db->fetchByAssoc($result)) != null) {
         $focus = new Scheduler();
         $focus->retrieve($arr['id']);
         $executeTimes[$rows] = $this->deriveDBDateTimes($focus);
         if (count($executeTimes) > 0) {
             foreach ($executeTimes as $k => $time) {
                 $executeIds[$rows] = $focus->id;
                 $executeJobTimes[$rows] = $time;
             }
         }
         $rows++;
     }
     $executeJobs['ids'] = $executeIds;
     $executeJobs['times'] = $executeJobTimes;
     return $executeJobs;
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:33,代码来源:SchedulerDaemon.php


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