コード例 #1
0
 /**
  * @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());
         }
     }
 }
コード例 #2
0
ファイル: SQLLogger.php プロジェクト: acp3/core
 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);
     }
 }
コード例 #3
0
ファイル: ErrorHandler.php プロジェクト: acp3/core
 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']]);
     }
 }
コード例 #4
0
ファイル: Mailer.php プロジェクト: 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;
 }
コード例 #5
0
ファイル: Connection.php プロジェクト: acp3/core
 /**
  * @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;
 }