summaryrefslogtreecommitdiffstats
path: root/appinfo
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2017-05-24 20:22:18 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2017-05-24 20:22:28 +0200
commit29092e992b2631345b9fcef2bd02eec3d2bf18ce (patch)
tree568aaa8abe5bd086fc5572367fda58ea9b257343 /appinfo
parente1d27b5c9e02b0201bcd2f485fdcd27ae64a726d (diff)
Fail early for incorrectly configured instances
Diffstat (limited to 'appinfo')
-rw-r--r--appinfo/info.xml2
-rw-r--r--appinfo/install.php18
-rw-r--r--appinfo/update.php2
3 files changed, 21 insertions, 1 deletions
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 8bf4536e6..fae408c05 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).]]></description>
- <version>11.0.1</version>
+ <version>11.0.2</version>
<licence>agpl</licence>
<author>Bernhard Posselt</author>
<author>Alessandro Cosentino</author>
diff --git a/appinfo/install.php b/appinfo/install.php
new file mode 100644
index 000000000..887821ee7
--- /dev/null
+++ b/appinfo/install.php
@@ -0,0 +1,18 @@
+<?php
+namespace OCA\News\AppInfo;
+
+use Exception;
+use OC;
+use Doctrine\DBAL\Platforms\MySqlPlatform;
+
+// fail early when an incorrectly configured mysql instances is found to
+// prevent update errors and data loss
+$charset = OC::$server->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 at ' .
+ 'https://dba.stackexchange.com/questions/8239/how-to-easily-convert-utf8-tables-to-utf8mb4-in-mysql-5-5';
+ throw new Exception($msg);
+} \ No newline at end of file
diff --git a/appinfo/update.php b/appinfo/update.php
new file mode 100644
index 000000000..7f0a9a4c5
--- /dev/null
+++ b/appinfo/update.php
@@ -0,0 +1,2 @@
+<?php
+require_once __DIR__ . '/install.php'; \ No newline at end of file