예제 #1
0
 /**
  * Start the cron mail monitor
  *
  * @return boolean True when the job was started
  */
 public function startCronMailMonitor()
 {
     $to = $this->_getMailTo('cronmail', 'gsf_mail_watcher = 1');
     if (!$to) {
         return false;
     }
     $job = $this->getCronMailMonitor();
     switch ($this->project->getLocaleDefault()) {
         case 'nl':
             $subject = "{name} opdracht draait al meer dan {periodHours} uur niet";
             $messageBbText = "L.S.,\n\nDe [b]{name}[/b] opdracht heeft op {setTime} voor het laatst gedraait en zou voor {firstCheck} opnieuw gedraait moeten hebben.\n\nDit is waarschuwing nummer [b]{mailCount}[/b]. Controleer s.v.p. wat verkeerd gegaan is.\n\nDit is een automatische waarschuwing.";
             break;
         default:
             $subject = "{name} job has not run for over {periodHours} hours";
             $messageBbText = "L.S.,\n\nThe [b]{name}[/b] job ran at {setTime} for the last time and should have run again before {firstCheck}.\n\nThis is notice number {mailCount}. Please check what went wrong.\n\nThis messages was send automatically.";
             break;
     }
     $job->setFrom($this->project->getMonitorFrom('cronmail'))->setMessage($messageBbText)->setPeriod($this->project->getMonitorPeriod('cronmail'))->setSubject($subject)->setTo($to)->start();
     return true;
 }