forked from wallabag/wallabag
Use FQCN instead of service alias
This commit is contained in:
@ -2,12 +2,14 @@
|
||||
|
||||
namespace Wallabag\ImportBundle\Command;
|
||||
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||
use Wallabag\ImportBundle\Import\ChromeImport;
|
||||
use Wallabag\ImportBundle\Import\DeliciousImport;
|
||||
@ -43,7 +45,7 @@ class ImportCommand extends ContainerAwareCommand
|
||||
throw new Exception(sprintf('File "%s" not found', $input->getArgument('filepath')));
|
||||
}
|
||||
|
||||
$em = $this->getContainer()->get('doctrine')->getManager();
|
||||
$em = $this->getContainer()->get(ManagerRegistry::class)->getManager();
|
||||
// Turning off doctrine default logs queries for saving memory
|
||||
$em->getConnection()->getConfiguration()->setSQLLogger(null);
|
||||
|
||||
@ -64,8 +66,8 @@ class ImportCommand extends ContainerAwareCommand
|
||||
'main',
|
||||
$entityUser->getRoles());
|
||||
|
||||
$this->getContainer()->get('security.token_storage')->setToken($token);
|
||||
$user = $this->getContainer()->get('security.token_storage')->getToken()->getUser();
|
||||
$this->getContainer()->get(TokenStorageInterface::class)->setToken($token);
|
||||
$user = $this->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser();
|
||||
|
||||
switch ($input->getOption('importer')) {
|
||||
case 'v2':
|
||||
|
||||
@ -5,7 +5,9 @@ namespace Wallabag\ImportBundle\Controller;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||
|
||||
abstract class BrowserController extends Controller
|
||||
@ -38,13 +40,13 @@ abstract class BrowserController extends Controller
|
||||
|
||||
if (true === $res) {
|
||||
$summary = $wallabag->getSummary();
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary', [
|
||||
'%imported%' => $summary['imported'],
|
||||
'%skipped%' => $summary['skipped'],
|
||||
]);
|
||||
|
||||
if (0 < $summary['queued']) {
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary_with_queue', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary_with_queue', [
|
||||
'%queued%' => $summary['queued'],
|
||||
]);
|
||||
}
|
||||
@ -52,14 +54,14 @@ abstract class BrowserController extends Controller
|
||||
unlink($this->getParameter('wallabag_import.resource_dir') . '/' . $name);
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
$message
|
||||
);
|
||||
|
||||
return $this->redirect($this->generateUrl('homepage'));
|
||||
}
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
'flashes.import.notice.failed_on_file'
|
||||
);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Wallabag\ImportBundle\Import\ChromeImport;
|
||||
@ -23,9 +24,9 @@ class ChromeController extends BrowserController
|
||||
{
|
||||
$service = $this->get(ChromeImport::class);
|
||||
|
||||
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
||||
if ($this->get(Config::class)->get('import_with_rabbitmq')) {
|
||||
$service->setProducer($this->get('old_sound_rabbit_mq.import_chrome_producer'));
|
||||
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
||||
} elseif ($this->get(Config::class)->get('import_with_redis')) {
|
||||
$service->setProducer($this->get('wallabag_import.producer.redis.chrome'));
|
||||
}
|
||||
|
||||
|
||||
@ -2,9 +2,12 @@
|
||||
|
||||
namespace Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||
use Wallabag\ImportBundle\Import\DeliciousImport;
|
||||
|
||||
@ -21,9 +24,9 @@ class DeliciousController extends Controller
|
||||
$delicious = $this->get(DeliciousImport::class);
|
||||
$delicious->setUser($this->getUser());
|
||||
|
||||
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
||||
if ($this->get(Config::class)->get('import_with_rabbitmq')) {
|
||||
$delicious->setProducer($this->get('old_sound_rabbit_mq.import_delicious_producer'));
|
||||
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
||||
} elseif ($this->get(Config::class)->get('import_with_redis')) {
|
||||
$delicious->setProducer($this->get('wallabag_import.producer.redis.delicious'));
|
||||
}
|
||||
|
||||
@ -42,13 +45,13 @@ class DeliciousController extends Controller
|
||||
|
||||
if (true === $res) {
|
||||
$summary = $delicious->getSummary();
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary', [
|
||||
'%imported%' => $summary['imported'],
|
||||
'%skipped%' => $summary['skipped'],
|
||||
]);
|
||||
|
||||
if (0 < $summary['queued']) {
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary_with_queue', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary_with_queue', [
|
||||
'%queued%' => $summary['queued'],
|
||||
]);
|
||||
}
|
||||
@ -56,7 +59,7 @@ class DeliciousController extends Controller
|
||||
unlink($this->getParameter('wallabag_import.resource_dir') . '/' . $name);
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
$message
|
||||
);
|
||||
@ -64,7 +67,7 @@ class DeliciousController extends Controller
|
||||
return $this->redirect($this->generateUrl('homepage'));
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
'flashes.import.notice.failed_on_file'
|
||||
);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Wallabag\ImportBundle\Import\ElcuratorImport;
|
||||
@ -23,9 +24,9 @@ class ElcuratorController extends WallabagController
|
||||
{
|
||||
$service = $this->get(ElcuratorImport::class);
|
||||
|
||||
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
||||
if ($this->get(Config::class)->get('import_with_rabbitmq')) {
|
||||
$service->setProducer($this->get('old_sound_rabbit_mq.import_elcurator_producer'));
|
||||
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
||||
} elseif ($this->get(Config::class)->get('import_with_redis')) {
|
||||
$service->setProducer($this->get('wallabag_import.producer.redis.elcurator'));
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Wallabag\ImportBundle\Import\FirefoxImport;
|
||||
@ -23,9 +24,9 @@ class FirefoxController extends BrowserController
|
||||
{
|
||||
$service = $this->get(FirefoxImport::class);
|
||||
|
||||
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
||||
if ($this->get(Config::class)->get('import_with_rabbitmq')) {
|
||||
$service->setProducer($this->get('old_sound_rabbit_mq.import_firefox_producer'));
|
||||
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
||||
} elseif ($this->get(Config::class)->get('import_with_redis')) {
|
||||
$service->setProducer($this->get('wallabag_import.producer.redis.firefox'));
|
||||
}
|
||||
|
||||
|
||||
@ -2,9 +2,11 @@
|
||||
|
||||
namespace Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Predis\Client;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
use Wallabag\ImportBundle\Import\ImportChain;
|
||||
|
||||
class ImportController extends Controller
|
||||
@ -30,11 +32,11 @@ class ImportController extends Controller
|
||||
$redisNotInstalled = false;
|
||||
$rabbitNotInstalled = false;
|
||||
|
||||
if (!$this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) {
|
||||
if (!$this->get(AuthorizationCheckerInterface::class)->isGranted('ROLE_SUPER_ADMIN')) {
|
||||
return $this->render('@WallabagImport/Import/check_queue.html.twig');
|
||||
}
|
||||
|
||||
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
||||
if ($this->get(Config::class)->get('import_with_rabbitmq')) {
|
||||
// in case rabbit is activated but not installed
|
||||
try {
|
||||
$nbRabbitMessages = $this->getTotalMessageInRabbitQueue('pocket')
|
||||
@ -51,7 +53,7 @@ class ImportController extends Controller
|
||||
} catch (\Exception $e) {
|
||||
$rabbitNotInstalled = true;
|
||||
}
|
||||
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
||||
} elseif ($this->get(Config::class)->get('import_with_redis')) {
|
||||
$redis = $this->get(Client::class);
|
||||
|
||||
try {
|
||||
|
||||
@ -2,9 +2,12 @@
|
||||
|
||||
namespace Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||
use Wallabag\ImportBundle\Import\InstapaperImport;
|
||||
|
||||
@ -21,9 +24,9 @@ class InstapaperController extends Controller
|
||||
$instapaper = $this->get(InstapaperImport::class);
|
||||
$instapaper->setUser($this->getUser());
|
||||
|
||||
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
||||
if ($this->get(Config::class)->get('import_with_rabbitmq')) {
|
||||
$instapaper->setProducer($this->get('old_sound_rabbit_mq.import_instapaper_producer'));
|
||||
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
||||
} elseif ($this->get(Config::class)->get('import_with_redis')) {
|
||||
$instapaper->setProducer($this->get('wallabag_import.producer.redis.instapaper'));
|
||||
}
|
||||
|
||||
@ -42,13 +45,13 @@ class InstapaperController extends Controller
|
||||
|
||||
if (true === $res) {
|
||||
$summary = $instapaper->getSummary();
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary', [
|
||||
'%imported%' => $summary['imported'],
|
||||
'%skipped%' => $summary['skipped'],
|
||||
]);
|
||||
|
||||
if (0 < $summary['queued']) {
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary_with_queue', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary_with_queue', [
|
||||
'%queued%' => $summary['queued'],
|
||||
]);
|
||||
}
|
||||
@ -56,7 +59,7 @@ class InstapaperController extends Controller
|
||||
unlink($this->getParameter('wallabag_import.resource_dir') . '/' . $name);
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
$message
|
||||
);
|
||||
@ -64,7 +67,7 @@ class InstapaperController extends Controller
|
||||
return $this->redirect($this->generateUrl('homepage'));
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
'flashes.import.notice.failed_on_file'
|
||||
);
|
||||
|
||||
@ -2,9 +2,12 @@
|
||||
|
||||
namespace Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||
use Wallabag\ImportBundle\Import\PinboardImport;
|
||||
|
||||
@ -21,9 +24,9 @@ class PinboardController extends Controller
|
||||
$pinboard = $this->get(PinboardImport::class);
|
||||
$pinboard->setUser($this->getUser());
|
||||
|
||||
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
||||
if ($this->get(Config::class)->get('import_with_rabbitmq')) {
|
||||
$pinboard->setProducer($this->get('old_sound_rabbit_mq.import_pinboard_producer'));
|
||||
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
||||
} elseif ($this->get(Config::class)->get('import_with_redis')) {
|
||||
$pinboard->setProducer($this->get('wallabag_import.producer.redis.pinboard'));
|
||||
}
|
||||
|
||||
@ -42,13 +45,13 @@ class PinboardController extends Controller
|
||||
|
||||
if (true === $res) {
|
||||
$summary = $pinboard->getSummary();
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary', [
|
||||
'%imported%' => $summary['imported'],
|
||||
'%skipped%' => $summary['skipped'],
|
||||
]);
|
||||
|
||||
if (0 < $summary['queued']) {
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary_with_queue', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary_with_queue', [
|
||||
'%queued%' => $summary['queued'],
|
||||
]);
|
||||
}
|
||||
@ -56,7 +59,7 @@ class PinboardController extends Controller
|
||||
unlink($this->getParameter('wallabag_import.resource_dir') . '/' . $name);
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
$message
|
||||
);
|
||||
@ -64,7 +67,7 @@ class PinboardController extends Controller
|
||||
return $this->redirect($this->generateUrl('homepage'));
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
'flashes.import.notice.failed_on_file'
|
||||
);
|
||||
|
||||
@ -2,11 +2,14 @@
|
||||
|
||||
namespace Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\ImportBundle\Import\PocketImport;
|
||||
|
||||
class PocketController extends Controller
|
||||
@ -40,7 +43,7 @@ class PocketController extends Controller
|
||||
->getRequestToken($this->generateUrl('import', [], UrlGeneratorInterface::ABSOLUTE_URL));
|
||||
|
||||
if (false === $requestToken) {
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
'flashes.import.notice.failed'
|
||||
);
|
||||
@ -50,9 +53,9 @@ class PocketController extends Controller
|
||||
|
||||
$form = $request->request->get('form');
|
||||
|
||||
$this->get('session')->set('import.pocket.code', $requestToken);
|
||||
$this->get(SessionInterface::class)->set('import.pocket.code', $requestToken);
|
||||
if (null !== $form && \array_key_exists('mark_as_read', $form)) {
|
||||
$this->get('session')->set('mark_as_read', $form['mark_as_read']);
|
||||
$this->get(SessionInterface::class)->set('mark_as_read', $form['mark_as_read']);
|
||||
}
|
||||
|
||||
return $this->redirect(
|
||||
@ -69,12 +72,12 @@ class PocketController extends Controller
|
||||
$message = 'flashes.import.notice.failed';
|
||||
$pocket = $this->getPocketImportService();
|
||||
|
||||
$markAsRead = $this->get('session')->get('mark_as_read');
|
||||
$this->get('session')->remove('mark_as_read');
|
||||
$markAsRead = $this->get(SessionInterface::class)->get('mark_as_read');
|
||||
$this->get(SessionInterface::class)->remove('mark_as_read');
|
||||
|
||||
// something bad happend on pocket side
|
||||
if (false === $pocket->authorize($this->get('session')->get('import.pocket.code'))) {
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
if (false === $pocket->authorize($this->get(SessionInterface::class)->get('import.pocket.code'))) {
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
$message
|
||||
);
|
||||
@ -84,19 +87,19 @@ class PocketController extends Controller
|
||||
|
||||
if (true === $pocket->setMarkAsRead($markAsRead)->import()) {
|
||||
$summary = $pocket->getSummary();
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary', [
|
||||
'%imported%' => null !== $summary && \array_key_exists('imported', $summary) ? $summary['imported'] : 0,
|
||||
'%skipped%' => null !== $summary && \array_key_exists('skipped', $summary) ? $summary['skipped'] : 0,
|
||||
]);
|
||||
|
||||
if (null !== $summary && \array_key_exists('queued', $summary) && 0 < $summary['queued']) {
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary_with_queue', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary_with_queue', [
|
||||
'%queued%' => $summary['queued'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
$message
|
||||
);
|
||||
@ -114,9 +117,9 @@ class PocketController extends Controller
|
||||
$pocket = $this->get(PocketImport::class);
|
||||
$pocket->setUser($this->getUser());
|
||||
|
||||
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
||||
if ($this->get(Config::class)->get('import_with_rabbitmq')) {
|
||||
$pocket->setProducer($this->get('old_sound_rabbit_mq.import_pocket_producer'));
|
||||
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
||||
} elseif ($this->get(Config::class)->get('import_with_redis')) {
|
||||
$pocket->setProducer($this->get('wallabag_import.producer.redis.pocket'));
|
||||
}
|
||||
|
||||
|
||||
@ -2,9 +2,12 @@
|
||||
|
||||
namespace Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||
use Wallabag\ImportBundle\Import\ReadabilityImport;
|
||||
|
||||
@ -21,9 +24,9 @@ class ReadabilityController extends Controller
|
||||
$readability = $this->get(ReadabilityImport::class);
|
||||
$readability->setUser($this->getUser());
|
||||
|
||||
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
||||
if ($this->get(Config::class)->get('import_with_rabbitmq')) {
|
||||
$readability->setProducer($this->get('old_sound_rabbit_mq.import_readability_producer'));
|
||||
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
||||
} elseif ($this->get(Config::class)->get('import_with_redis')) {
|
||||
$readability->setProducer($this->get('wallabag_import.producer.redis.readability'));
|
||||
}
|
||||
|
||||
@ -42,13 +45,13 @@ class ReadabilityController extends Controller
|
||||
|
||||
if (true === $res) {
|
||||
$summary = $readability->getSummary();
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary', [
|
||||
'%imported%' => $summary['imported'],
|
||||
'%skipped%' => $summary['skipped'],
|
||||
]);
|
||||
|
||||
if (0 < $summary['queued']) {
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary_with_queue', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary_with_queue', [
|
||||
'%queued%' => $summary['queued'],
|
||||
]);
|
||||
}
|
||||
@ -56,7 +59,7 @@ class ReadabilityController extends Controller
|
||||
unlink($this->getParameter('wallabag_import.resource_dir') . '/' . $name);
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
$message
|
||||
);
|
||||
@ -64,7 +67,7 @@ class ReadabilityController extends Controller
|
||||
return $this->redirect($this->generateUrl('homepage'));
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
'flashes.import.notice.failed_on_file'
|
||||
);
|
||||
|
||||
@ -6,6 +6,8 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||
|
||||
/**
|
||||
@ -41,13 +43,13 @@ abstract class WallabagController extends Controller
|
||||
|
||||
if (true === $res) {
|
||||
$summary = $wallabag->getSummary();
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary', [
|
||||
'%imported%' => $summary['imported'],
|
||||
'%skipped%' => $summary['skipped'],
|
||||
]);
|
||||
|
||||
if (0 < $summary['queued']) {
|
||||
$message = $this->get('translator')->trans('flashes.import.notice.summary_with_queue', [
|
||||
$message = $this->get(TranslatorInterface::class)->trans('flashes.import.notice.summary_with_queue', [
|
||||
'%queued%' => $summary['queued'],
|
||||
]);
|
||||
}
|
||||
@ -55,7 +57,7 @@ abstract class WallabagController extends Controller
|
||||
unlink($this->getParameter('wallabag_import.resource_dir') . '/' . $name);
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
$message
|
||||
);
|
||||
@ -63,7 +65,7 @@ abstract class WallabagController extends Controller
|
||||
return $this->redirect($this->generateUrl('homepage'));
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
$this->get(SessionInterface::class)->getFlashBag()->add(
|
||||
'notice',
|
||||
'flashes.import.notice.failed_on_file'
|
||||
);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Wallabag\ImportBundle\Import\WallabagV1Import;
|
||||
@ -23,9 +24,9 @@ class WallabagV1Controller extends WallabagController
|
||||
{
|
||||
$service = $this->get(WallabagV1Import::class);
|
||||
|
||||
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
||||
if ($this->get(Config::class)->get('import_with_rabbitmq')) {
|
||||
$service->setProducer($this->get('old_sound_rabbit_mq.import_wallabag_v1_producer'));
|
||||
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
||||
} elseif ($this->get(Config::class)->get('import_with_redis')) {
|
||||
$service->setProducer($this->get('wallabag_import.producer.redis.wallabag_v1'));
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Wallabag\ImportBundle\Import\WallabagV2Import;
|
||||
@ -23,9 +24,9 @@ class WallabagV2Controller extends WallabagController
|
||||
{
|
||||
$service = $this->get(WallabagV2Import::class);
|
||||
|
||||
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
||||
if ($this->get(Config::class)->get('import_with_rabbitmq')) {
|
||||
$service->setProducer($this->get('old_sound_rabbit_mq.import_wallabag_v2_producer'));
|
||||
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
||||
} elseif ($this->get(Config::class)->get('import_with_redis')) {
|
||||
$service->setProducer($this->get('wallabag_import.producer.redis.wallabag_v2'));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user