aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Controller
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2016-09-25 11:36:59 +0200
committerGitHub <noreply@github.com>2016-09-25 11:36:59 +0200
commit9d7dd6b0d2480d3efff5b0ab1461f2ef99bfd57a (patch)
tree18dfb21ca8e417343d844eb5f5f09fd6b9a11130 /src/Wallabag/ImportBundle/Controller
parent637aa17e6b52dd8021854a809053560a27caca72 (diff)
parent0e0102b6fcd17266f39dd63a808740d01ab9bd8a (diff)
downloadwallabag-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/Wallabag/ImportBundle/Controller')
-rw-r--r--src/Wallabag/ImportBundle/Controller/ImportController.php36
1 files changed, 22 insertions, 14 deletions
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