本文整理汇总了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();
}
示例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;
}