From 0b45f1b863d016ea119c0de009f90c4b31bb7376 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Tue, 27 Dec 2016 21:59:09 -0500 Subject: [PATCH] Show last parsing error message in user interface --- ChangeLog | 1 + app/controllers/feed.php | 13 +++++++------ app/handlers/feed.php | 16 +++++++++------- app/locales/ar_AR/translations.php | 2 +- app/locales/cs_CZ/translations.php | 2 +- app/locales/de_DE/translations.php | 2 +- app/locales/es_ES/translations.php | 2 +- app/locales/fr_FR/translations.php | 12 ++++++------ app/locales/it_IT/translations.php | 2 +- app/locales/ja_JP/translations.php | 2 +- app/locales/pt_BR/translations.php | 2 +- app/locales/ru_RU/translations.php | 2 +- app/locales/sr_RS/translations.php | 2 +- app/locales/sr_RS@latin/translations.php | 2 +- app/locales/tr_TR/translations.php | 2 +- app/locales/zh_CN/translations.php | 2 +- app/schemas/postgres.php | 7 ++++++- app/schemas/sqlite.php | 7 ++++++- app/templates/feed_items.php | 2 +- app/templates/feeds.php | 6 ++---- assets/css/app.css | 2 +- 21 files changed, 51 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index ebef6b3..f3c88d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ Version 1.2.0 (unreleased) * Fever API tokens are longer than before * Always update feed URL to avoid useless redirections for futures requests * Add support for Wallabag service +* Show last parsing error message in user interface * Add unit tests Migration procedure from 1.1.x to 1.2.0: diff --git a/app/controllers/feed.php b/app/controllers/feed.php index 6a426a9..e1142f7 100644 --- a/app/controllers/feed.php +++ b/app/controllers/feed.php @@ -44,12 +44,13 @@ Router\post_action('edit-feed', function () { $user_id = SessionStorage::getInstance()->getUserId(); $values = Request\values(); $values += array( - 'enabled' => 0, - 'download_content' => 0, - 'rtl' => 0, - 'cloak_referrer' => 0, - 'parsing_error' => 0, - 'feed_group_ids' => array(), + 'enabled' => 0, + 'download_content' => 0, + 'rtl' => 0, + 'cloak_referrer' => 0, + 'parsing_error' => 0, + 'parsing_error_message' => '', + 'feed_group_ids' => array(), ); list($valid, $errors) = Validator\Feed\validate_modification($values); diff --git a/app/handlers/feed.php b/app/handlers/feed.php index 4fdbdf3..b004019 100644 --- a/app/handlers/feed.php +++ b/app/handlers/feed.php @@ -105,19 +105,21 @@ function update_feed($user_id, $feed_id) if (! empty($error_message)) { Model\Feed\update_feed($user_id, $feed_id, array( - 'last_checked' => time(), - 'parsing_error' => 1, + 'last_checked' => time(), + 'parsing_error' => 1, + 'parsing_error_message' => $error_message, )); return false; } else { Model\Feed\update_feed($user_id, $feed_id, array( - 'feed_url' => $resource->getUrl(), - 'etag' => $resource->getEtag(), - 'last_modified' => $resource->getLastModified(), - 'last_checked' => time(), - 'parsing_error' => 0, + 'feed_url' => $resource->getUrl(), + 'etag' => $resource->getEtag(), + 'last_modified' => $resource->getLastModified(), + 'last_checked' => time(), + 'parsing_error' => 0, + 'parsing_error_message' => '', )); } diff --git a/app/locales/ar_AR/translations.php b/app/locales/ar_AR/translations.php index 0ace43b..2f9f92d 100644 --- a/app/locales/ar_AR/translations.php +++ b/app/locales/ar_AR/translations.php @@ -218,7 +218,6 @@ return array( 'Avoid mixed content warnings with HTTPS' => 'لتجنب التحذيرات الخاصة بـ HTTPS', 'Download favicons' => 'تحميل أيقونة الموقع الإلكتروني', 'general' => 'عام', - 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => '%sconsole%s يوجد خطأ أثناء عملية التحديث!! .. قم بالتحديث يدوياً ثم إذهب إلى نافذة لفحص إشعارات الخطأ', 'Refresh interval in minutes for unread counter' => ':الفترة الزمنية بالدقائق لتحديث عداد العناوين الغير مقروءه', 'Nothing to show. Enable the debug mode to see log messages.' => 'لا يوجد ما يمكن عرضه. قم بتفعيل خيار التصحيح ', 'Enable debug mode' => 'تفعيل وضح التصحيح', @@ -244,4 +243,5 @@ return array( // 'Send bookmarks to Wallabag' => '', // 'Wallabag username' => '', // 'Wallabag password' => '', + // 'An error occurred during the last check: "%s".' => '', ); diff --git a/app/locales/cs_CZ/translations.php b/app/locales/cs_CZ/translations.php index 089711c..dc257dd 100644 --- a/app/locales/cs_CZ/translations.php +++ b/app/locales/cs_CZ/translations.php @@ -218,7 +218,6 @@ return array( 'Avoid mixed content warnings with HTTPS' => 'Vyhne se varování o pomíchaném obsahu s HTTPS', 'Download favicons' => 'Stahovat favicony', 'general' => 'základní', - 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => 'Nastala chyba při poslední kontrole. Obnovte zdroj ručně a poté zkontrolujte %skonzoli%s na chyby!', 'Refresh interval in minutes for unread counter' => 'Obnovovací interval v minutách pro počítadlo nepřečtených', 'Nothing to show. Enable the debug mode to see log messages.' => 'Není co ukázat. Povolte ladící režim pro zobrazení záznamů.', 'Enable debug mode' => 'Povolit ladící režim', @@ -244,4 +243,5 @@ return array( 'Send bookmarks to Wallabag' => 'Poslat záložky na Wallabag', 'Wallabag username' => 'Wallabag uživatelské jmnéno', 'Wallabag password' => 'Wallabah heslo', + // 'An error occurred during the last check: "%s".' => '', ); diff --git a/app/locales/de_DE/translations.php b/app/locales/de_DE/translations.php index 1a1ec0e..b3600a6 100644 --- a/app/locales/de_DE/translations.php +++ b/app/locales/de_DE/translations.php @@ -218,7 +218,6 @@ return array( 'Avoid mixed content warnings with HTTPS' => 'Vermeidet Warnungen wegen gemischtem Inhalt bei HTTPS', 'Download favicons' => 'Favicons herunterladen', 'general' => 'allgemein', - 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => 'Fehler bei der letzten Aktualisierung. Aktualisiere den Feed manuell und prüfe die %sKonsole%s anschließend auf Fehler!', 'Refresh interval in minutes for unread counter' => 'Ungelesen-Anzahl aktualisieren (in minuten)', 'Nothing to show. Enable the debug mode to see log messages.' => 'Keine Daten verfügbar. Schalte den Debug-Modus ein, um Log-Nachrichten zu sehen.', 'Enable debug mode' => 'Debug-Modus einschalten', @@ -244,4 +243,5 @@ return array( // 'Send bookmarks to Wallabag' => '', // 'Wallabag username' => '', // 'Wallabag password' => '', + // 'An error occurred during the last check: "%s".' => '', ); diff --git a/app/locales/es_ES/translations.php b/app/locales/es_ES/translations.php index afc3edd..baafd09 100644 --- a/app/locales/es_ES/translations.php +++ b/app/locales/es_ES/translations.php @@ -218,7 +218,6 @@ return array( 'Avoid mixed content warnings with HTTPS' => 'Evitar avisos de contenido inseguro con HTTPS', 'Download favicons' => 'Descargar favicons', 'general' => 'general', - 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => 'Ha ocurrido un error durante la última actualización. Refresque el canal manualmente y revise los errores en la consola después', 'Refresh interval in minutes for unread counter' => 'Intervalo de actualización en minutos del contador de artículos sin leer', 'Nothing to show. Enable the debug mode to see log messages.' => 'Nada que mostrar. Active el modo de depuración para ver los mensages del log', 'Enable debug mode' => 'Activar modo de depuración', @@ -244,4 +243,5 @@ return array( // 'Send bookmarks to Wallabag' => '', // 'Wallabag username' => '', // 'Wallabag password' => '', + // 'An error occurred during the last check: "%s".' => '', ); diff --git a/app/locales/fr_FR/translations.php b/app/locales/fr_FR/translations.php index e329283..b966289 100644 --- a/app/locales/fr_FR/translations.php +++ b/app/locales/fr_FR/translations.php @@ -218,7 +218,6 @@ return array( 'Avoid mixed content warnings with HTTPS' => 'Évite les alertes du navigateur web en HTTPS', 'Download favicons' => 'Télécharger les icônes des sites web', 'general' => 'général', - 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => 'Une erreur est survenue pendant la dernière vérification. Actualisez le flux manuellement et vérifiez les erreurs dans la %sconsole%s !', 'Refresh interval in minutes for unread counter' => 'Fréquence d\'actualisation en minute du compteur de non lus', 'Nothing to show. Enable the debug mode to see log messages.' => 'Rien à montrer. Activez le mode debug pour voir les messages de log.', 'Enable debug mode' => 'Activer le mode debug', @@ -239,9 +238,10 @@ return array( 'Item title links to' => 'Le titre des articles redirige vers', 'Original' => 'Original', 'Last login:' => 'Dernière connexion :', - // 'Search' => '', - // 'There are no results for your search' => '', - // 'Send bookmarks to Wallabag' => '', - // 'Wallabag username' => '', - // 'Wallabag password' => '', + 'Search' => 'Recherche', + 'There are no results for your search' => 'Il n\'y a aucun résultat pour votre recherche.', + 'Send bookmarks to Wallabag' => 'Envoyer les favoris vers Wallabag', + 'Wallabag username' => 'Identifiant Wallabag', + 'Wallabag password' => 'Mot de passe Wallabag', + 'An error occurred during the last check: "%s".' => 'Une erreur est survenue pendant la dernière vérification : « %s ».', ); diff --git a/app/locales/it_IT/translations.php b/app/locales/it_IT/translations.php index be2049d..dabece8 100644 --- a/app/locales/it_IT/translations.php +++ b/app/locales/it_IT/translations.php @@ -218,7 +218,6 @@ return array( // 'Avoid mixed content warnings with HTTPS' => '', // 'Download favicons' => '', // 'general' => '', - // 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => '', // 'Refresh interval in minutes for unread counter' => '', // 'Nothing to show. Enable the debug mode to see log messages.' => '', // 'Enable debug mode' => '', @@ -244,4 +243,5 @@ return array( // 'Send bookmarks to Wallabag' => '', // 'Wallabag username' => '', // 'Wallabag password' => '', + // 'An error occurred during the last check: "%s".' => '', ); diff --git a/app/locales/ja_JP/translations.php b/app/locales/ja_JP/translations.php index 51305a8..8798d6e 100644 --- a/app/locales/ja_JP/translations.php +++ b/app/locales/ja_JP/translations.php @@ -220,7 +220,6 @@ return array( 'Avoid mixed content warnings with HTTPS' => 'HTTPSとHTTPの混合コンテンツの警告を回避', 'Download favicons' => 'faviconをダウンロード', 'general' => '一般', - 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => '最後のチェック中にエラーが発生しました。手動でフィードを更新し、エラーを%sコンソール%sで確認してください。', 'Refresh interval in minutes for unread counter' => '未読数の更新間隔(分単位)', 'Nothing to show. Enable the debug mode to see log messages.' => '表示するものが何もありません。ログメッセージを表示するにはデバッグモードを有効にします。', 'Enable debug mode' => 'デバッグモードを有効化', @@ -246,4 +245,5 @@ return array( // 'Send bookmarks to Wallabag' => '', // 'Wallabag username' => '', // 'Wallabag password' => '', + // 'An error occurred during the last check: "%s".' => '', ); diff --git a/app/locales/pt_BR/translations.php b/app/locales/pt_BR/translations.php index 02517f6..4e48fe2 100644 --- a/app/locales/pt_BR/translations.php +++ b/app/locales/pt_BR/translations.php @@ -218,7 +218,6 @@ return array( 'Avoid mixed content warnings with HTTPS' => 'Evita alertas de mistura de conteúdo HTTPS', 'Download favicons' => 'Download favicon', // 'general' => '', - // 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => '', // 'Refresh interval in minutes for unread counter' => '', // 'Nothing to show. Enable the debug mode to see log messages.' => '', // 'Enable debug mode' => '', @@ -244,4 +243,5 @@ return array( // 'Send bookmarks to Wallabag' => '', // 'Wallabag username' => '', // 'Wallabag password' => '', + // 'An error occurred during the last check: "%s".' => '', ); diff --git a/app/locales/ru_RU/translations.php b/app/locales/ru_RU/translations.php index 7bec328..9d1ea5e 100644 --- a/app/locales/ru_RU/translations.php +++ b/app/locales/ru_RU/translations.php @@ -218,7 +218,6 @@ return array( 'Avoid mixed content warnings with HTTPS' => 'Избегайте передупреждений о смешанном содержимом в HTTPS', 'Download favicons' => 'Скачивать иконки сайтов', 'general' => 'общие', - 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => 'Во время последней проверки возникла ошибка. Обновите канал вручную, а потом проверьте %sconsole%s на наличие ошибок!', 'Refresh interval in minutes for unread counter' => 'Интервал обновления счетчика непрочитанных статей в минутах', 'Nothing to show. Enable the debug mode to see log messages.' => 'Пока ничего нет. Включите отладочный режим, чтобы увидеть сообщения.', 'Enable debug mode' => 'Включить отладочный режим', @@ -244,4 +243,5 @@ return array( 'Send bookmarks to Wallabag' => 'Отправлять закладки в Wallabag', 'Wallabag username' => 'Имя пользователя Wallabag', 'Wallabag password' => 'Пароль Wallabag', + // 'An error occurred during the last check: "%s".' => '', ); diff --git a/app/locales/sr_RS/translations.php b/app/locales/sr_RS/translations.php index b2585cf..7c181ed 100644 --- a/app/locales/sr_RS/translations.php +++ b/app/locales/sr_RS/translations.php @@ -218,7 +218,6 @@ return array( 'Avoid mixed content warnings with HTTPS' => 'Избегавај упозорења о помешаном садржају када се користи HTTPS', 'Download favicons' => 'Скидај иконице веб сајтова', 'general' => 'опште', - 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => 'Дошло је до грењке током последње провере. Освежите feed ручно и проверите %sконзолу%s после тога!', 'Refresh interval in minutes for unread counter' => 'Број минута после којих се освежава бројач непрочитаних ставки', 'Nothing to show. Enable the debug mode to see log messages.' => 'Овде нема ничег. Активирајте мод за дебаговање да бисте видели поруке дневника.', 'Enable debug mode' => 'Активирај мод за дебаговање', @@ -244,4 +243,5 @@ return array( // 'Send bookmarks to Wallabag' => '', // 'Wallabag username' => '', // 'Wallabag password' => '', + // 'An error occurred during the last check: "%s".' => '', ); diff --git a/app/locales/sr_RS@latin/translations.php b/app/locales/sr_RS@latin/translations.php index ef877bf..f3fc089 100644 --- a/app/locales/sr_RS@latin/translations.php +++ b/app/locales/sr_RS@latin/translations.php @@ -218,7 +218,6 @@ return array( 'Avoid mixed content warnings with HTTPS' => 'Izbegavaj upozorenja o pomešanom sadržaju kada se koristi HTTPS', 'Download favicons' => 'Skidaj ikonice veb sajtova', 'general' => 'opšte', - 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => 'Došlo je do grenjke tokom poslednje provere. Osvežite feed ručno i proverite %skonzolu%s posle toga!', 'Refresh interval in minutes for unread counter' => 'Broj minuta posle kojih se osvežava brojač nepročitanih stavki', 'Nothing to show. Enable the debug mode to see log messages.' => 'Ovde nema ničeg. Aktivirajte mod za debagovanje da biste videli poruke dnevnika.', 'Enable debug mode' => 'Aktiviraj mod za debagovanje', @@ -244,4 +243,5 @@ return array( // 'Send bookmarks to Wallabag' => '', // 'Wallabag username' => '', // 'Wallabag password' => '', + // 'An error occurred during the last check: "%s".' => '', ); diff --git a/app/locales/tr_TR/translations.php b/app/locales/tr_TR/translations.php index fe18643..5bec522 100644 --- a/app/locales/tr_TR/translations.php +++ b/app/locales/tr_TR/translations.php @@ -218,7 +218,6 @@ return array( 'Avoid mixed content warnings with HTTPS' => 'HTTP veya HTTPS bağlantı kullanan içeriklerde önerilmez', 'Download favicons' => 'İnternet sitesi ikonlarını (favicon) indir', 'general' => 'genel', - 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => 'Son kontrol sırasında bir hata oluştu. Akışı elle yenileyin ve daha sonra hataları %skonsol%s üzerinde kontrol edin!', 'Refresh interval in minutes for unread counter' => 'Okunmayanlar için dakika cinsinden yenileme aralığı', 'Nothing to show. Enable the debug mode to see log messages.' => 'Gösterilecek bir şey yok. Hata ayıklama modunu aktifleştirerek hata mesajlarını görebilirsin.', 'Enable debug mode' => 'Hata ayıklama modunu etkinleştir', @@ -244,4 +243,5 @@ return array( // 'Send bookmarks to Wallabag' => '', // 'Wallabag username' => '', // 'Wallabag password' => '', + // 'An error occurred during the last check: "%s".' => '', ); diff --git a/app/locales/zh_CN/translations.php b/app/locales/zh_CN/translations.php index dad695e..2f1ea63 100644 --- a/app/locales/zh_CN/translations.php +++ b/app/locales/zh_CN/translations.php @@ -218,7 +218,6 @@ return array( 'Avoid mixed content warnings with HTTPS' => '避免HTTPS包含HTTP内容的警告', 'Download favicons' => '下载站标', 'general' => '通用', - 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => '在最近一次检查中发生了错误,手动刷新这个订阅源并检查[%s控制台%s]错误信息!', 'Refresh interval in minutes for unread counter' => '未读计数刷新间隔时间(分钟)', 'Nothing to show. Enable the debug mode to see log messages.' => '没有可以显示的,开启调试模式以便查看日志', 'Enable debug mode' => '开启调试模式', @@ -244,4 +243,5 @@ return array( 'Send bookmarks to Wallabag' => '把书签发送到Wallabag', 'Wallabag username' => 'Wallabag用户名', 'Wallabag password' => 'Wallabag密码', + // 'An error occurred during the last check: "%s".' => '', ); diff --git a/app/schemas/postgres.php b/app/schemas/postgres.php index a9f3358..3f57b06 100644 --- a/app/schemas/postgres.php +++ b/app/schemas/postgres.php @@ -5,7 +5,12 @@ namespace Miniflux\Schema; use PDO; use Miniflux\Helper; -const VERSION = 1; +const VERSION = 2; + +function version_2(PDO $pdo) +{ + $pdo->exec('ALTER TABLE feeds ADD COLUMN parsing_error_message VARCHAR(255)'); +} function version_1(PDO $pdo) { diff --git a/app/schemas/sqlite.php b/app/schemas/sqlite.php index 3a5c929..1b307db 100644 --- a/app/schemas/sqlite.php +++ b/app/schemas/sqlite.php @@ -5,7 +5,12 @@ namespace Miniflux\Schema; use PDO; use Miniflux\Helper; -const VERSION = 1; +const VERSION = 2; + +function version_2(PDO $pdo) +{ + $pdo->exec('ALTER TABLE feeds ADD COLUMN parsing_error_message TEXT'); +} function version_1(PDO $pdo) { diff --git a/app/templates/feed_items.php b/app/templates/feed_items.php index 8b181af..05a940c 100644 --- a/app/templates/feed_items.php +++ b/app/templates/feed_items.php @@ -24,7 +24,7 @@

- +

diff --git a/app/templates/feeds.php b/app/templates/feeds.php index 98646fa..52b7b32 100644 --- a/app/templates/feeds.php +++ b/app/templates/feeds.php @@ -17,9 +17,7 @@ - 0): ?> -

- +

','') ?>

@@ -51,7 +49,7 @@ - + diff --git a/assets/css/app.css b/assets/css/app.css index e1250ee..dee7292 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -519,7 +519,7 @@ nav .active a { visibility: visible; color: #000; font-size: 0.7em; - font-weight: normal; + font-weight: bold; } .items article {