From 42c57af9f883984429ae1c529855eeeed7013588 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 24 May 2017 20:52:23 +0200 Subject: better link --- lib/Controller/PageController.php | 2 +- lib/Service/StatusService.php | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 3d1db0d57..22f79952a 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -68,7 +68,7 @@ class PageController extends Controller { public function index() { $status = $this->statusService->getStatus(); $response = new TemplateResponse($this->appName, 'index', [ - 'cronWarning' => $status['warnings']['improperlyConfiguredCron'], + 'warnings' => $status['warnings'], 'url_generator' => $this->urlGenerator ]); diff --git a/lib/Service/StatusService.php b/lib/Service/StatusService.php index 6233d8d62..066c63ff3 100644 --- a/lib/Service/StatusService.php +++ b/lib/Service/StatusService.php @@ -13,7 +13,10 @@ namespace OCA\News\Service; +use Doctrine\DBAL\Platforms\MySqlPlatform; + use OCP\IConfig; +use OCP\IDBConnection; use OCA\News\Config\Config; @@ -23,11 +26,17 @@ class StatusService { private $settings; private $config; private $appName; + /** + * @var IDBConnection + */ + private $connection; - public function __construct(IConfig $settings, Config $config, $AppName) { + public function __construct(IConfig $settings, IDBConnection $connection, + Config $config, $AppName) { $this->settings = $settings; $this->config = $config; $this->appName = $AppName; + $this->connection = $connection; } public function isProperlyConfigured() { @@ -49,9 +58,16 @@ class StatusService { return [ 'version' => $version, 'warnings' => [ - 'improperlyConfiguredCron' => !$this->isProperlyConfigured() + 'improperlyConfiguredCron' => !$this->isProperlyConfigured(), + 'incorrectDbCharset' => $this->hasIncorrectCharset() ] ]; } + public function hasIncorrectCharset() { + $charset = $this->connection->getParams()['charset']; + $platform = $this->connection->getDatabasePlatform(); + return $platform instanceof MySqlPlatform && $charset !== 'utf8mb4'; + } + } \ No newline at end of file -- cgit v1.2.3