/**
  * @param ModelSaveEvent $event
  */
 public function generateSeoSitemap(ModelSaveEvent $event)
 {
     if ($this->canGenerateSitemapAutomatically() && $this->isAllowedModule($event->getModuleName())) {
         try {
             $this->sitemapGenerationModel->save();
         } catch (SitemapGenerationException $e) {
             $this->logger->info('seo-sitemap', $e->getMessage());
         }
     }
 }
Example #2
0
 public function __destruct()
 {
     if (isset($this->queries[$this->requestPath])) {
         $totalTime = 0;
         foreach ($this->queries[$this->requestPath] as $query) {
             $totalTime += $query['executionMS'];
         }
         $this->queries[$this->requestPath]['queryCount'] = count($this->queries[$this->requestPath]);
         $this->queries[$this->requestPath]['totalTime'] = $totalTime;
         $this->logger->debug($this->logFilename, $this->queries);
     }
 }
Example #3
0
 public function handleFatalError()
 {
     $lastError = error_get_last();
     if ($lastError !== null && in_array($lastError['type'], self::$fatalErrors, true)) {
         $this->logger->alert('system', 'Fatal Error (' . self::errorCodeToString($lastError['type']) . '): ' . $lastError['message'], ['code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line']]);
     }
 }
Example #4
0
File: Mailer.php Project: acp3/core
 /**
  * Sends the email
  *
  * @return bool
  */
 public function send()
 {
     try {
         $this->configure();
         $this->phpMailer->Subject = $this->generateSubject();
         if (is_array($this->from) === true) {
             $this->phpMailer->setFrom($this->from['email'], $this->from['name']);
         } else {
             $this->phpMailer->setFrom($this->from);
         }
         $this->generateBody();
         // Add attachments to the E-mail
         if (count($this->attachments) > 0) {
             foreach ($this->attachments as $attachment) {
                 if (!empty($attachment) && is_file($attachment)) {
                     $this->phpMailer->addAttachment($attachment);
                 }
             }
         }
         if (!empty($this->recipients)) {
             return $this->bcc === true ? $this->sendBcc() : $this->sendTo();
         }
     } catch (\phpmailerException $e) {
         $this->logger->error('mailer', $e);
     } catch (\Exception $e) {
         $this->logger->error('mailer', $e);
     }
     return false;
 }
Example #5
0
 /**
  * @param callable $callback
  *
  * @return bool|int
  * @throws \Doctrine\DBAL\ConnectionException
  */
 public function executeTransactionalQuery(callable $callback)
 {
     $this->connection->beginTransaction();
     try {
         $result = $callback();
         $this->connection->commit();
     } catch (\Exception $e) {
         $this->connection->rollBack();
         $this->logger->error('database', $e);
         $result = false;
     }
     return $result;
 }