diff --git a/lib/Alchemy/Phrasea/WorkerManager/Controller/AdminConfigurationController.php b/lib/Alchemy/Phrasea/WorkerManager/Controller/AdminConfigurationController.php index f894d1cb98..f60da4eaa6 100644 --- a/lib/Alchemy/Phrasea/WorkerManager/Controller/AdminConfigurationController.php +++ b/lib/Alchemy/Phrasea/WorkerManager/Controller/AdminConfigurationController.php @@ -10,6 +10,7 @@ use Alchemy\Phrasea\SearchEngine\Elastic\ElasticsearchOptions; use Alchemy\Phrasea\WorkerManager\Event\PopulateIndexEvent; use Alchemy\Phrasea\WorkerManager\Event\WorkerEvents; use Alchemy\Phrasea\WorkerManager\Form\WorkerConfigurationType; +use Alchemy\Phrasea\WorkerManager\Form\WorkerFtpType; use Alchemy\Phrasea\WorkerManager\Form\WorkerPullAssetsType; use Alchemy\Phrasea\WorkerManager\Form\WorkerSearchengineType; use Alchemy\Phrasea\WorkerManager\Queue\AMQPConnection; @@ -194,6 +195,24 @@ class AdminConfigurationController extends Controller ]); } + public function ftpAction(PhraseaApplication $app, Request $request) + { + $ftpConfig = $this->getFtpConfiguration(); + $form = $app->form(new WorkerFtpType(), $ftpConfig); + + $form->handleRequest($request); + if ($form->isValid()) { + // save new ftp config + $app['conf']->set(['workers', 'ftp'], array_merge($ftpConfig, $form->getData())); + + return $app->redirectPath('worker_admin'); + } + + return $this->render('admin/worker-manager/worker_ftp.html.twig', [ + 'form' => $form->createView() + ]); + } + public function populateStatusAction(PhraseaApplication $app, Request $request) { $databoxIds = $request->get('sbasIds'); @@ -268,6 +287,11 @@ class AdminConfigurationController extends Controller return $this->app['conf']->get(['workers', 'pull_assets'], []); } + private function getFtpConfiguration() + { + return $this->app['conf']->get(['workers', 'ftp'], []); + } + private function getRetryQueueConfiguration() { return $this->app['conf']->get(['workers', 'retry_queue'], []); diff --git a/lib/Alchemy/Phrasea/WorkerManager/Provider/ControllerServiceProvider.php b/lib/Alchemy/Phrasea/WorkerManager/Provider/ControllerServiceProvider.php index c06bfb469c..43cf48939d 100644 --- a/lib/Alchemy/Phrasea/WorkerManager/Provider/ControllerServiceProvider.php +++ b/lib/Alchemy/Phrasea/WorkerManager/Provider/ControllerServiceProvider.php @@ -77,6 +77,10 @@ class ControllerServiceProvider implements ControllerProviderInterface, ServiceP ->method('GET|POST') ->bind('worker_admin_metadata'); + $controllers->match('/ftp', 'controller.worker.admin.configuration:ftpAction') + ->method('GET|POST') + ->bind('worker_admin_ftp'); + $controllers->get('/populate-status', 'controller.worker.admin.configuration:populateStatusAction') ->bind('worker_admin_populate_status');