Merge pull request #2306 from wallabag/redis-rabbit-check
Some checks about Redis & RabbitMQ
This commit is contained in:
commit
9d7dd6b0d2
@ -16,6 +16,7 @@
|
|||||||
<php>
|
<php>
|
||||||
<ini name="error_reporting" value="-1" />
|
<ini name="error_reporting" value="-1" />
|
||||||
<server name="KERNEL_DIR" value="app/" />
|
<server name="KERNEL_DIR" value="app/" />
|
||||||
|
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
|
||||||
</php>
|
</php>
|
||||||
|
|
||||||
<filter>
|
<filter>
|
||||||
|
@ -432,6 +432,9 @@ flashes:
|
|||||||
# failed_on_file: 'Error while processing import. Please verify your import file.'
|
# failed_on_file: 'Error while processing import. Please verify your import file.'
|
||||||
# summary: 'Import summary: %imported% imported, %skipped% already saved.'
|
# summary: 'Import summary: %imported% imported, %skipped% already saved.'
|
||||||
# summary_with_queue: 'Import summary: %queued% queued.'
|
# summary_with_queue: 'Import summary: %queued% queued.'
|
||||||
|
error:
|
||||||
|
# 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.
|
||||||
|
# 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.
|
||||||
developer:
|
developer:
|
||||||
notice:
|
notice:
|
||||||
# client_created: 'New client created.'
|
# client_created: 'New client created.'
|
||||||
|
@ -432,6 +432,9 @@ flashes:
|
|||||||
failed_on_file: 'Fehler während des Imports. Bitte überprüfe deine Import-Datei.'
|
failed_on_file: 'Fehler während des Imports. Bitte überprüfe deine Import-Datei.'
|
||||||
summary: 'Import-Zusammenfassung: %imported% importiert, %skipped% bereits gespeichert.'
|
summary: 'Import-Zusammenfassung: %imported% importiert, %skipped% bereits gespeichert.'
|
||||||
# summary_with_queue: 'Import summary: %queued% queued.'
|
# summary_with_queue: 'Import summary: %queued% queued.'
|
||||||
|
error:
|
||||||
|
# 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.
|
||||||
|
# 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.
|
||||||
developer:
|
developer:
|
||||||
notice:
|
notice:
|
||||||
client_created: 'Neuer Client erstellt.'
|
client_created: 'Neuer Client erstellt.'
|
||||||
|
@ -434,6 +434,9 @@ flashes:
|
|||||||
failed_on_file: 'Error while processing import. Please verify your import file.'
|
failed_on_file: 'Error while processing import. Please verify your import file.'
|
||||||
summary: 'Import summary: %imported% imported, %skipped% already saved.'
|
summary: 'Import summary: %imported% imported, %skipped% already saved.'
|
||||||
summary_with_queue: 'Import summary: %queued% queued.'
|
summary_with_queue: 'Import summary: %queued% queued.'
|
||||||
|
error:
|
||||||
|
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.
|
||||||
|
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.
|
||||||
developer:
|
developer:
|
||||||
notice:
|
notice:
|
||||||
client_created: 'New client %name% created.'
|
client_created: 'New client %name% created.'
|
||||||
|
@ -432,6 +432,9 @@ flashes:
|
|||||||
failed_on_file: 'Se ocurre un error por procesar importación. Por favor verifique su archivo importado.'
|
failed_on_file: 'Se ocurre un error por procesar importación. Por favor verifique su archivo importado.'
|
||||||
summary: 'Resúmen importado: %importado% importado, %saltados% ya guardado.'
|
summary: 'Resúmen importado: %importado% importado, %saltados% ya guardado.'
|
||||||
# summary_with_queue: 'Import summary: %queued% queued.'
|
# summary_with_queue: 'Import summary: %queued% queued.'
|
||||||
|
error:
|
||||||
|
# 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.
|
||||||
|
# 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.
|
||||||
developer:
|
developer:
|
||||||
notice:
|
notice:
|
||||||
client_created: 'Nuevo cliente creado.'
|
client_created: 'Nuevo cliente creado.'
|
||||||
|
@ -432,6 +432,9 @@ flashes:
|
|||||||
failed_on_file: 'خطا هنگام پردازش پروندهٔ ورودی. آیا پروندهٔ درونریزی شده سالم است؟'
|
failed_on_file: 'خطا هنگام پردازش پروندهٔ ورودی. آیا پروندهٔ درونریزی شده سالم است؟'
|
||||||
summary: 'گزارش درونریزی: %imported% وارد شد, %skipped% از قبل ذخیره شده بود.'
|
summary: 'گزارش درونریزی: %imported% وارد شد, %skipped% از قبل ذخیره شده بود.'
|
||||||
# summary_with_queue: 'Import summary: %queued% queued.'
|
# summary_with_queue: 'Import summary: %queued% queued.'
|
||||||
|
error:
|
||||||
|
# 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.
|
||||||
|
# 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.
|
||||||
developer:
|
developer:
|
||||||
notice:
|
notice:
|
||||||
# client_created: 'New client created.'
|
# client_created: 'New client created.'
|
||||||
|
@ -434,6 +434,9 @@ flashes:
|
|||||||
failed_on_file: "Erreur lors du traitement de l'import. Vérifier votre fichier."
|
failed_on_file: "Erreur lors du traitement de l'import. Vérifier votre fichier."
|
||||||
summary: "Rapport d'import: %imported% importés, %skipped% déjà présent."
|
summary: "Rapport d'import: %imported% importés, %skipped% déjà présent."
|
||||||
summary_with_queue: "Rapport d'import: %queued% en cours de traitement."
|
summary_with_queue: "Rapport d'import: %queued% en cours de traitement."
|
||||||
|
error:
|
||||||
|
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.
|
||||||
|
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.
|
||||||
developer:
|
developer:
|
||||||
notice:
|
notice:
|
||||||
client_created: 'Nouveau client %name% créé'
|
client_created: 'Nouveau client %name% créé'
|
||||||
|
@ -431,6 +431,9 @@ flashes:
|
|||||||
failed_on_file: 'Errore durante la processazione dei dati da importare. Verifica il tuo file di import.'
|
failed_on_file: 'Errore durante la processazione dei dati da importare. Verifica il tuo file di import.'
|
||||||
summary: 'Sommario di importazione: %imported% importati, %skipped% già salvati.'
|
summary: 'Sommario di importazione: %imported% importati, %skipped% già salvati.'
|
||||||
# summary_with_queue: 'Import summary: %queued% queued.'
|
# summary_with_queue: 'Import summary: %queued% queued.'
|
||||||
|
error:
|
||||||
|
# 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.
|
||||||
|
# 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.
|
||||||
developer:
|
developer:
|
||||||
notice:
|
notice:
|
||||||
client_created: 'Nuovo client creato.'
|
client_created: 'Nuovo client creato.'
|
||||||
|
@ -432,6 +432,9 @@ flashes:
|
|||||||
failed_on_file: "Errorr pendent du tractament de l'import. Mercés de verificar vòstre fichièr."
|
failed_on_file: "Errorr pendent du tractament de l'import. Mercés de verificar vòstre fichièr."
|
||||||
summary: "Rapòrt d'import: %imported% importats, %skipped% ja presents."
|
summary: "Rapòrt d'import: %imported% importats, %skipped% ja presents."
|
||||||
# summary_with_queue: 'Import summary: %queued% queued.'
|
# summary_with_queue: 'Import summary: %queued% queued.'
|
||||||
|
error:
|
||||||
|
# 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.
|
||||||
|
# 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.
|
||||||
developer:
|
developer:
|
||||||
notice:
|
notice:
|
||||||
client_created: 'Novèl client creat'
|
client_created: 'Novèl client creat'
|
||||||
|
@ -432,6 +432,9 @@ flashes:
|
|||||||
failed_on_file: 'Błąd podczas ptrzetwarzania pliku. Sprawdż swój importowany plik.'
|
failed_on_file: 'Błąd podczas ptrzetwarzania pliku. Sprawdż swój importowany plik.'
|
||||||
summary: 'Podsumowanie importu: %imported% zaimportowane, %skipped% już zapisane.'
|
summary: 'Podsumowanie importu: %imported% zaimportowane, %skipped% już zapisane.'
|
||||||
summary_with_queue: 'Podsumowanie importu: %queued% zakolejkowane.'
|
summary_with_queue: 'Podsumowanie importu: %queued% zakolejkowane.'
|
||||||
|
error:
|
||||||
|
# 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.
|
||||||
|
# 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.
|
||||||
developer:
|
developer:
|
||||||
notice:
|
notice:
|
||||||
client_created: 'Nowy klient utworzony.'
|
client_created: 'Nowy klient utworzony.'
|
||||||
|
@ -432,6 +432,9 @@ flashes:
|
|||||||
# failed_on_file: 'Error while processing import. Please verify your import file.'
|
# failed_on_file: 'Error while processing import. Please verify your import file.'
|
||||||
# summary: 'Import summary: %imported% imported, %skipped% already saved.'
|
# summary: 'Import summary: %imported% imported, %skipped% already saved.'
|
||||||
# summary_with_queue: 'Import summary: %queued% queued.'
|
# summary_with_queue: 'Import summary: %queued% queued.'
|
||||||
|
error:
|
||||||
|
# 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.
|
||||||
|
# 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.
|
||||||
developer:
|
developer:
|
||||||
notice:
|
notice:
|
||||||
# client_created: 'New client created.'
|
# client_created: 'New client created.'
|
||||||
|
@ -432,6 +432,9 @@ flashes:
|
|||||||
# failed_on_file: 'Error while processing import. Please verify your import file.'
|
# failed_on_file: 'Error while processing import. Please verify your import file.'
|
||||||
# summary: 'Import summary: %imported% imported, %skipped% already saved.'
|
# summary: 'Import summary: %imported% imported, %skipped% already saved.'
|
||||||
# summary_with_queue: 'Import summary: %queued% queued.'
|
# summary_with_queue: 'Import summary: %queued% queued.'
|
||||||
|
error:
|
||||||
|
# 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.
|
||||||
|
# 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.
|
||||||
developer:
|
developer:
|
||||||
notice:
|
notice:
|
||||||
# client_created: 'New client created.'
|
# client_created: 'New client created.'
|
||||||
|
@ -25,33 +25,41 @@ class ImportController extends Controller
|
|||||||
{
|
{
|
||||||
$nbRedisMessages = null;
|
$nbRedisMessages = null;
|
||||||
$nbRabbitMessages = null;
|
$nbRabbitMessages = null;
|
||||||
|
$redisNotInstalled = false;
|
||||||
|
$rabbitNotInstalled = false;
|
||||||
|
|
||||||
if (!$this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) {
|
if (!$this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) {
|
||||||
return $this->render('WallabagImportBundle:Import:check_queue.html.twig', [
|
return $this->render('WallabagImportBundle:Import:check_queue.html.twig');
|
||||||
'nbRedisMessages' => $nbRedisMessages,
|
|
||||||
'nbRabbitMessages' => $nbRabbitMessages,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
||||||
$nbRabbitMessages = $this->getTotalMessageInRabbitQueue('pocket')
|
// in case rabbit is activated but not installed
|
||||||
+ $this->getTotalMessageInRabbitQueue('readability')
|
try {
|
||||||
+ $this->getTotalMessageInRabbitQueue('wallabag_v1')
|
$nbRabbitMessages = $this->getTotalMessageInRabbitQueue('pocket')
|
||||||
+ $this->getTotalMessageInRabbitQueue('wallabag_v2')
|
+ $this->getTotalMessageInRabbitQueue('readability')
|
||||||
;
|
+ $this->getTotalMessageInRabbitQueue('wallabag_v1')
|
||||||
|
+ $this->getTotalMessageInRabbitQueue('wallabag_v2');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$rabbitNotInstalled = true;
|
||||||
|
}
|
||||||
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
||||||
$redis = $this->get('wallabag_core.redis.client');
|
$redis = $this->get('wallabag_core.redis.client');
|
||||||
|
|
||||||
$nbRedisMessages = $redis->llen('wallabag.import.pocket')
|
try {
|
||||||
+ $redis->llen('wallabag.import.readability')
|
$nbRedisMessages = $redis->llen('wallabag.import.pocket')
|
||||||
+ $redis->llen('wallabag.import.wallabag_v1')
|
+ $redis->llen('wallabag.import.readability')
|
||||||
+ $redis->llen('wallabag.import.wallabag_v2')
|
+ $redis->llen('wallabag.import.wallabag_v1')
|
||||||
;
|
+ $redis->llen('wallabag.import.wallabag_v2');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$redisNotInstalled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('WallabagImportBundle:Import:check_queue.html.twig', [
|
return $this->render('WallabagImportBundle:Import:check_queue.html.twig', [
|
||||||
'nbRedisMessages' => $nbRedisMessages,
|
'nbRedisMessages' => $nbRedisMessages,
|
||||||
'nbRabbitMessages' => $nbRabbitMessages,
|
'nbRabbitMessages' => $nbRabbitMessages,
|
||||||
|
'redisNotInstalled' => $redisNotInstalled,
|
||||||
|
'rabbitNotInstalled' => $rabbitNotInstalled,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,23 @@
|
|||||||
{% if nbRedisMessages > 0 %}
|
{% if nbRedisMessages is defined and nbRedisMessages > 0 %}
|
||||||
<script>
|
<script>
|
||||||
Materialize.toast('Messages in queue: {{ nbRedisMessages }}', 4000);
|
Materialize.toast('Messages in queue: {{ nbRedisMessages }}', 4000);
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if nbRabbitMessages > 0 %}
|
{% if nbRabbitMessages is defined and nbRabbitMessages > 0 %}
|
||||||
<script>
|
<script>
|
||||||
Materialize.toast('Messages in queue: {{ nbRabbitMessages }}', 4000);
|
Materialize.toast('Messages in queue: {{ nbRabbitMessages }}', 4000);
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if redisNotInstalled is defined and redisNotInstalled %}
|
||||||
|
<div class="card-panel red darken-1 white-text">
|
||||||
|
{{ 'flashes.import.error.redis_enabled_not_installed'|trans|raw }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if rabbitNotInstalled is defined and rabbitNotInstalled %}
|
||||||
|
<div class="card-panel red darken-1 white-text">
|
||||||
|
{{ 'flashes.import.error.rabbit_enabled_not_installed'|trans|raw }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
@ -80,4 +80,19 @@ abstract class WallabagCoreTestCase extends WebTestCase
|
|||||||
|
|
||||||
throw new \RuntimeException('No logged in User.');
|
throw new \RuntimeException('No logged in User.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if Redis is installed.
|
||||||
|
* If not, mark test as skip
|
||||||
|
*/
|
||||||
|
protected function checkRedis()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->client->getContainer()->get('wallabag_core.redis.client')->connect();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->markTestSkipped(
|
||||||
|
'Redis is not installed/activated'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ class PocketControllerTest extends WallabagCoreTestCase
|
|||||||
|
|
||||||
public function testImportPocketWithRedisEnabled()
|
public function testImportPocketWithRedisEnabled()
|
||||||
{
|
{
|
||||||
|
$this->checkRedis();
|
||||||
$this->logInAs('admin');
|
$this->logInAs('admin');
|
||||||
$client = $this->getClient();
|
$client = $this->getClient();
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
|
|||||||
|
|
||||||
public function testImportReadabilityWithRedisEnabled()
|
public function testImportReadabilityWithRedisEnabled()
|
||||||
{
|
{
|
||||||
|
$this->checkRedis();
|
||||||
$this->logInAs('admin');
|
$this->logInAs('admin');
|
||||||
$client = $this->getClient();
|
$client = $this->getClient();
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
|
|||||||
|
|
||||||
public function testImportWallabagWithRedisEnabled()
|
public function testImportWallabagWithRedisEnabled()
|
||||||
{
|
{
|
||||||
|
$this->checkRedis();
|
||||||
$this->logInAs('admin');
|
$this->logInAs('admin');
|
||||||
$client = $this->getClient();
|
$client = $this->getClient();
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
|
|||||||
|
|
||||||
public function testImportWallabagWithRedisEnabled()
|
public function testImportWallabagWithRedisEnabled()
|
||||||
{
|
{
|
||||||
|
$this->checkRedis();
|
||||||
$this->logInAs('admin');
|
$this->logInAs('admin');
|
||||||
$client = $this->getClient();
|
$client = $this->getClient();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user