Exemplo n.º 1
0
 /**
  * Log output
  *
  * @param Log $log
  * @param \stdClass $request
  * @return void
  *
  * @throws InvalidArgumentException
  */
 protected function mailLog(Log $log, \stdClass $request)
 {
     $config = $this->getConfig();
     $autoDeployConfig = $config['auto_deploy'];
     if (!$autoDeployConfig['log']['mail']) {
         return;
     }
     // get list of authors
     $authors = array();
     foreach ($request->commits as $commit) {
         $authors[$commit->author->email] = $commit->author->name;
     }
     // set recipients
     $recipients = array_keys($authors);
     $recipients[] = $request->user_email;
     // send copy of log to recipients
     $subject = '[AutoDeploy] - ' . $_SERVER['HTTP_HOST'];
     $mail = new $autoDeployConfig['log']['mailerClass']($config['application']['email']);
     if (!$mail instanceof SystemEmailInterface) {
         throw new InvalidArgumentException(sprintf('class "%s" registered as mailer does not implement AutoDeploy/Application/SystemEmail', $autoDeployConfig['log']['mailerClass']));
     }
     $mail->send($recipients, $subject, $log->getOutputString());
 }
Exemplo n.º 2
0
 /**
  * @param Log $log
  *
  * @return $this
  */
 public function addLog(Log $log)
 {
     $this->messages = array_merge($this->messages, $log->getMessages());
     return $this;
 }