當前位置: 首頁>>代碼示例>>PHP>>正文


PHP connection::cron方法代碼示例

本文整理匯總了PHP中connection::cron方法的典型用法代碼示例。如果您正苦於以下問題:PHP connection::cron方法的具體用法?PHP connection::cron怎麽用?PHP connection::cron使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在connection的用法示例。


在下文中一共展示了connection::cron方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkAndCollect

 public static function checkAndCollect()
 {
     try {
         if (date('Gi') >= 500 && date('Gi') < 505) {
             history::archive();
         }
     } catch (Exception $e) {
         log::add('history', 'error', 'history::archive : ' . $e->getMessage());
     }
     try {
         network::cron();
     } catch (Exception $e) {
         log::add('network', 'error', 'network::cron : ' . $e->getMessage());
     }
     try {
         eqLogic::checkAlive();
         connection::cron();
         if (config::byKey('jeeNetwork::mode') != 'slave') {
             jeeNetwork::pull();
         }
     } catch (Exception $e) {
     }
     try {
         cmd::collect();
     } catch (Exception $e) {
         log::add('cmd', 'error', 'cmd::collect : ' . $e->getMessage());
     }
     try {
         history::historize();
     } catch (Exception $e) {
         log::add('history', 'error', 'history::archive : ' . $e->getMessage());
     }
 }
開發者ID:GaelGRIFFON,項目名稱:core,代碼行數:33,代碼來源:jeedom.class.php

示例2: cron

 public static function cron()
 {
     if (!self::isStarted()) {
         $cache = cache::byKey('jeedom::usbMapping');
         $cache->remove();
         foreach (cron::all() as $cron) {
             if ($cron->running() && $cron->getClass() != 'jeedom' && $cron->getFunction() != 'cron') {
                 try {
                     $cron->halt();
                 } catch (Exception $e) {
                 }
             }
         }
         try {
             jeedom::start();
         } catch (Exception $e) {
         }
         try {
             plugin::start();
         } catch (Exception $e) {
         }
         touch('/tmp/jeedom_start');
         self::event('start');
         log::add('core', 'info', 'Démarrage de Jeedom OK');
     }
     self::isDateOk();
     try {
         $c = new Cron\CronExpression(config::byKey('update::check'), new Cron\FieldFactory());
         if ($c->isDue()) {
             $lastCheck = strtotime(config::byKey('update::lastCheck'));
             if (strtotime('now') - $lastCheck > 3600) {
                 if (config::byKey('update::auto') == 1) {
                     update::checkAllUpdate();
                     jeedom::update('', 0);
                 } else {
                     config::save('update::check', rand(1, 59) . ' ' . rand(6, 7) . ' * * *');
                     update::checkAllUpdate();
                     $updates = update::byStatus('update');
                     if (count($updates) > 0) {
                         $toUpdate = '';
                         foreach ($updates as $update) {
                             $toUpdate .= $update->getLogicalId() . ',';
                         }
                         message::add('update', __('De nouvelles mises à jour sont disponibles : ', __FILE__) . trim($toUpdate, ','), '', 'newUpdate');
                     }
                 }
             }
         }
         $c = new Cron\CronExpression('35 00 * * 0', new Cron\FieldFactory());
         if ($c->isDue()) {
             cache::clean();
             DB::optimize();
         }
         $c = new Cron\CronExpression('*/10 * * * *', new Cron\FieldFactory());
         if ($c->isDue()) {
             try {
                 try {
                     network::cron();
                 } catch (Exception $e) {
                     log::add('network', 'error', 'network::cron : ' . $e->getMessage());
                 }
                 eqLogic::checkAlive();
                 connection::cron();
                 if (config::byKey('jeeNetwork::mode') != 'slave') {
                     jeeNetwork::pull();
                 }
             } catch (Exception $e) {
             }
         }
         $c = new Cron\CronExpression('02 02 * * *', new Cron\FieldFactory());
         if ($c->isDue()) {
             try {
                 log::chunk();
                 cron::clean();
             } catch (Exception $e) {
                 log::add('log', 'error', $e->getMessage());
             }
         }
         $c = new Cron\CronExpression('21 23 * * *', new Cron\FieldFactory());
         if ($c->isDue()) {
             try {
                 scenario::cleanTable();
                 user::cleanOutdatedUser();
                 scenario::consystencyCheck();
             } catch (Exception $e) {
                 log::add('scenario', 'error', $e->getMessage());
             }
         }
     } catch (Exception $e) {
     }
 }
開發者ID:jimibi,項目名稱:core,代碼行數:91,代碼來源:jeedom.class.php


注:本文中的connection::cron方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。