зеркало из https://github.com/nextcloud/news.git
better link
This commit is contained in:
Родитель
51095a9276
Коммит
42c57af9f8
|
@ -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
|
||||
|
||||
|
|
|
@ -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.2</version>
|
||||
<version>11.0.3</version>
|
||||
<licence>agpl</licence>
|
||||
<author>Bernhard Posselt</author>
|
||||
<author>Alessandro Cosentino</author>
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<?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 after making a backup at ' .
|
||||
'https://dba.stackexchange.com/a/21684';
|
||||
throw new Exception($msg);
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/install.php';
|
|
@ -732,7 +732,8 @@ This API can be used to display warnings and errors in your client if the web ap
|
|||
{
|
||||
"version": "5.2.4",
|
||||
"warnings": {
|
||||
"improperlyConfiguredCron": false // if true the webapp will fail to update the feeds correctly
|
||||
"improperlyConfiguredCron": false, // if true the webapp will fail to update the feeds correctly
|
||||
"incorrectDbCharset": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -746,6 +747,7 @@ You should show the following warning and the link should be clickable:
|
|||
The News App updater is improperly configured and you will lose updates.
|
||||
See http://hisdomain.com/index.php/apps/news for instructions on how to fix it.
|
||||
|
||||
If **incorrectDbCharset** is true you should display a warning that database charset is set up incorrectly and updates with unicode characters might fail
|
||||
|
||||
# User
|
||||
|
||||
|
|
|
@ -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
|
||||
]);
|
||||
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
<?php print_unescaped($this->inc('part.content.cronwarning')) ?>
|
||||
<?php print_unescaped($this->inc('part.content.warnings')) ?>
|
||||
|
||||
<div news-auto-focus="#app-content"
|
||||
id="articles"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php if ($_['cronWarning']) { ?>
|
||||
<?php if ($_['warnings']['improperlyConfiguredCron']) { ?>
|
||||
<news-instant-notification id="cron-warning">
|
||||
<p><?php p($l->t('Ajax or Web cron mode detected! Your feeds will not be updated!')); ?></p>
|
||||
<ul>
|
||||
|
@ -23,3 +23,20 @@
|
|||
</ul>
|
||||
</news-instant-notification>
|
||||
<?php }; ?>
|
||||
|
||||
<?php if ($_['warnings']['incorrectDbCharset']) { ?>
|
||||
<news-instant-notification id="cron-warning">
|
||||
<p><?php p($l->t('Incorrect MySql/MariaDb database charset detected!')); ?></p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://dba.stackexchange.com/a/21684"
|
||||
target="_blank"
|
||||
rel="noreferrer">
|
||||
<?php
|
||||
p($l->t('Learn on how to convert your database to utf8mb4'));
|
||||
?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</news-instant-notification>
|
||||
<?php }; ?>
|
Загрузка…
Ссылка в новой задаче