From 42c57af9f883984429ae1c529855eeeed7013588 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 24 May 2017 20:52:23 +0200 Subject: better link --- CHANGELOG.md | 7 +++++- appinfo/info.xml | 2 +- appinfo/install.php | 18 --------------- appinfo/update.php | 2 -- docs/externalapi/Legacy.md | 4 +++- lib/Controller/PageController.php | 2 +- lib/Service/StatusService.php | 20 ++++++++++++++-- templates/part.content.cronwarning.php | 25 -------------------- templates/part.content.php | 2 +- templates/part.content.warnings.php | 42 ++++++++++++++++++++++++++++++++++ 10 files changed, 72 insertions(+), 52 deletions(-) delete mode 100644 appinfo/install.php delete mode 100644 appinfo/update.php delete mode 100644 templates/part.content.cronwarning.php create mode 100644 templates/part.content.warnings.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 102517efc..e123acd99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,13 @@ # Changelog All notable changes to this project will be documented in this file. -## 11.0.2 +## 11.0.3 + +### Fixed +- Display database charset warning inside the app instead of failing installation/update + +## 11.0.2 ### Fixed diff --git a/appinfo/info.xml b/appinfo/info.xml index fae408c05..00ceb5aab 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -8,7 +8,7 @@ Before you update to a new version, [check the changelog](https://github.com/nextcloud/news/blob/master/CHANGELOG.md) to avoid surprises. **Important**: To enable feed updates you will need to enable either [Nextcloud system cron](https://docs.nextcloud.com/server/10/admin_manual/configuration_server/background_jobs_configuration.html#cron) or use [an updater](https://github.com/nextcloud/news-updater) which uses the built in update API and disable cron updates. More information can be found [in the README](https://github.com/nextcloud/news).]]> - 11.0.2 + 11.0.3 agpl Bernhard Posselt Alessandro Cosentino diff --git a/appinfo/install.php b/appinfo/install.php deleted file mode 100644 index 3bf3cde1f..000000000 --- a/appinfo/install.php +++ /dev/null @@ -1,18 +0,0 @@ -getDatabaseConnection()->getParams()['charset']; -$platform = OC::$server->getDatabaseConnection()->getDatabasePlatform(); -if ($platform instanceof MySqlPlatform && $charset !== 'utf8mb4') { - $msg = 'App can not be installed because database MySql/MariaDb uses a ' . - 'non UTF8 charset: ' . $charset .'. Learn more on how to migrate ' . - 'your database to utf8mb4 after making a backup at ' . - 'https://dba.stackexchange.com/a/21684'; - throw new Exception($msg); -} \ No newline at end of file diff --git a/appinfo/update.php b/appinfo/update.php deleted file mode 100644 index 7f0a9a4c5..000000000 --- a/appinfo/update.php +++ /dev/null @@ -1,2 +0,0 @@ -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 diff --git a/templates/part.content.cronwarning.php b/templates/part.content.cronwarning.php deleted file mode 100644 index 62052b331..000000000 --- a/templates/part.content.cronwarning.php +++ /dev/null @@ -1,25 +0,0 @@ - - -

t('Ajax or Web cron mode detected! Your feeds will not be updated!')); ?>

- -
- diff --git a/templates/part.content.php b/templates/part.content.php index 873c71bdc..844588c4f 100644 --- a/templates/part.content.php +++ b/templates/part.content.php @@ -1,4 +1,4 @@ -inc('part.content.cronwarning')) ?> +inc('part.content.warnings')) ?>
+ +

t('Ajax or Web cron mode detected! Your feeds will not be updated!')); ?>

+ +
+ + + + +

t('Incorrect MySql/MariaDb database charset detected!')); ?>

+ +
+ \ No newline at end of file -- cgit v1.2.3