2015-12-30 13:26:30 +01:00
|
|
|
<?php
|
|
|
|
|
2024-02-19 01:30:12 +01:00
|
|
|
namespace Wallabag\Controller\Import;
|
2015-12-30 13:26:30 +01:00
|
|
|
|
2022-08-28 02:01:46 +02:00
|
|
|
use Craue\ConfigBundle\Util\Config;
|
2022-12-19 10:37:22 +01:00
|
|
|
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
|
2025-03-11 00:54:02 +01:00
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
2015-12-30 13:26:30 +01:00
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
2018-10-04 14:07:20 +02:00
|
|
|
use Symfony\Component\Routing\Annotation\Route;
|
2022-12-19 10:37:22 +01:00
|
|
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
2024-02-19 01:30:12 +01:00
|
|
|
use Wallabag\Import\WallabagV1Import;
|
|
|
|
use Wallabag\Redis\Producer as RedisProducer;
|
2015-12-30 13:26:30 +01:00
|
|
|
|
2016-03-28 16:43:33 +02:00
|
|
|
class WallabagV1Controller extends WallabagController
|
2015-12-30 13:26:30 +01:00
|
|
|
{
|
2025-04-05 13:54:27 +02:00
|
|
|
public function __construct(
|
2025-04-05 13:59:36 +02:00
|
|
|
private readonly WallabagV1Import $wallabagImport,
|
|
|
|
private readonly Config $craueConfig,
|
|
|
|
private readonly RabbitMqProducer $rabbitMqProducer,
|
|
|
|
private readonly RedisProducer $redisProducer,
|
2025-04-05 13:54:27 +02:00
|
|
|
) {
|
2022-12-19 10:37:22 +01:00
|
|
|
}
|
|
|
|
|
2017-07-01 09:52:38 +02:00
|
|
|
/**
|
2025-03-10 01:15:45 +01:00
|
|
|
* @Route("/import/wallabag-v1", name="import_wallabag_v1", methods={"GET", "POST"})
|
2025-03-11 00:54:02 +01:00
|
|
|
* @IsGranted("IMPORT_ENTRIES")
|
2017-07-01 09:52:38 +02:00
|
|
|
*/
|
2022-12-19 10:37:22 +01:00
|
|
|
public function indexAction(Request $request, TranslatorInterface $translator)
|
2017-07-01 09:52:38 +02:00
|
|
|
{
|
2022-12-19 10:37:22 +01:00
|
|
|
return parent::indexAction($request, $translator);
|
2017-07-01 09:52:38 +02:00
|
|
|
}
|
|
|
|
|
2016-03-28 16:43:33 +02:00
|
|
|
protected function getImportService()
|
2015-12-30 13:26:30 +01:00
|
|
|
{
|
2022-12-19 10:37:22 +01:00
|
|
|
if ($this->craueConfig->get('import_with_rabbitmq')) {
|
|
|
|
$this->wallabagImport->setProducer($this->rabbitMqProducer);
|
|
|
|
} elseif ($this->craueConfig->get('import_with_redis')) {
|
|
|
|
$this->wallabagImport->setProducer($this->redisProducer);
|
2016-09-04 21:49:21 +02:00
|
|
|
}
|
|
|
|
|
2022-12-19 10:37:22 +01:00
|
|
|
return $this->wallabagImport;
|
2016-03-28 16:43:33 +02:00
|
|
|
}
|
2015-12-30 13:26:30 +01:00
|
|
|
|
2016-03-28 16:43:33 +02:00
|
|
|
protected function getImportTemplate()
|
|
|
|
{
|
2024-02-19 00:03:14 +01:00
|
|
|
return 'Import/WallabagV1/index.html.twig';
|
2016-03-28 16:43:33 +02:00
|
|
|
}
|
2015-12-30 13:26:30 +01:00
|
|
|
}
|