/** * phpbu end event. * * @param \phpbu\App\Event\App\End $event */ public function onPhpbuEnd(Event\App\End $event) { $result = $event->getResult(); $output = ['status' => $result->allOk() ? 0 : 1, 'timestamp' => time(), 'errors' => $this->extractErrors($result), 'debug' => $this->debug, 'backups' => $this->extractBackups($result)]; $this->write($output); $this->close(); }
/** * phpbu end event. * * @param \phpbu\App\Event\App\End $event */ public function onPhpbuEnd(Event\App\End $event) { $result = $event->getResult(); $this->printResult($result); }
/** * Handle the phpbu end event. * * @param \phpbu\App\Event\App\End $event * @throws \phpbu\App\Exception */ public function onPhpbuEnd(Event\App\End $event) { $result = $event->getResult(); $allGood = $result->allOk(); if (!$this->sendOnlyOnError || !$allGood) { $header = $this->getHeaderHtml(); $status = $this->getStatusHtml($result); $errors = $this->getErrorHtml($result); $info = $this->getInfoHtml($result); $footer = $this->getFooterHtml(); $body = '<html><body ' . TPL::getSnippet('sBody') . '>' . $header . $status . $errors . $info . $footer . '</body></html>'; $sent = null; try { /** @var \Swift_Message $message */ $message = Swift_Message::newInstance(); $message->setSubject($this->subject)->setFrom($this->senderMail, $this->senderName)->setTo($this->recipients)->setBody($body, 'text/html'); $sent = $this->mailer->send($message); } catch (\Exception $e) { throw new Exception($e->getMessage()); } if (!$sent) { throw new Exception('mail could not be sent'); } } }