From df1fda6bad53be1a4a0488146c58401bdc95e565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas.mueller@tmit.eu> Date: Thu, 18 Jun 2015 21:50:37 +0200 Subject: [PATCH] Fixing Logger implementation to implement ILogger + fix smtp auto conf in case of php mail() is used --- lib/service/autoconfig.php | 5 +++- lib/service/logger.php | 58 ++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 34 deletions(-) diff --git a/lib/service/autoconfig.php b/lib/service/autoconfig.php index 52083a216..500e39d74 100644 --- a/lib/service/autoconfig.php +++ b/lib/service/autoconfig.php @@ -13,6 +13,7 @@ namespace OCA\Mail\Service; use Exception; +use Horde_Mail_Transport_Smtphorde; use OCA\Mail\Account; use OCA\Mail\Db\MailAccount; use OCP\Security\ICrypto; @@ -207,7 +208,9 @@ class AutoConfig { $a = new Account($account); $smtp = $a->createTransport(); - $smtp->getSMTPObject(); + if ($smtp instanceof Horde_Mail_Transport_Smtphorde) { + $smtp->getSMTPObject(); + } break; } catch(\PEAR_Exception $ex) { diff --git a/lib/service/logger.php b/lib/service/logger.php index eb5459d9e..dc3dff759 100644 --- a/lib/service/logger.php +++ b/lib/service/logger.php @@ -14,18 +14,12 @@ namespace OCA\Mail\Service; use OCP\ILogger; -class Logger { +class Logger implements ILogger { - /** - * - * @var array - */ + /** @var array */ private $context; - /** - * - * @var ILogger - */ + /** @var ILogger */ private $logger; /** @@ -41,67 +35,65 @@ class Logger { } /** - * - * @param string $message + * @inheritdoc */ - public function emergency($message) { + public function emergency($message, array $context = array()) { $this->logger->emergency($message, $this->context); } /** - * - * @param string $message + * @inheritdoc */ - public function alert($message) { + public function alert($message, array $context = array()) { $this->logger->alert($message, $this->context); } /** - * - * @param string $message + * @inheritdoc */ - public function critical($message) { + public function critical($message, array $context = array()) { $this->logger->critical($message, $this->context); } /** - * - * @param string $message + * @inheritdoc */ - public function error($message) { + public function error($message, array $context = array()) { $this->logger->error($message, $this->context); } /** - * - * @param string $message + * @inheritdoc */ - public function warning($message) { + public function warning($message, array $context = array()) { $this->logger->warning($message, $this->context); } /** - * - * @param string $message + * @inheritdoc */ - public function notice($message) { + public function notice($message, array $context = array()) { $this->logger->notice($message, $this->context); } /** - * - * @param string $message + * @inheritdoc */ - public function info($message) { + public function info($message, array $context = array()) { $this->logger->info($message, $this->context); } /** - * - * @param string $message + * @inheritdoc */ - public function debug($message) { + public function debug($message, array $context = array()) { $this->logger->debug($message, $this->context); } + /** + * @inheritdoc + */ + public function log($level, $message, array $context = array()) { + $this->logger->log($level, $message, $context); + } } -- GitLab