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


PHP Gems_Util::getMaintenanceLock方法代碼示例

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


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

示例1: indexAction

 /**
  * The general "do the jobs" action
  */
 public function indexAction()
 {
     $this->initHtml();
     if ($this->util->getMaintenanceLock()->isLocked()) {
         $this->addMessage($this->_('Cannot run cron job in maintenance mode.'));
     } elseif ($this->util->getCronJobLock()->isLocked()) {
         $this->addMessage($this->_('Cron jobs turned off.'));
     } else {
         $this->commJob();
     }
     $this->util->getMonitor()->startCronMailMonitor();
 }
開發者ID:GemsTracker,項目名稱:gemstracker-library,代碼行數:15,代碼來源:CronAction.php

示例2: reverseMaintenanceMonitor

 /**
  * Start the cron mail monitor
  *
  * @return boolean True when the job was started
  */
 public function reverseMaintenanceMonitor()
 {
     $job = new MonitorJob($this->project->getName() . ' maintenance mode');
     $lock = $this->util->getMaintenanceLock();
     if ($lock->isLocked()) {
         $job->stop();
         $lock->unlock();
         return false;
     }
     $lock->lock();
     $roles = $this->util->getDbLookup()->getRolesByPrivilege('pr.maintenance.maintenance-mode');
     if ($roles) {
         $where = 'gsf_id_primary_group IN (SELECT ggp_id_group FROM gems__groups WHERE ggp_role IN (' . implode(', ', array_map(array($this->db, 'quote'), array_keys($roles))) . '))';
     } else {
         $where = null;
     }
     $to = $this->_getMailTo('maintenancemode', $where);
     if (!$to) {
         return true;
     }
     switch ($this->project->getLocaleDefault()) {
         case 'nl':
             $initSubject = "{name} is aangezet";
             $initBbText = "L.S.,\n\nDe [b]{name}[/b] is op {setTime} aangezet.\n\nZolang dit aan blijft staan kan u regelmatig waarschuwingen krijgen.\n\nDit is een automatisch bericht.";
             $subject = "{name} staat al meer dan {periodHours} uur aan";
             $messageBbText = "L.S.,\n\nDe [b]{name}[/b] is op {setTime} aangezet en staat nog steeds aan.\n\nDit is waarschuwing nummer [b]{mailCount}[/b]. Controleer s.v.p. of de onderhouds modus nog steeds nodig is.\n\nDit is een automatische waarschuwing.";
             break;
         default:
             $initSubject = "{name} has been turned on";
             $initBbText = "L.S.,\n\nThe [b]{name}[/b] was activated at {setTime}.\n\nAs long as maintenance mode is active the system may send you warning messages.\n\nThis messages was send automatically.";
             $subject = "{name} has been active for over {periodHours} hours";
             $messageBbText = "L.S.,\n\nThe [b]{name}[/b] was activated at {setTime} and is still active.\n\nThis is notice number {mailCount}. Please check whether the maintenance mode is still required.\n\nThis messages was send automatically.";
             break;
     }
     $job->setFrom($this->project->getMonitorFrom('maintenancemode'))->setMessage($messageBbText)->setPeriod($this->project->getMonitorPeriod('maintenancemode'))->setSubject($subject)->setTo($to);
     if ($job->start()) {
         $job->sendOtherMail($initSubject, $initBbText);
     }
     return true;
 }
開發者ID:GemsTracker,項目名稱:gemstracker-library,代碼行數:45,代碼來源:Monitor.php


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