diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-09-25 11:36:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-25 11:36:59 +0200 |
commit | 9d7dd6b0d2480d3efff5b0ab1461f2ef99bfd57a (patch) | |
tree | 18dfb21ca8e417343d844eb5f5f09fd6b9a11130 /src | |
parent | 637aa17e6b52dd8021854a809053560a27caca72 (diff) | |
parent | 0e0102b6fcd17266f39dd63a808740d01ab9bd8a (diff) | |
download | wallabag-9d7dd6b0d2480d3efff5b0ab1461f2ef99bfd57a.tar.gz wallabag-9d7dd6b0d2480d3efff5b0ab1461f2ef99bfd57a.tar.zst wallabag-9d7dd6b0d2480d3efff5b0ab1461f2ef99bfd57a.zip |
Merge pull request #2306 from wallabag/redis-rabbit-check
Some checks about Redis & RabbitMQ
Diffstat (limited to 'src')
13 files changed, 69 insertions, 16 deletions
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 9f051edb..c6fcb355 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -432,6 +432,9 @@ flashes: | |||
432 | # failed_on_file: 'Error while processing import. Please verify your import file.' | 432 | # failed_on_file: 'Error while processing import. Please verify your import file.' |
433 | # summary: 'Import summary: %imported% imported, %skipped% already saved.' | 433 | # summary: 'Import summary: %imported% imported, %skipped% already saved.' |
434 | # summary_with_queue: 'Import summary: %queued% queued.' | 434 | # summary_with_queue: 'Import summary: %queued% queued.' |
435 | error: | ||
436 | # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration. | ||
437 | # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration. | ||
435 | developer: | 438 | developer: |
436 | notice: | 439 | notice: |
437 | # client_created: 'New client created.' | 440 | # client_created: 'New client created.' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index cbfacd55..c0e82b59 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -432,6 +432,9 @@ flashes: | |||
432 | failed_on_file: 'Fehler während des Imports. Bitte überprüfe deine Import-Datei.' | 432 | failed_on_file: 'Fehler während des Imports. Bitte überprüfe deine Import-Datei.' |
433 | summary: 'Import-Zusammenfassung: %imported% importiert, %skipped% bereits gespeichert.' | 433 | summary: 'Import-Zusammenfassung: %imported% importiert, %skipped% bereits gespeichert.' |
434 | # summary_with_queue: 'Import summary: %queued% queued.' | 434 | # summary_with_queue: 'Import summary: %queued% queued.' |
435 | error: | ||
436 | # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration. | ||
437 | # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration. | ||
435 | developer: | 438 | developer: |
436 | notice: | 439 | notice: |
437 | client_created: 'Neuer Client erstellt.' | 440 | client_created: 'Neuer Client erstellt.' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 21e2405c..6f262209 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -434,6 +434,9 @@ flashes: | |||
434 | failed_on_file: 'Error while processing import. Please verify your import file.' | 434 | failed_on_file: 'Error while processing import. Please verify your import file.' |
435 | summary: 'Import summary: %imported% imported, %skipped% already saved.' | 435 | summary: 'Import summary: %imported% imported, %skipped% already saved.' |
436 | summary_with_queue: 'Import summary: %queued% queued.' | 436 | summary_with_queue: 'Import summary: %queued% queued.' |
437 | error: | ||
438 | redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration. | ||
439 | rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration. | ||
437 | developer: | 440 | developer: |
438 | notice: | 441 | notice: |
439 | client_created: 'New client %name% created.' | 442 | client_created: 'New client %name% created.' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 43f376d4..7b981069 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -432,6 +432,9 @@ flashes: | |||
432 | failed_on_file: 'Se ocurre un error por procesar importación. Por favor verifique su archivo importado.' | 432 | failed_on_file: 'Se ocurre un error por procesar importación. Por favor verifique su archivo importado.' |
433 | summary: 'Resúmen importado: %importado% importado, %saltados% ya guardado.' | 433 | summary: 'Resúmen importado: %importado% importado, %saltados% ya guardado.' |
434 | # summary_with_queue: 'Import summary: %queued% queued.' | 434 | # summary_with_queue: 'Import summary: %queued% queued.' |
435 | error: | ||
436 | # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration. | ||
437 | # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration. | ||
435 | developer: | 438 | developer: |
436 | notice: | 439 | notice: |
437 | client_created: 'Nuevo cliente creado.' | 440 | client_created: 'Nuevo cliente creado.' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index 56418ef9..99fcc378 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -432,6 +432,9 @@ flashes: | |||
432 | failed_on_file: 'خطا هنگام پردازش پروندهٔ ورودی. آیا پروندهٔ درونریزی شده سالم است؟' | 432 | failed_on_file: 'خطا هنگام پردازش پروندهٔ ورودی. آیا پروندهٔ درونریزی شده سالم است؟' |
433 | summary: 'گزارش درونریزی: %imported% وارد شد, %skipped% از قبل ذخیره شده بود.' | 433 | summary: 'گزارش درونریزی: %imported% وارد شد, %skipped% از قبل ذخیره شده بود.' |
434 | # summary_with_queue: 'Import summary: %queued% queued.' | 434 | # summary_with_queue: 'Import summary: %queued% queued.' |
435 | error: | ||
436 | # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration. | ||
437 | # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration. | ||
435 | developer: | 438 | developer: |
436 | notice: | 439 | notice: |
437 | # client_created: 'New client created.' | 440 | # client_created: 'New client created.' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index bde21866..dd82e7f5 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -434,6 +434,9 @@ flashes: | |||
434 | failed_on_file: "Erreur lors du traitement de l'import. Vérifier votre fichier." | 434 | failed_on_file: "Erreur lors du traitement de l'import. Vérifier votre fichier." |
435 | summary: "Rapport d'import: %imported% importés, %skipped% déjà présent." | 435 | summary: "Rapport d'import: %imported% importés, %skipped% déjà présent." |
436 | summary_with_queue: "Rapport d'import: %queued% en cours de traitement." | 436 | summary_with_queue: "Rapport d'import: %queued% en cours de traitement." |
437 | error: | ||
438 | redis_enabled_not_installed: Redis est activé pour les imports asynchrones mais <u>impossible de s'y connecter</u>. Vérifier la configuration de Redis. | ||
439 | rabbit_enabled_not_installed: RabbitMQ est activé pour les imports asynchrones mais <u>impossible de s'y connecter</u>. Vérifier la configuration de RabbitMQ. | ||
437 | developer: | 440 | developer: |
438 | notice: | 441 | notice: |
439 | client_created: 'Nouveau client %name% créé' | 442 | client_created: 'Nouveau client %name% créé' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 26bb31ba..d3ce30c9 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -431,6 +431,9 @@ flashes: | |||
431 | failed_on_file: 'Errore durante la processazione dei dati da importare. Verifica il tuo file di import.' | 431 | failed_on_file: 'Errore durante la processazione dei dati da importare. Verifica il tuo file di import.' |
432 | summary: 'Sommario di importazione: %imported% importati, %skipped% già salvati.' | 432 | summary: 'Sommario di importazione: %imported% importati, %skipped% già salvati.' |
433 | # summary_with_queue: 'Import summary: %queued% queued.' | 433 | # summary_with_queue: 'Import summary: %queued% queued.' |
434 | error: | ||
435 | # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration. | ||
436 | # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration. | ||
434 | developer: | 437 | developer: |
435 | notice: | 438 | notice: |
436 | client_created: 'Nuovo client creato.' | 439 | client_created: 'Nuovo client creato.' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index c6818449..d040daea 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -432,6 +432,9 @@ flashes: | |||
432 | failed_on_file: "Errorr pendent du tractament de l'import. Mercés de verificar vòstre fichièr." | 432 | failed_on_file: "Errorr pendent du tractament de l'import. Mercés de verificar vòstre fichièr." |
433 | summary: "Rapòrt d'import: %imported% importats, %skipped% ja presents." | 433 | summary: "Rapòrt d'import: %imported% importats, %skipped% ja presents." |
434 | # summary_with_queue: 'Import summary: %queued% queued.' | 434 | # summary_with_queue: 'Import summary: %queued% queued.' |
435 | error: | ||
436 | # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration. | ||
437 | # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration. | ||
435 | developer: | 438 | developer: |
436 | notice: | 439 | notice: |
437 | client_created: 'Novèl client creat' | 440 | client_created: 'Novèl client creat' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 84f68138..a51ed1f2 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -432,6 +432,9 @@ flashes: | |||
432 | failed_on_file: 'Błąd podczas ptrzetwarzania pliku. Sprawdż swój importowany plik.' | 432 | failed_on_file: 'Błąd podczas ptrzetwarzania pliku. Sprawdż swój importowany plik.' |
433 | summary: 'Podsumowanie importu: %imported% zaimportowane, %skipped% już zapisane.' | 433 | summary: 'Podsumowanie importu: %imported% zaimportowane, %skipped% już zapisane.' |
434 | summary_with_queue: 'Podsumowanie importu: %queued% zakolejkowane.' | 434 | summary_with_queue: 'Podsumowanie importu: %queued% zakolejkowane.' |
435 | error: | ||
436 | # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration. | ||
437 | # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration. | ||
435 | developer: | 438 | developer: |
436 | notice: | 439 | notice: |
437 | client_created: 'Nowy klient utworzony.' | 440 | client_created: 'Nowy klient utworzony.' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 3d22e29d..de21f0b3 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -432,6 +432,9 @@ flashes: | |||
432 | # failed_on_file: 'Error while processing import. Please verify your import file.' | 432 | # failed_on_file: 'Error while processing import. Please verify your import file.' |
433 | # summary: 'Import summary: %imported% imported, %skipped% already saved.' | 433 | # summary: 'Import summary: %imported% imported, %skipped% already saved.' |
434 | # summary_with_queue: 'Import summary: %queued% queued.' | 434 | # summary_with_queue: 'Import summary: %queued% queued.' |
435 | error: | ||
436 | # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration. | ||
437 | # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration. | ||
435 | developer: | 438 | developer: |
436 | notice: | 439 | notice: |
437 | # client_created: 'New client created.' | 440 | # client_created: 'New client created.' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 5099b002..d4b7a7a2 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -432,6 +432,9 @@ flashes: | |||
432 | # failed_on_file: 'Error while processing import. Please verify your import file.' | 432 | # failed_on_file: 'Error while processing import. Please verify your import file.' |
433 | # summary: 'Import summary: %imported% imported, %skipped% already saved.' | 433 | # summary: 'Import summary: %imported% imported, %skipped% already saved.' |
434 | # summary_with_queue: 'Import summary: %queued% queued.' | 434 | # summary_with_queue: 'Import summary: %queued% queued.' |
435 | error: | ||
436 | # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration. | ||
437 | # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration. | ||
435 | developer: | 438 | developer: |
436 | notice: | 439 | notice: |
437 | # client_created: 'New client created.' | 440 | # client_created: 'New client created.' |
diff --git a/src/Wallabag/ImportBundle/Controller/ImportController.php b/src/Wallabag/ImportBundle/Controller/ImportController.php index ea4f7d7b..36a2a399 100644 --- a/src/Wallabag/ImportBundle/Controller/ImportController.php +++ b/src/Wallabag/ImportBundle/Controller/ImportController.php | |||
@@ -25,33 +25,41 @@ class ImportController extends Controller | |||
25 | { | 25 | { |
26 | $nbRedisMessages = null; | 26 | $nbRedisMessages = null; |
27 | $nbRabbitMessages = null; | 27 | $nbRabbitMessages = null; |
28 | $redisNotInstalled = false; | ||
29 | $rabbitNotInstalled = false; | ||
28 | 30 | ||
29 | if (!$this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { | 31 | if (!$this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { |
30 | return $this->render('WallabagImportBundle:Import:check_queue.html.twig', [ | 32 | return $this->render('WallabagImportBundle:Import:check_queue.html.twig'); |
31 | 'nbRedisMessages' => $nbRedisMessages, | ||
32 | 'nbRabbitMessages' => $nbRabbitMessages, | ||
33 | ]); | ||
34 | } | 33 | } |
35 | 34 | ||
36 | if ($this->get('craue_config')->get('import_with_rabbitmq')) { | 35 | if ($this->get('craue_config')->get('import_with_rabbitmq')) { |
37 | $nbRabbitMessages = $this->getTotalMessageInRabbitQueue('pocket') | 36 | // in case rabbit is activated but not installed |
38 | + $this->getTotalMessageInRabbitQueue('readability') | 37 | try { |
39 | + $this->getTotalMessageInRabbitQueue('wallabag_v1') | 38 | $nbRabbitMessages = $this->getTotalMessageInRabbitQueue('pocket') |
40 | + $this->getTotalMessageInRabbitQueue('wallabag_v2') | 39 | + $this->getTotalMessageInRabbitQueue('readability') |
41 | ; | 40 | + $this->getTotalMessageInRabbitQueue('wallabag_v1') |
41 | + $this->getTotalMessageInRabbitQueue('wallabag_v2'); | ||
42 | } catch (\Exception $e) { | ||
43 | $rabbitNotInstalled = true; | ||
44 | } | ||
42 | } elseif ($this->get('craue_config')->get('import_with_redis')) { | 45 | } elseif ($this->get('craue_config')->get('import_with_redis')) { |
43 | $redis = $this->get('wallabag_core.redis.client'); | 46 | $redis = $this->get('wallabag_core.redis.client'); |
44 | 47 | ||
45 | $nbRedisMessages = $redis->llen('wallabag.import.pocket') | 48 | try { |
46 | + $redis->llen('wallabag.import.readability') | 49 | $nbRedisMessages = $redis->llen('wallabag.import.pocket') |
47 | + $redis->llen('wallabag.import.wallabag_v1') | 50 | + $redis->llen('wallabag.import.readability') |
48 | + $redis->llen('wallabag.import.wallabag_v2') | 51 | + $redis->llen('wallabag.import.wallabag_v1') |
49 | ; | 52 | + $redis->llen('wallabag.import.wallabag_v2'); |
53 | } catch (\Exception $e) { | ||
54 | $redisNotInstalled = true; | ||
55 | } | ||
50 | } | 56 | } |
51 | 57 | ||
52 | return $this->render('WallabagImportBundle:Import:check_queue.html.twig', [ | 58 | return $this->render('WallabagImportBundle:Import:check_queue.html.twig', [ |
53 | 'nbRedisMessages' => $nbRedisMessages, | 59 | 'nbRedisMessages' => $nbRedisMessages, |
54 | 'nbRabbitMessages' => $nbRabbitMessages, | 60 | 'nbRabbitMessages' => $nbRabbitMessages, |
61 | 'redisNotInstalled' => $redisNotInstalled, | ||
62 | 'rabbitNotInstalled' => $rabbitNotInstalled, | ||
55 | ]); | 63 | ]); |
56 | } | 64 | } |
57 | 65 | ||
diff --git a/src/Wallabag/ImportBundle/Resources/views/Import/check_queue.html.twig b/src/Wallabag/ImportBundle/Resources/views/Import/check_queue.html.twig index 7168ea35..a2633698 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Import/check_queue.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Import/check_queue.html.twig | |||
@@ -1,11 +1,23 @@ | |||
1 | {% if nbRedisMessages > 0 %} | 1 | {% if nbRedisMessages is defined and nbRedisMessages > 0 %} |
2 | <script> | 2 | <script> |
3 | Materialize.toast('Messages in queue: {{ nbRedisMessages }}', 4000); | 3 | Materialize.toast('Messages in queue: {{ nbRedisMessages }}', 4000); |
4 | </script> | 4 | </script> |
5 | {% endif %} | 5 | {% endif %} |
6 | 6 | ||
7 | {% if nbRabbitMessages > 0 %} | 7 | {% if nbRabbitMessages is defined and nbRabbitMessages > 0 %} |
8 | <script> | 8 | <script> |
9 | Materialize.toast('Messages in queue: {{ nbRabbitMessages }}', 4000); | 9 | Materialize.toast('Messages in queue: {{ nbRabbitMessages }}', 4000); |
10 | </script> | 10 | </script> |
11 | {% endif %} | 11 | {% endif %} |
12 | |||
13 | {% if redisNotInstalled is defined and redisNotInstalled %} | ||
14 | <div class="card-panel red darken-1 white-text"> | ||
15 | {{ 'flashes.import.error.redis_enabled_not_installed'|trans|raw }} | ||
16 | </div> | ||
17 | {% endif %} | ||
18 | |||
19 | {% if rabbitNotInstalled is defined and rabbitNotInstalled %} | ||
20 | <div class="card-panel red darken-1 white-text"> | ||
21 | {{ 'flashes.import.error.rabbit_enabled_not_installed'|trans|raw }} | ||
22 | </div> | ||
23 | {% endif %} | ||