From 74e16b4ec2656b51f8f954b4127747a63806e812 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Wed, 3 Jun 2015 19:21:00 +0200 Subject: [PATCH] RESTORE-INDEXER-TASK #time 1h --- .../Core/Provider/TasksServiceProvider.php | 1 + .../TaskManager/Editor/IndexerEditor.php | 45 +++++++++++++++++ .../Phrasea/TaskManager/Job/IndexerJob.php | 50 +++++++++++++++++++ .../task-editor/indexer.html.twig | 1 + 4 files changed, 97 insertions(+) create mode 100644 lib/Alchemy/Phrasea/TaskManager/Editor/IndexerEditor.php create mode 100644 lib/Alchemy/Phrasea/TaskManager/Job/IndexerJob.php create mode 100644 templates/web/admin/task-manager/task-editor/indexer.html.twig diff --git a/lib/Alchemy/Phrasea/Core/Provider/TasksServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/TasksServiceProvider.php index 4620fe245b..0289d81f99 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/TasksServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/TasksServiceProvider.php @@ -79,6 +79,7 @@ class TasksServiceProvider implements ServiceProviderInterface return $app['notification.deliverer']; }), new ArchiveJob($app['translator'], $app['dispatcher'], $logger), + new IndexerJob($app['translator'], $app['dispatcher'], $logger), new BridgeJob($app['translator'], $app['dispatcher'], $logger), new FtpPullJob($app['translator'], $app['dispatcher'], $logger), new RecordMoverJob($app['translator'], $app['dispatcher'], $logger), diff --git a/lib/Alchemy/Phrasea/TaskManager/Editor/IndexerEditor.php b/lib/Alchemy/Phrasea/TaskManager/Editor/IndexerEditor.php new file mode 100644 index 0000000000..a72a849adc --- /dev/null +++ b/lib/Alchemy/Phrasea/TaskManager/Editor/IndexerEditor.php @@ -0,0 +1,45 @@ + + +XML; + } + /** + * {@inheritdoc} + */ + protected function getFormProperties() + { + return []; + } +} \ No newline at end of file diff --git a/lib/Alchemy/Phrasea/TaskManager/Job/IndexerJob.php b/lib/Alchemy/Phrasea/TaskManager/Job/IndexerJob.php new file mode 100644 index 0000000000..fbe88c5937 --- /dev/null +++ b/lib/Alchemy/Phrasea/TaskManager/Job/IndexerJob.php @@ -0,0 +1,50 @@ +translator->trans('Indexation task'); + } + /** + * {@inheritdoc} + */ + public function getJobId() + { + return 'Indexer'; + } + /** + * {@inheritdoc} + */ + public function getDescription() + { + return $this->translator->trans("Indexing Batch (collections/databox)"); + } + /** + * {@inheritdoc} + */ + public function getEditor() + { + return new IndexerEditor($this->translator); + } + /** + * {@inheritdoc} + */ + protected function doJob(JobData $data) + { + $app = $data->getApplication(); + $app['elasticsearch.indexer']->indexScheduledRecords(); + } +} \ No newline at end of file diff --git a/templates/web/admin/task-manager/task-editor/indexer.html.twig b/templates/web/admin/task-manager/task-editor/indexer.html.twig new file mode 100644 index 0000000000..5f9f24bece --- /dev/null +++ b/templates/web/admin/task-manager/task-editor/indexer.html.twig @@ -0,0 +1 @@ +{% extends 'admin/task-manager/task-editor/task.html.twig' %} \ No newline at end of file