Merge pull request #5748 from yguedidi/use-fqcn-as-service-name

This commit is contained in:
Jérémy Benoist 2022-08-25 07:37:06 +02:00 committed by GitHub
commit 009697f844
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 367 additions and 327 deletions

View file

@ -40,7 +40,7 @@ twig:
strict_variables: "%kernel.debug%" strict_variables: "%kernel.debug%"
form_themes: form_themes:
- "LexikFormFilterBundle:Form:form_div_layout.html.twig" - "LexikFormFilterBundle:Form:form_div_layout.html.twig"
exception_controller: wallabag_core.exception_controller:showAction exception_controller: Wallabag\CoreBundle\Controller\ExceptionController:showAction
globals: globals:
registration_enabled: '%fosuser_registration%' registration_enabled: '%fosuser_registration%'
@ -171,7 +171,7 @@ liip_theme:
themes: themes:
- baggy - baggy
- material - material
autodetect_theme: wallabag_core.helper.detect_active_theme autodetect_theme: Wallabag\CoreBundle\Helper\DetectActiveTheme
path_patterns: path_patterns:
bundle_resource: bundle_resource:
@ -219,7 +219,7 @@ scheb_two_factor:
sender_email: "%twofactor_sender%" sender_email: "%twofactor_sender%"
digits: 6 digits: 6
template: WallabagUserBundle:Authentication:form.html.twig template: WallabagUserBundle:Authentication:form.html.twig
mailer: wallabag_user.auth_code_mailer mailer: Wallabag\UserBundle\Mailer\AuthCodeMailer
kphoen_rulerz: kphoen_rulerz:
targets: targets:
@ -406,7 +406,7 @@ sensio_framework_extra:
httplug: httplug:
clients: clients:
wallabag_core: wallabag_core:
factory: 'wallabag_core.http_client_factory' factory: Wallabag\CoreBundle\Helper\HttpClientFactory
config: config:
defaults: defaults:
timeout: 10 timeout: 10

View file

@ -2,17 +2,17 @@ parameters:
lexik_form_filter.get_filter.doctrine_orm.class: Wallabag\CoreBundle\Event\Subscriber\CustomDoctrineORMSubscriber lexik_form_filter.get_filter.doctrine_orm.class: Wallabag\CoreBundle\Event\Subscriber\CustomDoctrineORMSubscriber
services: services:
twig.extension.text: Twig_Extensions_Extension_Text:
class: Twig_Extensions_Extension_Text class: Twig_Extensions_Extension_Text
tags: tags:
- { name: twig.extension } - { name: twig.extension }
wallabag.twig_extension: Wallabag\CoreBundle\Twig\WallabagExtension:
class: Wallabag\CoreBundle\Twig\WallabagExtension class: Wallabag\CoreBundle\Twig\WallabagExtension
public: false public: false
arguments: arguments:
- "@wallabag_core.entry_repository" - '@Wallabag\CoreBundle\Repository\EntryRepository'
- "@wallabag_core.tag_repository" - '@Wallabag\CoreBundle\Repository\TagRepository'
- "@security.token_storage" - "@security.token_storage"
- "%wallabag_core.cache_lifetime%" - "%wallabag_core.cache_lifetime%"
- "@translator" - "@translator"
@ -20,19 +20,19 @@ services:
tags: tags:
- { name: twig.extension } - { name: twig.extension }
wallabag.twig_matomo_extension: MatomoTwigExtension\MatomoTwigExtension:
class: MatomoTwigExtension\MatomoTwigExtension class: MatomoTwigExtension\MatomoTwigExtension
public: false public: false
tags: tags:
- { name: twig.extension } - { name: twig.extension }
wallabag.locale_listener: Wallabag\CoreBundle\Event\Listener\LocaleListener:
class: Wallabag\CoreBundle\Event\Listener\LocaleListener class: Wallabag\CoreBundle\Event\Listener\LocaleListener
arguments: ["%kernel.default_locale%"] arguments: ["%kernel.default_locale%"]
tags: tags:
- { name: kernel.event_subscriber } - { name: kernel.event_subscriber }
wallabag.user_locale_listener: Wallabag\CoreBundle\Event\Listener\UserLocaleListener:
class: Wallabag\CoreBundle\Event\Listener\UserLocaleListener class: Wallabag\CoreBundle\Event\Listener\UserLocaleListener
arguments: ["@session"] arguments: ["@session"]
tags: tags:

View file

@ -9,11 +9,11 @@ services:
public: true public: true
wallabag_core.entry_repository.test: wallabag_core.entry_repository.test:
alias: wallabag_core.entry_repository alias: Wallabag\CoreBundle\Repository\EntryRepository
public: true public: true
wallabag_user.user_repository.test: wallabag_user.user_repository.test:
alias: wallabag_user.user_repository alias: Wallabag\UserBundle\Repository\UserRepository
public: true public: true
filesystem_cache: filesystem_cache:

View file

@ -14,7 +14,11 @@ use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Event\EntryDeletedEvent; use Wallabag\CoreBundle\Event\EntryDeletedEvent;
use Wallabag\CoreBundle\Event\EntrySavedEvent; use Wallabag\CoreBundle\Event\EntrySavedEvent;
use Wallabag\CoreBundle\Helper\ContentProxy;
use Wallabag\CoreBundle\Helper\EntriesExport;
use Wallabag\CoreBundle\Helper\TagsAssigner;
use Wallabag\CoreBundle\Helper\UrlHasher; use Wallabag\CoreBundle\Helper\UrlHasher;
use Wallabag\CoreBundle\Repository\EntryRepository;
class EntryRestController extends WallabagRestController class EntryRestController extends WallabagRestController
{ {
@ -135,7 +139,7 @@ class EntryRestController extends WallabagRestController
try { try {
/** @var \Pagerfanta\Pagerfanta $pager */ /** @var \Pagerfanta\Pagerfanta $pager */
$pager = $this->get('wallabag_core.entry_repository')->findEntries( $pager = $this->get(EntryRepository::class)->findEntries(
$this->getUser()->getId(), $this->getUser()->getId(),
$isArchived, $isArchived,
$isStarred, $isStarred,
@ -212,7 +216,7 @@ class EntryRestController extends WallabagRestController
$this->validateAuthentication(); $this->validateAuthentication();
$this->validateUserAccess($entry->getUser()->getId()); $this->validateUserAccess($entry->getUser()->getId());
return $this->get('wallabag_core.helper.entries_export') return $this->get(EntriesExport::class)
->setEntries($entry) ->setEntries($entry)
->updateTitle('entry') ->updateTitle('entry')
->updateAuthor('entry') ->updateAuthor('entry')
@ -244,7 +248,7 @@ class EntryRestController extends WallabagRestController
// handle multiple urls // handle multiple urls
foreach ($urls as $key => $url) { foreach ($urls as $key => $url) {
$entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId( $entry = $this->get(EntryRepository::class)->findByUrlAndUserId(
$url, $url,
$this->getUser()->getId() $this->getUser()->getId()
); );
@ -298,7 +302,7 @@ class EntryRestController extends WallabagRestController
// handle multiple urls // handle multiple urls
foreach ($urls as $key => $url) { foreach ($urls as $key => $url) {
$entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId( $entry = $this->get(EntryRepository::class)->findByUrlAndUserId(
$url, $url,
$this->getUser()->getId() $this->getUser()->getId()
); );
@ -308,7 +312,7 @@ class EntryRestController extends WallabagRestController
if (false === $entry) { if (false === $entry) {
$entry = new Entry($this->getUser()); $entry = new Entry($this->getUser());
$this->get('wallabag_core.content_proxy')->updateEntry($entry, $url); $this->get(ContentProxy::class)->updateEntry($entry, $url);
} }
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
@ -355,7 +359,7 @@ class EntryRestController extends WallabagRestController
$url = $request->request->get('url'); $url = $request->request->get('url');
$entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId( $entry = $this->get(EntryRepository::class)->findByUrlAndUserId(
$url, $url,
$this->getUser()->getId() $this->getUser()->getId()
); );
@ -368,7 +372,7 @@ class EntryRestController extends WallabagRestController
$data = $this->retrieveValueFromRequest($request); $data = $this->retrieveValueFromRequest($request);
try { try {
$this->get('wallabag_core.content_proxy')->updateEntry( $this->get(ContentProxy::class)->updateEntry(
$entry, $entry,
$entry->getUrl(), $entry->getUrl(),
[ [
@ -398,7 +402,7 @@ class EntryRestController extends WallabagRestController
} }
if (!empty($data['tags'])) { if (!empty($data['tags'])) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']); $this->get(TagsAssigner::class)->assignTagsToEntry($entry, $data['tags']);
} }
if (!empty($data['origin_url'])) { if (!empty($data['origin_url'])) {
@ -414,11 +418,11 @@ class EntryRestController extends WallabagRestController
} }
if (empty($entry->getDomainName())) { if (empty($entry->getDomainName())) {
$this->get('wallabag_core.content_proxy')->setEntryDomainName($entry); $this->get(ContentProxy::class)->setEntryDomainName($entry);
} }
if (empty($entry->getTitle())) { if (empty($entry->getTitle())) {
$this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry); $this->get(ContentProxy::class)->setDefaultEntryTitle($entry);
} }
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
@ -460,7 +464,7 @@ class EntryRestController extends WallabagRestController
$this->validateAuthentication(); $this->validateAuthentication();
$this->validateUserAccess($entry->getUser()->getId()); $this->validateUserAccess($entry->getUser()->getId());
$contentProxy = $this->get('wallabag_core.content_proxy'); $contentProxy = $this->get(ContentProxy::class);
$data = $this->retrieveValueFromRequest($request); $data = $this->retrieveValueFromRequest($request);
@ -515,7 +519,7 @@ class EntryRestController extends WallabagRestController
if (!empty($data['tags'])) { if (!empty($data['tags'])) {
$entry->removeAllTags(); $entry->removeAllTags();
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']); $this->get(TagsAssigner::class)->assignTagsToEntry($entry, $data['tags']);
} }
if (null !== $data['isPublic']) { if (null !== $data['isPublic']) {
@ -531,11 +535,11 @@ class EntryRestController extends WallabagRestController
} }
if (empty($entry->getDomainName())) { if (empty($entry->getDomainName())) {
$this->get('wallabag_core.content_proxy')->setEntryDomainName($entry); $this->get(ContentProxy::class)->setEntryDomainName($entry);
} }
if (empty($entry->getTitle())) { if (empty($entry->getTitle())) {
$this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry); $this->get(ContentProxy::class)->setDefaultEntryTitle($entry);
} }
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
@ -566,7 +570,7 @@ class EntryRestController extends WallabagRestController
$this->validateUserAccess($entry->getUser()->getId()); $this->validateUserAccess($entry->getUser()->getId());
try { try {
$this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); $this->get(ContentProxy::class)->updateEntry($entry, $entry->getUrl());
} catch (\Exception $e) { } catch (\Exception $e) {
$this->get('logger')->error('Error while saving an entry', [ $this->get('logger')->error('Error while saving an entry', [
'exception' => $e, 'exception' => $e,
@ -673,7 +677,7 @@ class EntryRestController extends WallabagRestController
$tags = $request->request->get('tags', ''); $tags = $request->request->get('tags', '');
if (!empty($tags)) { if (!empty($tags)) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags); $this->get(TagsAssigner::class)->assignTagsToEntry($entry, $tags);
} }
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
@ -733,7 +737,7 @@ class EntryRestController extends WallabagRestController
$results = []; $results = [];
foreach ($list as $key => $element) { foreach ($list as $key => $element) {
$entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId( $entry = $this->get(EntryRepository::class)->findByUrlAndUserId(
$element->url, $element->url,
$this->getUser()->getId() $this->getUser()->getId()
); );
@ -791,7 +795,7 @@ class EntryRestController extends WallabagRestController
// handle multiple urls // handle multiple urls
foreach ($list as $key => $element) { foreach ($list as $key => $element) {
$entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId( $entry = $this->get(EntryRepository::class)->findByUrlAndUserId(
$element->url, $element->url,
$this->getUser()->getId() $this->getUser()->getId()
); );
@ -802,7 +806,7 @@ class EntryRestController extends WallabagRestController
$tags = $element->tags; $tags = $element->tags;
if (false !== $entry && !(empty($tags))) { if (false !== $entry && !(empty($tags))) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags); $this->get(TagsAssigner::class)->assignTagsToEntry($entry, $tags);
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($entry); $em->persist($entry);

View file

@ -9,6 +9,7 @@ use Pagerfanta\Doctrine\ORM\QueryAdapter as DoctrineORMAdapter;
use Pagerfanta\Pagerfanta; use Pagerfanta\Pagerfanta;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Wallabag\CoreBundle\Repository\EntryRepository;
class SearchRestController extends WallabagRestController class SearchRestController extends WallabagRestController
{ {
@ -33,7 +34,7 @@ class SearchRestController extends WallabagRestController
$page = (int) $request->query->get('page', 1); $page = (int) $request->query->get('page', 1);
$perPage = (int) $request->query->get('perPage', 30); $perPage = (int) $request->query->get('perPage', 30);
$qb = $this->get('wallabag_core.entry_repository') $qb = $this->get(EntryRepository::class)
->getBuilderForSearchByUser( ->getBuilderForSearchByUser(
$this->getUser()->getId(), $this->getUser()->getId(),
$term, $term,

View file

@ -8,6 +8,8 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
use Wallabag\CoreBundle\Helper\DownloadImages;
use Wallabag\CoreBundle\Repository\EntryRepository;
class CleanDownloadedImagesCommand extends ContainerAwareCommand class CleanDownloadedImagesCommand extends ContainerAwareCommand
{ {
@ -34,7 +36,7 @@ class CleanDownloadedImagesCommand extends ContainerAwareCommand
$io->text('Dry run mode <info>enabled</info> (no images will be removed)'); $io->text('Dry run mode <info>enabled</info> (no images will be removed)');
} }
$downloadImages = $this->getContainer()->get('wallabag_core.entry.download_images'); $downloadImages = $this->getContainer()->get(DownloadImages::class);
$baseFolder = $downloadImages->getBaseFolder(); $baseFolder = $downloadImages->getBaseFolder();
$io->text('Retrieve existing images'); $io->text('Retrieve existing images');
@ -56,7 +58,7 @@ class CleanDownloadedImagesCommand extends ContainerAwareCommand
$io->text('Retrieve valid folders attached to a user'); $io->text('Retrieve valid folders attached to a user');
$entries = $this->getContainer()->get('wallabag_core.entry_repository')->findAllEntriesIdByUserId(); $entries = $this->getContainer()->get(EntryRepository::class)->findAllEntriesIdByUserId();
// retrieve _valid_ folders from existing entries // retrieve _valid_ folders from existing entries
$validPaths = []; $validPaths = [];

View file

@ -9,7 +9,9 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\UserBundle\Entity\User; use Wallabag\UserBundle\Entity\User;
use Wallabag\UserBundle\Repository\UserRepository;
class CleanDuplicatesCommand extends ContainerAwareCommand class CleanDuplicatesCommand extends ContainerAwareCommand
{ {
@ -49,7 +51,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
$this->io->success('Finished cleaning.'); $this->io->success('Finished cleaning.');
} else { } else {
$users = $this->getContainer()->get('wallabag_user.user_repository')->findAll(); $users = $this->getContainer()->get(UserRepository::class)->findAll();
$this->io->text(sprintf('Cleaning through <info>%d</info> user accounts', \count($users))); $this->io->text(sprintf('Cleaning through <info>%d</info> user accounts', \count($users)));
@ -66,7 +68,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
private function cleanDuplicates(User $user) private function cleanDuplicates(User $user)
{ {
$em = $this->getContainer()->get('doctrine.orm.entity_manager'); $em = $this->getContainer()->get('doctrine.orm.entity_manager');
$repo = $this->getContainer()->get('wallabag_core.entry_repository'); $repo = $this->getContainer()->get(EntryRepository::class);
$entries = $repo->findAllEntriesIdAndUrlByUserId($user->getId()); $entries = $repo->findAllEntriesIdAndUrlByUserId($user->getId());
@ -109,6 +111,6 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
*/ */
private function getUser($username) private function getUser($username)
{ {
return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username); return $this->getContainer()->get(UserRepository::class)->findOneByUserName($username);
} }
} }

View file

@ -8,6 +8,9 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\CoreBundle\Helper\EntriesExport;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\UserBundle\Repository\UserRepository;
class ExportCommand extends ContainerAwareCommand class ExportCommand extends ContainerAwareCommand
{ {
@ -35,14 +38,14 @@ class ExportCommand extends ContainerAwareCommand
$io = new SymfonyStyle($input, $output); $io = new SymfonyStyle($input, $output);
try { try {
$user = $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($input->getArgument('username')); $user = $this->getContainer()->get(UserRepository::class)->findOneByUserName($input->getArgument('username'));
} catch (NoResultException $e) { } catch (NoResultException $e) {
$io->error(sprintf('User "%s" not found.', $input->getArgument('username'))); $io->error(sprintf('User "%s" not found.', $input->getArgument('username')));
return 1; return 1;
} }
$entries = $this->getContainer()->get('wallabag_core.entry_repository') $entries = $this->getContainer()->get(EntryRepository::class)
->getBuilderForAllByUser($user->getId()) ->getBuilderForAllByUser($user->getId())
->getQuery() ->getQuery()
->getResult(); ->getResult();
@ -56,7 +59,7 @@ class ExportCommand extends ContainerAwareCommand
} }
try { try {
$data = $this->getContainer()->get('wallabag_core.helper.entries_export') $data = $this->getContainer()->get(EntriesExport::class)
->setEntries($entries) ->setEntries($entries)
->updateTitle('All') ->updateTitle('All')
->updateAuthor('All') ->updateAuthor('All')

View file

@ -8,6 +8,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\UserBundle\Repository\UserRepository;
class ListUserCommand extends ContainerAwareCommand class ListUserCommand extends ContainerAwareCommand
{ {
@ -26,13 +27,13 @@ class ListUserCommand extends ContainerAwareCommand
{ {
$io = new SymfonyStyle($input, $output); $io = new SymfonyStyle($input, $output);
$users = $this->getContainer()->get('wallabag_user.user_repository') $users = $this->getContainer()->get(UserRepository::class)
->getQueryBuilderForSearch($input->getArgument('search')) ->getQueryBuilderForSearch($input->getArgument('search'))
->setMaxResults($input->getOption('limit')) ->setMaxResults($input->getOption('limit'))
->getQuery() ->getQuery()
->getResult(); ->getResult();
$nbUsers = $this->getContainer()->get('wallabag_user.user_repository') $nbUsers = $this->getContainer()->get(UserRepository::class)
->getSumUsers(); ->getSumUsers();
$rows = []; $rows = [];

View file

@ -9,6 +9,9 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\CoreBundle\Event\EntrySavedEvent; use Wallabag\CoreBundle\Event\EntrySavedEvent;
use Wallabag\CoreBundle\Helper\ContentProxy;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\UserBundle\Repository\UserRepository;
class ReloadEntryCommand extends ContainerAwareCommand class ReloadEntryCommand extends ContainerAwareCommand
{ {
@ -30,7 +33,7 @@ class ReloadEntryCommand extends ContainerAwareCommand
if ($username = $input->getArgument('username')) { if ($username = $input->getArgument('username')) {
try { try {
$userId = $this->getContainer() $userId = $this->getContainer()
->get('wallabag_user.user_repository') ->get(UserRepository::class)
->findOneByUserName($username) ->findOneByUserName($username)
->getId(); ->getId();
} catch (NoResultException $e) { } catch (NoResultException $e) {
@ -40,7 +43,7 @@ class ReloadEntryCommand extends ContainerAwareCommand
} }
} }
$entryRepository = $this->getContainer()->get('wallabag_core.entry_repository'); $entryRepository = $this->getContainer()->get(EntryRepository::class);
$entryIds = $entryRepository->findAllEntriesIdByUserId($userId); $entryIds = $entryRepository->findAllEntriesIdByUserId($userId);
$nbEntries = \count($entryIds); $nbEntries = \count($entryIds);
@ -63,7 +66,7 @@ class ReloadEntryCommand extends ContainerAwareCommand
$progressBar = $io->createProgressBar($nbEntries); $progressBar = $io->createProgressBar($nbEntries);
$contentProxy = $this->getContainer()->get('wallabag_core.content_proxy'); $contentProxy = $this->getContainer()->get(ContentProxy::class);
$em = $this->getContainer()->get('doctrine')->getManager(); $em = $this->getContainer()->get('doctrine')->getManager();
$dispatcher = $this->getContainer()->get('event_dispatcher'); $dispatcher = $this->getContainer()->get('event_dispatcher');

View file

@ -9,6 +9,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\UserBundle\Entity\User; use Wallabag\UserBundle\Entity\User;
use Wallabag\UserBundle\Repository\UserRepository;
class ShowUserCommand extends ContainerAwareCommand class ShowUserCommand extends ContainerAwareCommand
{ {
@ -68,6 +69,6 @@ class ShowUserCommand extends ContainerAwareCommand
*/ */
private function getUser($username) private function getUser($username)
{ {
return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username); return $this->getContainer()->get(UserRepository::class)->findOneByUserName($username);
} }
} }

View file

@ -8,6 +8,8 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\CoreBundle\Helper\RuleBasedTagger;
use Wallabag\UserBundle\Repository\UserRepository;
class TagAllCommand extends ContainerAwareCommand class TagAllCommand extends ContainerAwareCommand
{ {
@ -35,7 +37,7 @@ class TagAllCommand extends ContainerAwareCommand
return 1; return 1;
} }
$tagger = $this->getContainer()->get('wallabag_core.rule_based_tagger'); $tagger = $this->getContainer()->get(RuleBasedTagger::class);
$io->text(sprintf('Tagging entries for user <info>%s</info>...', $user->getUserName())); $io->text(sprintf('Tagging entries for user <info>%s</info>...', $user->getUserName()));
@ -63,7 +65,7 @@ class TagAllCommand extends ContainerAwareCommand
*/ */
private function getUser($username) private function getUser($username)
{ {
return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username); return $this->getContainer()->get(UserRepository::class)->findOneByUserName($username);
} }
private function getDoctrine() private function getDoctrine()

View file

@ -24,7 +24,10 @@ use Wallabag\CoreBundle\Form\Type\IgnoreOriginUserRuleType;
use Wallabag\CoreBundle\Form\Type\TaggingRuleImportType; use Wallabag\CoreBundle\Form\Type\TaggingRuleImportType;
use Wallabag\CoreBundle\Form\Type\TaggingRuleType; use Wallabag\CoreBundle\Form\Type\TaggingRuleType;
use Wallabag\CoreBundle\Form\Type\UserInformationType; use Wallabag\CoreBundle\Form\Type\UserInformationType;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\CoreBundle\Repository\TagRepository;
use Wallabag\CoreBundle\Tools\Utils; use Wallabag\CoreBundle\Tools\Utils;
use Wallabag\UserBundle\Repository\UserRepository;
class ConfigController extends Controller class ConfigController extends Controller
{ {
@ -236,7 +239,7 @@ class ConfigController extends Controller
], ],
'twofactor_auth' => $this->getParameter('twofactor_auth'), 'twofactor_auth' => $this->getParameter('twofactor_auth'),
'wallabag_url' => $this->getParameter('domain_name'), 'wallabag_url' => $this->getParameter('domain_name'),
'enabled_users' => $this->get('wallabag_user.user_repository')->getSumEnabledUsers(), 'enabled_users' => $this->get(UserRepository::class)->getSumEnabledUsers(),
]); ]);
} }
@ -561,7 +564,7 @@ class ConfigController extends Controller
// manually remove tags to avoid orphan tag // manually remove tags to avoid orphan tag
$this->removeAllTagsByUserId($this->getUser()->getId()); $this->removeAllTagsByUserId($this->getUser()->getId());
$this->get('wallabag_core.entry_repository')->removeAllByUserId($this->getUser()->getId()); $this->get(EntryRepository::class)->removeAllByUserId($this->getUser()->getId());
break; break;
case 'archived': case 'archived':
if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
@ -571,7 +574,7 @@ class ConfigController extends Controller
// manually remove tags to avoid orphan tag // manually remove tags to avoid orphan tag
$this->removeTagsForArchivedByUserId($this->getUser()->getId()); $this->removeTagsForArchivedByUserId($this->getUser()->getId());
$this->get('wallabag_core.entry_repository')->removeArchivedByUserId($this->getUser()->getId()); $this->get(EntryRepository::class)->removeArchivedByUserId($this->getUser()->getId());
break; break;
} }
@ -594,7 +597,7 @@ class ConfigController extends Controller
*/ */
public function deleteAccountAction(Request $request) public function deleteAccountAction(Request $request)
{ {
$enabledUsers = $this->get('wallabag_user.user_repository') $enabledUsers = $this->get(UserRepository::class)
->getSumEnabledUsers(); ->getSumEnabledUsers();
if ($enabledUsers <= 1) { if ($enabledUsers <= 1) {
@ -690,7 +693,7 @@ class ConfigController extends Controller
return; return;
} }
$this->get('wallabag_core.entry_repository') $this->get(EntryRepository::class)
->removeTags($userId, $tags); ->removeTags($userId, $tags);
// cleanup orphan tags // cleanup orphan tags
@ -712,7 +715,7 @@ class ConfigController extends Controller
*/ */
private function removeAllTagsByUserId($userId) private function removeAllTagsByUserId($userId)
{ {
$tags = $this->get('wallabag_core.tag_repository')->findAllTags($userId); $tags = $this->get(TagRepository::class)->findAllTags($userId);
$this->removeAllTagsByStatusAndUserId($tags, $userId); $this->removeAllTagsByStatusAndUserId($tags, $userId);
} }
@ -723,7 +726,7 @@ class ConfigController extends Controller
*/ */
private function removeTagsForArchivedByUserId($userId) private function removeTagsForArchivedByUserId($userId)
{ {
$tags = $this->get('wallabag_core.tag_repository')->findForArchivedArticlesByUser($userId); $tags = $this->get(TagRepository::class)->findForArchivedArticlesByUser($userId);
$this->removeAllTagsByStatusAndUserId($tags, $userId); $this->removeAllTagsByStatusAndUserId($tags, $userId);
} }

View file

@ -18,6 +18,11 @@ use Wallabag\CoreBundle\Form\Type\EditEntryType;
use Wallabag\CoreBundle\Form\Type\EntryFilterType; use Wallabag\CoreBundle\Form\Type\EntryFilterType;
use Wallabag\CoreBundle\Form\Type\NewEntryType; use Wallabag\CoreBundle\Form\Type\NewEntryType;
use Wallabag\CoreBundle\Form\Type\SearchEntryType; use Wallabag\CoreBundle\Form\Type\SearchEntryType;
use Wallabag\CoreBundle\Helper\ContentProxy;
use Wallabag\CoreBundle\Helper\PreparePagerForEntries;
use Wallabag\CoreBundle\Helper\Redirect;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\CoreBundle\Repository\TagRepository;
class EntryController extends Controller class EntryController extends Controller
{ {
@ -55,7 +60,7 @@ class EntryController extends Controller
$label = substr($label, 1); $label = substr($label, 1);
$remove = true; $remove = true;
} }
$tag = $this->get('wallabag_core.tag_repository')->findOneByLabel($label); $tag = $this->get(TagRepository::class)->findOneByLabel($label);
if ($remove) { if ($remove) {
if (null !== $tag) { if (null !== $tag) {
$tagsToRemove[] = $tag; $tagsToRemove[] = $tag;
@ -74,7 +79,7 @@ class EntryController extends Controller
if (isset($values['entry-checkbox'])) { if (isset($values['entry-checkbox'])) {
foreach ($values['entry-checkbox'] as $id) { foreach ($values['entry-checkbox'] as $id) {
/** @var Entry * */ /** @var Entry * */
$entry = $this->get('wallabag_core.entry_repository')->findById((int) $id)[0]; $entry = $this->get(EntryRepository::class)->findById((int) $id)[0];
$this->checkUserAction($entry); $this->checkUserAction($entry);
@ -98,7 +103,7 @@ class EntryController extends Controller
$em->flush(); $em->flush();
} }
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer')); $redirectUrl = $this->get(Redirect::class)->to($request->headers->get('referer'));
return $this->redirect($redirectUrl); return $this->redirect($redirectUrl);
} }
@ -269,7 +274,7 @@ class EntryController extends Controller
public function showUnreadAction(Request $request, $page) public function showUnreadAction(Request $request, $page)
{ {
// load the quickstart if no entry in database // load the quickstart if no entry in database
if (1 === (int) $page && 0 === $this->get('wallabag_core.entry_repository')->countAllEntriesByUser($this->getUser()->getId())) { if (1 === (int) $page && 0 === $this->get(EntryRepository::class)->countAllEntriesByUser($this->getUser()->getId())) {
return $this->redirect($this->generateUrl('quickstart')); return $this->redirect($this->generateUrl('quickstart'));
} }
@ -344,7 +349,7 @@ class EntryController extends Controller
public function redirectRandomEntryAction($type = 'all') public function redirectRandomEntryAction($type = 'all')
{ {
try { try {
$entry = $this->get('wallabag_core.entry_repository') $entry = $this->get(EntryRepository::class)
->getRandomEntry($this->getUser()->getId(), $type); ->getRandomEntry($this->getUser()->getId(), $type);
} catch (NoResultException $e) { } catch (NoResultException $e) {
$bag = $this->get('session')->getFlashBag(); $bag = $this->get('session')->getFlashBag();
@ -431,7 +436,7 @@ class EntryController extends Controller
$message $message
); );
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer')); $redirectUrl = $this->get(Redirect::class)->to($request->headers->get('referer'));
return $this->redirect($redirectUrl); return $this->redirect($redirectUrl);
} }
@ -461,7 +466,7 @@ class EntryController extends Controller
$message $message
); );
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer')); $redirectUrl = $this->get(Redirect::class)->to($request->headers->get('referer'));
return $this->redirect($redirectUrl); return $this->redirect($redirectUrl);
} }
@ -501,7 +506,7 @@ class EntryController extends Controller
$referer = $request->headers->get('referer'); $referer = $request->headers->get('referer');
$to = (1 !== preg_match('#' . $url . '$#i', $referer) ? $referer : null); $to = (1 !== preg_match('#' . $url . '$#i', $referer) ? $referer : null);
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($to); $redirectUrl = $this->get(Redirect::class)->to($to);
return $this->redirect($redirectUrl); return $this->redirect($redirectUrl);
} }
@ -597,7 +602,7 @@ class EntryController extends Controller
*/ */
private function showEntries($type, Request $request, $page) private function showEntries($type, Request $request, $page)
{ {
$repository = $this->get('wallabag_core.entry_repository'); $repository = $this->get(EntryRepository::class);
$searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : '');
$currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : '');
@ -647,7 +652,7 @@ class EntryController extends Controller
$pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false); $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false);
$entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare($pagerAdapter); $entries = $this->get(PreparePagerForEntries::class)->prepare($pagerAdapter);
try { try {
$entries->setCurrentPage($page); $entries->setCurrentPage($page);
@ -657,7 +662,7 @@ class EntryController extends Controller
} }
} }
$nbEntriesUntagged = $this->get('wallabag_core.entry_repository') $nbEntriesUntagged = $this->get(EntryRepository::class)
->countUntaggedEntriesByUser($this->getUser()->getId()); ->countUntaggedEntriesByUser($this->getUser()->getId());
return $this->render( return $this->render(
@ -683,7 +688,7 @@ class EntryController extends Controller
$message = 'flashes.entry.notice.' . $prefixMessage; $message = 'flashes.entry.notice.' . $prefixMessage;
try { try {
$this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); $this->get(ContentProxy::class)->updateEntry($entry, $entry->getUrl());
} catch (\Exception $e) { } catch (\Exception $e) {
$this->get('logger')->error('Error while saving an entry', [ $this->get('logger')->error('Error while saving an entry', [
'exception' => $e, 'exception' => $e,
@ -694,11 +699,11 @@ class EntryController extends Controller
} }
if (empty($entry->getDomainName())) { if (empty($entry->getDomainName())) {
$this->get('wallabag_core.content_proxy')->setEntryDomainName($entry); $this->get(ContentProxy::class)->setEntryDomainName($entry);
} }
if (empty($entry->getTitle())) { if (empty($entry->getTitle())) {
$this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry); $this->get(ContentProxy::class)->setDefaultEntryTitle($entry);
} }
$this->get('session')->getFlashBag()->add('notice', $message); $this->get('session')->getFlashBag()->add('notice', $message);
@ -721,6 +726,6 @@ class EntryController extends Controller
*/ */
private function checkIfEntryAlreadyExists(Entry $entry) private function checkIfEntryAlreadyExists(Entry $entry)
{ {
return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId()); return $this->get(EntryRepository::class)->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId());
} }
} }

View file

@ -7,6 +7,9 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Helper\EntriesExport;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\CoreBundle\Repository\TagRepository;
/** /**
* The try/catch can be removed once all formats will be implemented. * The try/catch can be removed once all formats will be implemented.
@ -29,7 +32,7 @@ class ExportController extends Controller
public function downloadEntryAction(Entry $entry, $format) public function downloadEntryAction(Entry $entry, $format)
{ {
try { try {
return $this->get('wallabag_core.helper.entries_export') return $this->get(EntriesExport::class)
->setEntries($entry) ->setEntries($entry)
->updateTitle('entry') ->updateTitle('entry')
->updateAuthor('entry') ->updateAuthor('entry')
@ -56,11 +59,11 @@ class ExportController extends Controller
{ {
$method = ucfirst($category); $method = ucfirst($category);
$methodBuilder = 'getBuilderFor' . $method . 'ByUser'; $methodBuilder = 'getBuilderFor' . $method . 'ByUser';
$repository = $this->get('wallabag_core.entry_repository'); $repository = $this->get(EntryRepository::class);
$title = $method; $title = $method;
if ('tag_entries' === $category) { if ('tag_entries' === $category) {
$tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag')); $tag = $this->get(TagRepository::class)->findOneBySlug($request->query->get('tag'));
$entries = $repository->findAllByTagId( $entries = $repository->findAllByTagId(
$this->getUser()->getId(), $this->getUser()->getId(),
@ -95,7 +98,7 @@ class ExportController extends Controller
} }
try { try {
return $this->get('wallabag_core.helper.entries_export') return $this->get(EntriesExport::class)
->setEntries($entries) ->setEntries($entries)
->updateTitle($title) ->updateTitle($title)
->updateAuthor($method) ->updateAuthor($method)

View file

@ -14,6 +14,8 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Helper\PreparePagerForEntries;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\UserBundle\Entity\User; use Wallabag\UserBundle\Entity\User;
class FeedController extends Controller class FeedController extends Controller
@ -113,7 +115,7 @@ class FeedController extends Controller
UrlGeneratorInterface::ABSOLUTE_URL UrlGeneratorInterface::ABSOLUTE_URL
); );
$entriesByTag = $this->get('wallabag_core.entry_repository')->findAllByTagId( $entriesByTag = $this->get(EntryRepository::class)->findAllByTagId(
$user->getId(), $user->getId(),
$tag->getId(), $tag->getId(),
$sorts[$sort] $sorts[$sort]
@ -121,7 +123,7 @@ class FeedController extends Controller
$pagerAdapter = new ArrayAdapter($entriesByTag); $pagerAdapter = new ArrayAdapter($entriesByTag);
$entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare( $entries = $this->get(PreparePagerForEntries::class)->prepare(
$pagerAdapter, $pagerAdapter,
$user $user
); );
@ -184,7 +186,7 @@ class FeedController extends Controller
*/ */
private function showEntries($type, User $user, $page = 1) private function showEntries($type, User $user, $page = 1)
{ {
$repository = $this->get('wallabag_core.entry_repository'); $repository = $this->get(EntryRepository::class);
switch ($type) { switch ($type) {
case 'starred': case 'starred':

View file

@ -6,6 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule; use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule;
use Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository;
/** /**
* IgnoreOriginInstanceRuleController controller. * IgnoreOriginInstanceRuleController controller.
@ -21,7 +22,7 @@ class IgnoreOriginInstanceRuleController extends Controller
*/ */
public function indexAction() public function indexAction()
{ {
$rules = $this->get('wallabag_core.ignore_origin_instance_rule_repository')->findAll(); $rules = $this->get(IgnoreOriginInstanceRuleRepository::class)->findAll();
return $this->render('WallabagCoreBundle:IgnoreOriginInstanceRule:index.html.twig', [ return $this->render('WallabagCoreBundle:IgnoreOriginInstanceRule:index.html.twig', [
'rules' => $rules, 'rules' => $rules,

View file

@ -6,6 +6,8 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Wallabag\CoreBundle\Entity\SiteCredential; use Wallabag\CoreBundle\Entity\SiteCredential;
use Wallabag\CoreBundle\Helper\CryptoProxy;
use Wallabag\CoreBundle\Repository\SiteCredentialRepository;
use Wallabag\UserBundle\Entity\User; use Wallabag\UserBundle\Entity\User;
/** /**
@ -24,7 +26,7 @@ class SiteCredentialController extends Controller
{ {
$this->isSiteCredentialsEnabled(); $this->isSiteCredentialsEnabled();
$credentials = $this->get('wallabag_core.site_credential_repository')->findByUser($this->getUser()); $credentials = $this->get(SiteCredentialRepository::class)->findByUser($this->getUser());
return $this->render('WallabagCoreBundle:SiteCredential:index.html.twig', [ return $this->render('WallabagCoreBundle:SiteCredential:index.html.twig', [
'credentials' => $credentials, 'credentials' => $credentials,
@ -48,8 +50,8 @@ class SiteCredentialController extends Controller
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$credential->setUsername($this->get('wallabag_core.helper.crypto_proxy')->crypt($credential->getUsername())); $credential->setUsername($this->get(CryptoProxy::class)->crypt($credential->getUsername()));
$credential->setPassword($this->get('wallabag_core.helper.crypto_proxy')->crypt($credential->getPassword())); $credential->setPassword($this->get(CryptoProxy::class)->crypt($credential->getPassword()));
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($credential); $em->persist($credential);
@ -87,8 +89,8 @@ class SiteCredentialController extends Controller
$editForm->handleRequest($request); $editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) { if ($editForm->isSubmitted() && $editForm->isValid()) {
$siteCredential->setUsername($this->get('wallabag_core.helper.crypto_proxy')->crypt($siteCredential->getUsername())); $siteCredential->setUsername($this->get(CryptoProxy::class)->crypt($siteCredential->getUsername()));
$siteCredential->setPassword($this->get('wallabag_core.helper.crypto_proxy')->crypt($siteCredential->getPassword())); $siteCredential->setPassword($this->get(CryptoProxy::class)->crypt($siteCredential->getPassword()));
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($siteCredential); $em->persist($siteCredential);

View file

@ -13,6 +13,11 @@ use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Form\Type\NewTagType; use Wallabag\CoreBundle\Form\Type\NewTagType;
use Wallabag\CoreBundle\Form\Type\RenameTagType; use Wallabag\CoreBundle\Form\Type\RenameTagType;
use Wallabag\CoreBundle\Helper\PreparePagerForEntries;
use Wallabag\CoreBundle\Helper\Redirect;
use Wallabag\CoreBundle\Helper\TagsAssigner;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\CoreBundle\Repository\TagRepository;
class TagController extends Controller class TagController extends Controller
{ {
@ -27,7 +32,7 @@ class TagController extends Controller
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry( $this->get(TagsAssigner::class)->assignTagsToEntry(
$entry, $entry,
$form->get('label')->getData() $form->get('label')->getData()
); );
@ -69,7 +74,7 @@ class TagController extends Controller
$em->flush(); $em->flush();
} }
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'), '', true); $redirectUrl = $this->get(Redirect::class)->to($request->headers->get('referer'), '', true);
return $this->redirect($redirectUrl); return $this->redirect($redirectUrl);
} }
@ -83,9 +88,9 @@ class TagController extends Controller
*/ */
public function showTagAction() public function showTagAction()
{ {
$tags = $this->get('wallabag_core.tag_repository') $tags = $this->get(TagRepository::class)
->findAllFlatTagsWithNbEntries($this->getUser()->getId()); ->findAllFlatTagsWithNbEntries($this->getUser()->getId());
$nbEntriesUntagged = $this->get('wallabag_core.entry_repository') $nbEntriesUntagged = $this->get(EntryRepository::class)
->countUntaggedEntriesByUser($this->getUser()->getId()); ->countUntaggedEntriesByUser($this->getUser()->getId());
$renameForms = []; $renameForms = [];
@ -110,14 +115,14 @@ class TagController extends Controller
*/ */
public function showEntriesForTagAction(Tag $tag, $page, Request $request) public function showEntriesForTagAction(Tag $tag, $page, Request $request)
{ {
$entriesByTag = $this->get('wallabag_core.entry_repository')->findAllByTagId( $entriesByTag = $this->get(EntryRepository::class)->findAllByTagId(
$this->getUser()->getId(), $this->getUser()->getId(),
$tag->getId() $tag->getId()
); );
$pagerAdapter = new ArrayAdapter($entriesByTag); $pagerAdapter = new ArrayAdapter($entriesByTag);
$entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare($pagerAdapter); $entries = $this->get(PreparePagerForEntries::class)->prepare($pagerAdapter);
try { try {
$entries->setCurrentPage($page); $entries->setCurrentPage($page);
@ -152,7 +157,7 @@ class TagController extends Controller
$form = $this->createForm(RenameTagType::class, new Tag()); $form = $this->createForm(RenameTagType::class, new Tag());
$form->handleRequest($request); $form->handleRequest($request);
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'), '', true); $redirectUrl = $this->get(Redirect::class)->to($request->headers->get('referer'), '', true);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$newTag = new Tag(); $newTag = new Tag();
@ -162,18 +167,18 @@ class TagController extends Controller
return $this->redirect($redirectUrl); return $this->redirect($redirectUrl);
} }
$tagFromRepo = $this->get('wallabag_core.tag_repository')->findOneByLabel($newTag->getLabel()); $tagFromRepo = $this->get(TagRepository::class)->findOneByLabel($newTag->getLabel());
if (null !== $tagFromRepo) { if (null !== $tagFromRepo) {
$newTag = $tagFromRepo; $newTag = $tagFromRepo;
} }
$entries = $this->get('wallabag_core.entry_repository')->findAllByTagId( $entries = $this->get(EntryRepository::class)->findAllByTagId(
$this->getUser()->getId(), $this->getUser()->getId(),
$tag->getId() $tag->getId()
); );
foreach ($entries as $entry) { foreach ($entries as $entry) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry( $this->get(TagsAssigner::class)->assignTagsToEntry(
$entry, $entry,
$newTag->getLabel(), $newTag->getLabel(),
[$newTag] [$newTag]
@ -204,13 +209,13 @@ class TagController extends Controller
$currentRoute = $request->query->has('currentRoute') ? $request->query->get('currentRoute') : ''; $currentRoute = $request->query->has('currentRoute') ? $request->query->get('currentRoute') : '';
/** @var QueryBuilder $qb */ /** @var QueryBuilder $qb */
$qb = $this->get('wallabag_core.entry_repository')->getBuilderForSearchByUser($this->getUser()->getId(), $filter, $currentRoute); $qb = $this->get(EntryRepository::class)->getBuilderForSearchByUser($this->getUser()->getId(), $filter, $currentRoute);
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$entries = $qb->getQuery()->getResult(); $entries = $qb->getQuery()->getResult();
foreach ($entries as $entry) { foreach ($entries as $entry) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry( $this->get(TagsAssigner::class)->assignTagsToEntry(
$entry, $entry,
$filter $filter
); );
@ -220,7 +225,7 @@ class TagController extends Controller
$em->flush(); $em->flush();
return $this->redirect($this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'), '', true)); return $this->redirect($this->get(Redirect::class)->to($request->headers->get('referer'), '', true));
} }
/** /**
@ -234,7 +239,7 @@ class TagController extends Controller
public function removeTagAction(Tag $tag, Request $request) public function removeTagAction(Tag $tag, Request $request)
{ {
foreach ($tag->getEntriesByUserId($this->getUser()->getId()) as $entry) { foreach ($tag->getEntriesByUserId($this->getUser()->getId()) as $entry) {
$this->get('wallabag_core.entry_repository')->removeTag($this->getUser()->getId(), $tag); $this->get(EntryRepository::class)->removeTag($this->getUser()->getId(), $tag);
} }
// remove orphan tag in case no entries are associated to it // remove orphan tag in case no entries are associated to it
@ -244,7 +249,7 @@ class TagController extends Controller
$em->flush(); $em->flush();
} }
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'), '', true); $redirectUrl = $this->get(Redirect::class)->to($request->headers->get('referer'), '', true);
return $this->redirect($redirectUrl); return $this->redirect($redirectUrl);
} }

View file

@ -8,6 +8,7 @@ use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Wallabag\CoreBundle\Entity\SiteCredential; use Wallabag\CoreBundle\Entity\SiteCredential;
use Wallabag\CoreBundle\Helper\CryptoProxy;
use Wallabag\UserBundle\DataFixtures\UserFixtures; use Wallabag\UserBundle\DataFixtures\UserFixtures;
class SiteCredentialFixtures extends Fixture implements DependentFixtureInterface, ContainerAwareInterface class SiteCredentialFixtures extends Fixture implements DependentFixtureInterface, ContainerAwareInterface
@ -29,15 +30,15 @@ class SiteCredentialFixtures extends Fixture implements DependentFixtureInterfac
{ {
$credential = new SiteCredential($this->getReference('admin-user')); $credential = new SiteCredential($this->getReference('admin-user'));
$credential->setHost('.super.com'); $credential->setHost('.super.com');
$credential->setUsername($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('.super')); $credential->setUsername($this->container->get(CryptoProxy::class)->crypt('.super'));
$credential->setPassword($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('bar')); $credential->setPassword($this->container->get(CryptoProxy::class)->crypt('bar'));
$manager->persist($credential); $manager->persist($credential);
$credential = new SiteCredential($this->getReference('admin-user')); $credential = new SiteCredential($this->getReference('admin-user'));
$credential->setHost('paywall.example.com'); $credential->setHost('paywall.example.com');
$credential->setUsername($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('paywall.example')); $credential->setUsername($this->container->get(CryptoProxy::class)->crypt('paywall.example'));
$credential->setPassword($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('bar')); $credential->setPassword($this->container->get(CryptoProxy::class)->crypt('bar'));
$manager->persist($credential); $manager->persist($credential);

View file

@ -10,7 +10,7 @@ namespace Wallabag\CoreBundle\Operator\Doctrine;
* *
* This operator will be used to compile tagging rules in DQL, usable * This operator will be used to compile tagging rules in DQL, usable
* by Doctrine ORM. * by Doctrine ORM.
* It's registered in RulerZ using a service (wallabag.operator.doctrine.matches); * It's registered in RulerZ using a service;
*/ */
class Matches class Matches
{ {

View file

@ -10,7 +10,7 @@ namespace Wallabag\CoreBundle\Operator\Doctrine;
* *
* This operator will be used to compile tagging rules in DQL, usable * This operator will be used to compile tagging rules in DQL, usable
* by Doctrine ORM. * by Doctrine ORM.
* It's registered in RulerZ using a service (wallabag.operator.doctrine.notmatches); * It's registered in RulerZ using a service;
*/ */
class NotMatches class NotMatches
{ {

View file

@ -10,7 +10,7 @@ namespace Wallabag\CoreBundle\Operator\PHP;
* *
* This operator will be used to compile tagging rules in PHP, usable * This operator will be used to compile tagging rules in PHP, usable
* directly on Entry objects for instance. * directly on Entry objects for instance.
* It's registered in RulerZ using a service (wallabag.operator.array.matches); * It's registered in RulerZ using a service;
*/ */
class Matches class Matches
{ {

View file

@ -10,7 +10,7 @@ namespace Wallabag\CoreBundle\Operator\PHP;
* *
* This operator will be used to compile tagging rules in PHP, usable * This operator will be used to compile tagging rules in PHP, usable
* directly on Entry objects for instance. * directly on Entry objects for instance.
* It's registered in RulerZ using a service (wallabag.operator.array.notmatches); * It's registered in RulerZ using a service;
*/ */
class NotMatches class NotMatches
{ {

View file

@ -10,7 +10,7 @@ namespace Wallabag\CoreBundle\Operator\PHP;
* *
* This operator will be used to compile ignore origin rules in PHP, usable * This operator will be used to compile ignore origin rules in PHP, usable
* directly on Entry objects for instance. * directly on Entry objects for instance.
* It's registered in RulerZ using a service (wallabag.operator.array.pattern_matches); * It's registered in RulerZ using a service;
*/ */
class PatternMatches class PatternMatches
{ {

View file

@ -1,12 +1,12 @@
services: services:
wallabag_core.helper.detect_active_theme: Wallabag\CoreBundle\Helper\DetectActiveTheme:
class: Wallabag\CoreBundle\Helper\DetectActiveTheme class: Wallabag\CoreBundle\Helper\DetectActiveTheme
arguments: arguments:
- "@security.token_storage" - "@security.token_storage"
- "%wallabag_core.theme%" - "%wallabag_core.theme%"
# custom form type # custom form type
wallabag_core.form.type.config: Wallabag\CoreBundle\Form\Type\ConfigType:
class: Wallabag\CoreBundle\Form\Type\ConfigType class: Wallabag\CoreBundle\Form\Type\ConfigType
arguments: arguments:
- "%liip_theme.themes%" - "%liip_theme.themes%"
@ -14,42 +14,42 @@ services:
tags: tags:
- { name: form.type } - { name: form.type }
wallabag_core.filter.type.entry: Wallabag\CoreBundle\Form\Type\EntryFilterType:
class: Wallabag\CoreBundle\Form\Type\EntryFilterType class: Wallabag\CoreBundle\Form\Type\EntryFilterType
arguments: arguments:
- "@wallabag_core.entry_repository" - '@Wallabag\CoreBundle\Repository\EntryRepository'
- "@security.token_storage" - "@security.token_storage"
tags: tags:
- { name: form.type } - { name: form.type }
wallabag_core.param_converter.username_feed_token_converter: Wallabag\CoreBundle\ParamConverter\UsernameFeedTokenConverter:
class: Wallabag\CoreBundle\ParamConverter\UsernameFeedTokenConverter class: Wallabag\CoreBundle\ParamConverter\UsernameFeedTokenConverter
tags: tags:
- { name: request.param_converter, converter: username_feed_token_converter } - { name: request.param_converter, converter: username_feed_token_converter }
arguments: arguments:
- "@doctrine" - "@doctrine"
wallabag_core.subscriber.table_prefix: Wallabag\CoreBundle\Event\Subscriber\TablePrefixSubscriber:
class: Wallabag\CoreBundle\Event\Subscriber\TablePrefixSubscriber class: Wallabag\CoreBundle\Event\Subscriber\TablePrefixSubscriber
arguments: arguments:
- "%database_table_prefix%" - "%database_table_prefix%"
tags: tags:
- { name: doctrine.event_subscriber } - { name: doctrine.event_subscriber }
wallabag_core.graby: Graby\Graby:
class: Graby\Graby class: Graby\Graby
arguments: arguments:
- -
error_message: '%wallabag_core.fetching_error_message%' error_message: '%wallabag_core.fetching_error_message%'
error_message_title: '%wallabag_core.fetching_error_message_title%' error_message_title: '%wallabag_core.fetching_error_message_title%'
- "@wallabag_core.http_client" - "@wallabag_core.http_client"
- "@wallabag_core.graby.config_builder" - '@Graby\SiteConfig\ConfigBuilder'
calls: calls:
- [ setLogger, [ "@logger" ] ] - [ setLogger, [ "@logger" ] ]
tags: tags:
- { name: monolog.logger, channel: graby } - { name: monolog.logger, channel: graby }
wallabag_core.graby.config_builder: Graby\SiteConfig\ConfigBuilder:
class: Graby\SiteConfig\ConfigBuilder class: Graby\SiteConfig\ConfigBuilder
arguments: arguments:
- {} - {}
@ -58,94 +58,94 @@ services:
wallabag_core.http_client: wallabag_core.http_client:
alias: 'httplug.client.wallabag_core' alias: 'httplug.client.wallabag_core'
wallabag_core.guzzle_authenticator.config_builder: Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder:
class: Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder class: Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder
arguments: arguments:
- "@wallabag_core.graby.config_builder" - '@Graby\SiteConfig\ConfigBuilder'
- "@security.token_storage" - "@security.token_storage"
- "@wallabag_core.site_credential_repository" - '@Wallabag\CoreBundle\Repository\SiteCredentialRepository'
- '@logger' - '@logger'
tags: tags:
- { name: monolog.logger, channel: graby } - { name: monolog.logger, channel: graby }
# service alias override # service alias override
bd_guzzle_site_authenticator.site_config_builder: bd_guzzle_site_authenticator.site_config_builder:
alias: wallabag_core.guzzle_authenticator.config_builder alias: Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder
wallabag_core.http_client_factory: Wallabag\CoreBundle\Helper\HttpClientFactory:
class: Wallabag\CoreBundle\Helper\HttpClientFactory class: Wallabag\CoreBundle\Helper\HttpClientFactory
arguments: arguments:
- "@wallabag_core.guzzle.cookie_jar" - '@Wallabag\CoreBundle\Helper\FileCookieJar'
- '@=service(''craue_config'').get(''restricted_access'')' - '@=service(''craue_config'').get(''restricted_access'')'
- '@logger' - '@logger'
calls: calls:
- ["addSubscriber", ["@bd_guzzle_site_authenticator.authenticator_subscriber"]] - ["addSubscriber", ["@bd_guzzle_site_authenticator.authenticator_subscriber"]]
wallabag_core.guzzle.cookie_jar: Wallabag\CoreBundle\Helper\FileCookieJar:
class: Wallabag\CoreBundle\Helper\FileCookieJar class: Wallabag\CoreBundle\Helper\FileCookieJar
arguments: arguments:
- "@logger" - "@logger"
- "%kernel.cache_dir%/cookiejar.json" - "%kernel.cache_dir%/cookiejar.json"
wallabag_core.content_proxy: Wallabag\CoreBundle\Helper\ContentProxy:
class: Wallabag\CoreBundle\Helper\ContentProxy class: Wallabag\CoreBundle\Helper\ContentProxy
arguments: arguments:
- "@wallabag_core.graby" - '@Graby\Graby'
- "@wallabag_core.rule_based_tagger" - '@Wallabag\CoreBundle\Helper\RuleBasedTagger'
- "@wallabag_core.rule_based_ignore_origin_processor" - '@Wallabag\CoreBundle\Helper\RuleBasedIgnoreOriginProcessor'
- "@validator" - "@validator"
- "@logger" - "@logger"
- '%wallabag_core.fetching_error_message%' - '%wallabag_core.fetching_error_message%'
- '@=service(''craue_config'').get(''store_article_headers'')' - '@=service(''craue_config'').get(''store_article_headers'')'
wallabag_core.tags_assigner: Wallabag\CoreBundle\Helper\TagsAssigner:
class: Wallabag\CoreBundle\Helper\TagsAssigner class: Wallabag\CoreBundle\Helper\TagsAssigner
arguments: arguments:
- "@wallabag_core.tag_repository" - '@Wallabag\CoreBundle\Repository\TagRepository'
wallabag_core.rule_based_tagger: Wallabag\CoreBundle\Helper\RuleBasedTagger:
class: Wallabag\CoreBundle\Helper\RuleBasedTagger class: Wallabag\CoreBundle\Helper\RuleBasedTagger
arguments: arguments:
- "@rulerz" - "@rulerz"
- "@wallabag_core.tag_repository" - '@Wallabag\CoreBundle\Repository\TagRepository'
- "@wallabag_core.entry_repository" - '@Wallabag\CoreBundle\Repository\EntryRepository'
- "@logger" - "@logger"
wallabag_core.rule_based_ignore_origin_processor: Wallabag\CoreBundle\Helper\RuleBasedIgnoreOriginProcessor:
class: Wallabag\CoreBundle\Helper\RuleBasedIgnoreOriginProcessor class: Wallabag\CoreBundle\Helper\RuleBasedIgnoreOriginProcessor
arguments: arguments:
- "@rulerz" - "@rulerz"
- "@logger" - "@logger"
- "@wallabag_core.ignore_origin_instance_rule_repository" - '@Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository'
# repository as a service # repository as a service
wallabag_core.entry_repository: Wallabag\CoreBundle\Repository\EntryRepository:
class: Wallabag\CoreBundle\Repository\EntryRepository class: Wallabag\CoreBundle\Repository\EntryRepository
factory: [ "@doctrine.orm.default_entity_manager", getRepository ] factory: [ "@doctrine.orm.default_entity_manager", getRepository ]
arguments: arguments:
- WallabagCoreBundle:Entry - WallabagCoreBundle:Entry
wallabag_core.tag_repository: Wallabag\CoreBundle\Repository\TagRepository:
class: Wallabag\CoreBundle\Repository\TagRepository class: Wallabag\CoreBundle\Repository\TagRepository
factory: [ "@doctrine.orm.default_entity_manager", getRepository ] factory: [ "@doctrine.orm.default_entity_manager", getRepository ]
arguments: arguments:
- WallabagCoreBundle:Tag - WallabagCoreBundle:Tag
wallabag_core.site_credential_repository: Wallabag\CoreBundle\Repository\SiteCredentialRepository:
class: Wallabag\CoreBundle\Repository\SiteCredentialRepository class: Wallabag\CoreBundle\Repository\SiteCredentialRepository
factory: [ "@doctrine.orm.default_entity_manager", getRepository ] factory: [ "@doctrine.orm.default_entity_manager", getRepository ]
arguments: arguments:
- WallabagCoreBundle:SiteCredential - WallabagCoreBundle:SiteCredential
calls: calls:
- [ setCrypto, [ "@wallabag_core.helper.crypto_proxy" ] ] - [ setCrypto, [ '@Wallabag\CoreBundle\Helper\CryptoProxy' ] ]
wallabag_core.ignore_origin_instance_rule_repository: Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository:
class: Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository class: Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository
factory: [ "@doctrine.orm.default_entity_manager", getRepository ] factory: [ "@doctrine.orm.default_entity_manager", getRepository ]
arguments: arguments:
- WallabagCoreBundle:IgnoreOriginInstanceRule - WallabagCoreBundle:IgnoreOriginInstanceRule
wallabag_core.helper.entries_export: Wallabag\CoreBundle\Helper\EntriesExport:
class: Wallabag\CoreBundle\Helper\EntriesExport class: Wallabag\CoreBundle\Helper\EntriesExport
arguments: arguments:
- "@translator" - "@translator"
@ -153,44 +153,44 @@ services:
- web/img/appicon/apple-touch-icon-152.png - web/img/appicon/apple-touch-icon-152.png
- "@security.token_storage" - "@security.token_storage"
wallabag.operator.array.matches: Wallabag\CoreBundle\Operator\PHP\Matches:
class: Wallabag\CoreBundle\Operator\PHP\Matches class: Wallabag\CoreBundle\Operator\PHP\Matches
tags: tags:
- { name: rulerz.operator, target: native, operator: matches } - { name: rulerz.operator, target: native, operator: matches }
wallabag.operator.doctrine.matches: Wallabag\CoreBundle\Operator\Doctrine\Matches:
class: Wallabag\CoreBundle\Operator\Doctrine\Matches class: Wallabag\CoreBundle\Operator\Doctrine\Matches
tags: tags:
- { name: rulerz.operator, target: doctrine, operator: matches, inline: true } - { name: rulerz.operator, target: doctrine, operator: matches, inline: true }
wallabag.operator.array.notmatches: Wallabag\CoreBundle\Operator\PHP\NotMatches:
class: Wallabag\CoreBundle\Operator\PHP\NotMatches class: Wallabag\CoreBundle\Operator\PHP\NotMatches
tags: tags:
- { name: rulerz.operator, target: native, operator: notmatches } - { name: rulerz.operator, target: native, operator: notmatches }
wallabag.operator.doctrine.notmatches: Wallabag\CoreBundle\Operator\Doctrine\NotMatches:
class: Wallabag\CoreBundle\Operator\Doctrine\NotMatches class: Wallabag\CoreBundle\Operator\Doctrine\NotMatches
tags: tags:
- { name: rulerz.operator, target: doctrine, operator: notmatches, inline: true } - { name: rulerz.operator, target: doctrine, operator: notmatches, inline: true }
wallabag.operator.array.pattern_matches: Wallabag\CoreBundle\Operator\PHP\PatternMatches:
class: Wallabag\CoreBundle\Operator\PHP\PatternMatches class: Wallabag\CoreBundle\Operator\PHP\PatternMatches
tags: tags:
- { name: rulerz.operator, target: native, operator: "~" } - { name: rulerz.operator, target: native, operator: "~" }
wallabag_core.helper.redirect: Wallabag\CoreBundle\Helper\Redirect:
class: Wallabag\CoreBundle\Helper\Redirect class: Wallabag\CoreBundle\Helper\Redirect
arguments: arguments:
- "@router" - "@router"
- "@security.token_storage" - "@security.token_storage"
wallabag_core.helper.prepare_pager_for_entries: Wallabag\CoreBundle\Helper\PreparePagerForEntries:
class: Wallabag\CoreBundle\Helper\PreparePagerForEntries class: Wallabag\CoreBundle\Helper\PreparePagerForEntries
arguments: arguments:
- "@security.token_storage" - "@security.token_storage"
- "@router" - "@router"
wallabag_core.redis.client: Predis\Client:
class: Predis\Client class: Predis\Client
arguments: arguments:
- -
@ -200,31 +200,31 @@ services:
path: '%redis_path%' path: '%redis_path%'
password: '%redis_password%' password: '%redis_password%'
wallabag_core.exception_controller: Wallabag\CoreBundle\Controller\ExceptionController:
class: Wallabag\CoreBundle\Controller\ExceptionController class: Wallabag\CoreBundle\Controller\ExceptionController
public: true public: true
arguments: arguments:
- '@twig' - '@twig'
- '%kernel.debug%' - '%kernel.debug%'
wallabag_core.subscriber.sqlite_cascade_delete: Wallabag\CoreBundle\Event\Subscriber\SQLiteCascadeDeleteSubscriber:
class: Wallabag\CoreBundle\Event\Subscriber\SQLiteCascadeDeleteSubscriber class: Wallabag\CoreBundle\Event\Subscriber\SQLiteCascadeDeleteSubscriber
arguments: arguments:
- "@doctrine" - "@doctrine"
tags: tags:
- { name: doctrine.event_subscriber } - { name: doctrine.event_subscriber }
wallabag_core.subscriber.download_images: Wallabag\CoreBundle\Event\Subscriber\DownloadImagesSubscriber:
class: Wallabag\CoreBundle\Event\Subscriber\DownloadImagesSubscriber class: Wallabag\CoreBundle\Event\Subscriber\DownloadImagesSubscriber
arguments: arguments:
- "@doctrine.orm.default_entity_manager" - "@doctrine.orm.default_entity_manager"
- "@wallabag_core.entry.download_images" - '@Wallabag\CoreBundle\Helper\DownloadImages'
- '@=service(''craue_config'').get(''download_images_enabled'')' - '@=service(''craue_config'').get(''download_images_enabled'')'
- "@logger" - "@logger"
tags: tags:
- { name: kernel.event_subscriber } - { name: kernel.event_subscriber }
wallabag_core.entry.download_images: Wallabag\CoreBundle\Helper\DownloadImages:
class: Wallabag\CoreBundle\Helper\DownloadImages class: Wallabag\CoreBundle\Helper\DownloadImages
arguments: arguments:
- "@wallabag_core.entry.download_images.client" - "@wallabag_core.entry.download_images.client"
@ -235,44 +235,12 @@ services:
wallabag_core.entry.download_images.client: wallabag_core.entry.download_images.client:
alias: 'httplug.client.wallabag_core.entry.download_images' alias: 'httplug.client.wallabag_core.entry.download_images'
wallabag_core.helper.crypto_proxy: Wallabag\CoreBundle\Helper\CryptoProxy:
class: Wallabag\CoreBundle\Helper\CryptoProxy class: Wallabag\CoreBundle\Helper\CryptoProxy
arguments: arguments:
- "%wallabag_core.site_credentials.encryption_key_path%" - "%wallabag_core.site_credentials.encryption_key_path%"
- "@logger" - "@logger"
wallabag_core.command.clean_downloaded_images: Wallabag\CoreBundle\Command\:
class: Wallabag\CoreBundle\Command\CleanDownloadedImagesCommand resource: ../../Command/*
tags: ['console.command'] autoconfigure: true
wallabag_core.command.clean_duplicates:
class: Wallabag\CoreBundle\Command\CleanDuplicatesCommand
tags: ['console.command']
wallabag_core.command.export:
class: Wallabag\CoreBundle\Command\ExportCommand
tags: ['console.command']
wallabag_core.command.generate_url_hashes:
class: Wallabag\CoreBundle\Command\GenerateUrlHashesCommand
tags: ['console.command']
wallabag_core.command.install:
class: Wallabag\CoreBundle\Command\InstallCommand
tags: ['console.command']
wallabag_core.command.list_user:
class: Wallabag\CoreBundle\Command\ListUserCommand
tags: ['console.command']
wallabag_core.command.reload_entry:
class: Wallabag\CoreBundle\Command\ReloadEntryCommand
tags: ['console.command']
wallabag_core.command.show_user:
class: Wallabag\CoreBundle\Command\ShowUserCommand
tags: ['console.command']
wallabag_core.command.tag_all:
class: Wallabag\CoreBundle\Command\TagAllCommand
tags: ['console.command']

View file

@ -9,6 +9,14 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Wallabag\ImportBundle\Import\ChromeImport;
use Wallabag\ImportBundle\Import\DeliciousImport;
use Wallabag\ImportBundle\Import\FirefoxImport;
use Wallabag\ImportBundle\Import\InstapaperImport;
use Wallabag\ImportBundle\Import\PinboardImport;
use Wallabag\ImportBundle\Import\ReadabilityImport;
use Wallabag\ImportBundle\Import\WallabagV1Import;
use Wallabag\ImportBundle\Import\WallabagV2Import;
class ImportCommand extends ContainerAwareCommand class ImportCommand extends ContainerAwareCommand
{ {
@ -60,28 +68,28 @@ class ImportCommand extends ContainerAwareCommand
switch ($input->getOption('importer')) { switch ($input->getOption('importer')) {
case 'v2': case 'v2':
$import = $this->getContainer()->get('wallabag_import.wallabag_v2.import'); $import = $this->getContainer()->get(WallabagV2Import::class);
break; break;
case 'firefox': case 'firefox':
$import = $this->getContainer()->get('wallabag_import.firefox.import'); $import = $this->getContainer()->get(FirefoxImport::class);
break; break;
case 'chrome': case 'chrome':
$import = $this->getContainer()->get('wallabag_import.chrome.import'); $import = $this->getContainer()->get(ChromeImport::class);
break; break;
case 'readability': case 'readability':
$import = $this->getContainer()->get('wallabag_import.readability.import'); $import = $this->getContainer()->get(ReadabilityImport::class);
break; break;
case 'instapaper': case 'instapaper':
$import = $this->getContainer()->get('wallabag_import.instapaper.import'); $import = $this->getContainer()->get(InstapaperImport::class);
break; break;
case 'pinboard': case 'pinboard':
$import = $this->getContainer()->get('wallabag_import.pinboard.import'); $import = $this->getContainer()->get(PinboardImport::class);
break; break;
case 'delicious': case 'delicious':
$import = $this->getContainer()->get('wallabag_import.delicious.import'); $import = $this->getContainer()->get(DeliciousImport::class);
break; break;
default: default:
$import = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); $import = $this->getContainer()->get(WallabagV1Import::class);
} }
$import->setMarkAsRead($input->getOption('markAsRead')); $import->setMarkAsRead($input->getOption('markAsRead'));

View file

@ -4,6 +4,7 @@ namespace Wallabag\ImportBundle\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Wallabag\ImportBundle\Import\ChromeImport;
class ChromeController extends BrowserController class ChromeController extends BrowserController
{ {
@ -20,7 +21,7 @@ class ChromeController extends BrowserController
*/ */
protected function getImportService() protected function getImportService()
{ {
$service = $this->get('wallabag_import.chrome.import'); $service = $this->get(ChromeImport::class);
if ($this->get('craue_config')->get('import_with_rabbitmq')) { if ($this->get('craue_config')->get('import_with_rabbitmq')) {
$service->setProducer($this->get('old_sound_rabbit_mq.import_chrome_producer')); $service->setProducer($this->get('old_sound_rabbit_mq.import_chrome_producer'));

View file

@ -6,6 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Wallabag\ImportBundle\Form\Type\UploadImportType; use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\DeliciousImport;
class DeliciousController extends Controller class DeliciousController extends Controller
{ {
@ -17,7 +18,7 @@ class DeliciousController extends Controller
$form = $this->createForm(UploadImportType::class); $form = $this->createForm(UploadImportType::class);
$form->handleRequest($request); $form->handleRequest($request);
$delicious = $this->get('wallabag_import.delicious.import'); $delicious = $this->get(DeliciousImport::class);
$delicious->setUser($this->getUser()); $delicious->setUser($this->getUser());
if ($this->get('craue_config')->get('import_with_rabbitmq')) { if ($this->get('craue_config')->get('import_with_rabbitmq')) {

View file

@ -4,6 +4,7 @@ namespace Wallabag\ImportBundle\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Wallabag\ImportBundle\Import\ElcuratorImport;
class ElcuratorController extends WallabagController class ElcuratorController extends WallabagController
{ {
@ -20,7 +21,7 @@ class ElcuratorController extends WallabagController
*/ */
protected function getImportService() protected function getImportService()
{ {
$service = $this->get('wallabag_import.elcurator.import'); $service = $this->get(ElcuratorImport::class);
if ($this->get('craue_config')->get('import_with_rabbitmq')) { if ($this->get('craue_config')->get('import_with_rabbitmq')) {
$service->setProducer($this->get('old_sound_rabbit_mq.import_elcurator_producer')); $service->setProducer($this->get('old_sound_rabbit_mq.import_elcurator_producer'));

View file

@ -4,6 +4,7 @@ namespace Wallabag\ImportBundle\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Wallabag\ImportBundle\Import\FirefoxImport;
class FirefoxController extends BrowserController class FirefoxController extends BrowserController
{ {
@ -20,7 +21,7 @@ class FirefoxController extends BrowserController
*/ */
protected function getImportService() protected function getImportService()
{ {
$service = $this->get('wallabag_import.firefox.import'); $service = $this->get(FirefoxImport::class);
if ($this->get('craue_config')->get('import_with_rabbitmq')) { if ($this->get('craue_config')->get('import_with_rabbitmq')) {
$service->setProducer($this->get('old_sound_rabbit_mq.import_firefox_producer')); $service->setProducer($this->get('old_sound_rabbit_mq.import_firefox_producer'));

View file

@ -2,8 +2,10 @@
namespace Wallabag\ImportBundle\Controller; namespace Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Wallabag\ImportBundle\Import\ImportChain;
class ImportController extends Controller class ImportController extends Controller
{ {
@ -13,7 +15,7 @@ class ImportController extends Controller
public function importAction() public function importAction()
{ {
return $this->render('WallabagImportBundle:Import:index.html.twig', [ return $this->render('WallabagImportBundle:Import:index.html.twig', [
'imports' => $this->get('wallabag_import.chain')->getAll(), 'imports' => $this->get(ImportChain::class)->getAll(),
]); ]);
} }
@ -50,7 +52,7 @@ class ImportController extends Controller
$rabbitNotInstalled = true; $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(Client::class);
try { try {
$nbRedisMessages = $redis->llen('wallabag.import.pocket') $nbRedisMessages = $redis->llen('wallabag.import.pocket')

View file

@ -6,6 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Wallabag\ImportBundle\Form\Type\UploadImportType; use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\InstapaperImport;
class InstapaperController extends Controller class InstapaperController extends Controller
{ {
@ -17,7 +18,7 @@ class InstapaperController extends Controller
$form = $this->createForm(UploadImportType::class); $form = $this->createForm(UploadImportType::class);
$form->handleRequest($request); $form->handleRequest($request);
$instapaper = $this->get('wallabag_import.instapaper.import'); $instapaper = $this->get(InstapaperImport::class);
$instapaper->setUser($this->getUser()); $instapaper->setUser($this->getUser());
if ($this->get('craue_config')->get('import_with_rabbitmq')) { if ($this->get('craue_config')->get('import_with_rabbitmq')) {

View file

@ -6,6 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Wallabag\ImportBundle\Form\Type\UploadImportType; use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\PinboardImport;
class PinboardController extends Controller class PinboardController extends Controller
{ {
@ -17,7 +18,7 @@ class PinboardController extends Controller
$form = $this->createForm(UploadImportType::class); $form = $this->createForm(UploadImportType::class);
$form->handleRequest($request); $form->handleRequest($request);
$pinboard = $this->get('wallabag_import.pinboard.import'); $pinboard = $this->get(PinboardImport::class);
$pinboard->setUser($this->getUser()); $pinboard->setUser($this->getUser());
if ($this->get('craue_config')->get('import_with_rabbitmq')) { if ($this->get('craue_config')->get('import_with_rabbitmq')) {

View file

@ -7,6 +7,7 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Wallabag\ImportBundle\Import\PocketImport;
class PocketController extends Controller class PocketController extends Controller
{ {
@ -110,7 +111,7 @@ class PocketController extends Controller
*/ */
private function getPocketImportService() private function getPocketImportService()
{ {
$pocket = $this->get('wallabag_import.pocket.import'); $pocket = $this->get(PocketImport::class);
$pocket->setUser($this->getUser()); $pocket->setUser($this->getUser());
if ($this->get('craue_config')->get('import_with_rabbitmq')) { if ($this->get('craue_config')->get('import_with_rabbitmq')) {

View file

@ -6,6 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Wallabag\ImportBundle\Form\Type\UploadImportType; use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\ReadabilityImport;
class ReadabilityController extends Controller class ReadabilityController extends Controller
{ {
@ -17,7 +18,7 @@ class ReadabilityController extends Controller
$form = $this->createForm(UploadImportType::class); $form = $this->createForm(UploadImportType::class);
$form->handleRequest($request); $form->handleRequest($request);
$readability = $this->get('wallabag_import.readability.import'); $readability = $this->get(ReadabilityImport::class);
$readability->setUser($this->getUser()); $readability->setUser($this->getUser());
if ($this->get('craue_config')->get('import_with_rabbitmq')) { if ($this->get('craue_config')->get('import_with_rabbitmq')) {

View file

@ -4,6 +4,7 @@ namespace Wallabag\ImportBundle\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Wallabag\ImportBundle\Import\WallabagV1Import;
class WallabagV1Controller extends WallabagController class WallabagV1Controller extends WallabagController
{ {
@ -20,7 +21,7 @@ class WallabagV1Controller extends WallabagController
*/ */
protected function getImportService() protected function getImportService()
{ {
$service = $this->get('wallabag_import.wallabag_v1.import'); $service = $this->get(WallabagV1Import::class);
if ($this->get('craue_config')->get('import_with_rabbitmq')) { if ($this->get('craue_config')->get('import_with_rabbitmq')) {
$service->setProducer($this->get('old_sound_rabbit_mq.import_wallabag_v1_producer')); $service->setProducer($this->get('old_sound_rabbit_mq.import_wallabag_v1_producer'));

View file

@ -4,6 +4,7 @@ namespace Wallabag\ImportBundle\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Wallabag\ImportBundle\Import\WallabagV2Import;
class WallabagV2Controller extends WallabagController class WallabagV2Controller extends WallabagController
{ {
@ -20,7 +21,7 @@ class WallabagV2Controller extends WallabagController
*/ */
protected function getImportService() protected function getImportService()
{ {
$service = $this->get('wallabag_import.wallabag_v2.import'); $service = $this->get(WallabagV2Import::class);
if ($this->get('craue_config')->get('import_with_rabbitmq')) { if ($this->get('craue_config')->get('import_with_rabbitmq')) {
$service->setProducer($this->get('old_sound_rabbit_mq.import_wallabag_v2_producer')); $service->setProducer($this->get('old_sound_rabbit_mq.import_wallabag_v2_producer'));

View file

@ -10,12 +10,12 @@ class ImportCompilerPass implements CompilerPassInterface
{ {
public function process(ContainerBuilder $container) public function process(ContainerBuilder $container)
{ {
if (!$container->hasDefinition('wallabag_import.chain')) { if (!$container->hasDefinition(ImportChain::class)) {
return; return;
} }
$definition = $container->getDefinition( $definition = $container->getDefinition(
'wallabag_import.chain' ImportChain::class
); );
$taggedServices = $container->findTaggedServiceIds( $taggedServices = $container->findTaggedServiceIds(

View file

@ -4,79 +4,79 @@ services:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.pocket.import" - '@Wallabag\ImportBundle\Import\PocketImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
wallabag_import.consumer.amqp.readability: wallabag_import.consumer.amqp.readability:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.readability.import" - '@Wallabag\ImportBundle\Import\ReadabilityImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
wallabag_import.consumer.amqp.instapaper: wallabag_import.consumer.amqp.instapaper:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.instapaper.import" - '@Wallabag\ImportBundle\Import\InstapaperImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
wallabag_import.consumer.amqp.pinboard: wallabag_import.consumer.amqp.pinboard:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.pinboard.import" - '@Wallabag\ImportBundle\Import\PinboardImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
wallabag_import.consumer.amqp.delicious: wallabag_import.consumer.amqp.delicious:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.delicious.import" - '@Wallabag\ImportBundle\Import\DeliciousImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
wallabag_import.consumer.amqp.wallabag_v1: wallabag_import.consumer.amqp.wallabag_v1:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.wallabag_v1.import" - '@Wallabag\ImportBundle\Import\WallabagV1Import'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
wallabag_import.consumer.amqp.wallabag_v2: wallabag_import.consumer.amqp.wallabag_v2:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.wallabag_v2.import" - '@Wallabag\ImportBundle\Import\WallabagV2Import'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
wallabag_import.consumer.amqp.elcurator: wallabag_import.consumer.amqp.elcurator:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.elcurator.import" - '@Wallabag\ImportBundle\Import\ElcuratorImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
wallabag_import.consumer.amqp.firefox: wallabag_import.consumer.amqp.firefox:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.firefox.import" - '@Wallabag\ImportBundle\Import\FirefoxImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
wallabag_import.consumer.amqp.chrome: wallabag_import.consumer.amqp.chrome:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.chrome.import" - '@Wallabag\ImportBundle\Import\ChromeImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"

View file

@ -4,7 +4,7 @@ services:
wallabag_import.queue.redis.readability: wallabag_import.queue.redis.readability:
class: Simpleue\Queue\RedisQueue class: Simpleue\Queue\RedisQueue
arguments: arguments:
- "@wallabag_core.redis.client" - '@Predis\Client'
- "wallabag.import.readability" - "wallabag.import.readability"
wallabag_import.producer.redis.readability: wallabag_import.producer.redis.readability:
@ -16,8 +16,8 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.readability.import" - '@Wallabag\ImportBundle\Import\ReadabilityImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
@ -25,7 +25,7 @@ services:
wallabag_import.queue.redis.instapaper: wallabag_import.queue.redis.instapaper:
class: Simpleue\Queue\RedisQueue class: Simpleue\Queue\RedisQueue
arguments: arguments:
- "@wallabag_core.redis.client" - '@Predis\Client'
- "wallabag.import.instapaper" - "wallabag.import.instapaper"
wallabag_import.producer.redis.instapaper: wallabag_import.producer.redis.instapaper:
@ -37,8 +37,8 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.instapaper.import" - '@Wallabag\ImportBundle\Import\InstapaperImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
@ -46,7 +46,7 @@ services:
wallabag_import.queue.redis.pinboard: wallabag_import.queue.redis.pinboard:
class: Simpleue\Queue\RedisQueue class: Simpleue\Queue\RedisQueue
arguments: arguments:
- "@wallabag_core.redis.client" - '@Predis\Client'
- "wallabag.import.pinboard" - "wallabag.import.pinboard"
wallabag_import.producer.redis.pinboard: wallabag_import.producer.redis.pinboard:
@ -58,8 +58,8 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.pinboard.import" - '@Wallabag\ImportBundle\Import\PinboardImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
@ -67,7 +67,7 @@ services:
wallabag_import.queue.redis.delicious: wallabag_import.queue.redis.delicious:
class: Simpleue\Queue\RedisQueue class: Simpleue\Queue\RedisQueue
arguments: arguments:
- "@wallabag_core.redis.client" - '@Predis\Client'
- "wallabag.import.delicious" - "wallabag.import.delicious"
wallabag_import.producer.redis.delicious: wallabag_import.producer.redis.delicious:
@ -79,8 +79,8 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.delicious.import" - '@Wallabag\ImportBundle\Import\DeliciousImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
@ -88,7 +88,7 @@ services:
wallabag_import.queue.redis.pocket: wallabag_import.queue.redis.pocket:
class: Simpleue\Queue\RedisQueue class: Simpleue\Queue\RedisQueue
arguments: arguments:
- "@wallabag_core.redis.client" - '@Predis\Client'
- "wallabag.import.pocket" - "wallabag.import.pocket"
wallabag_import.producer.redis.pocket: wallabag_import.producer.redis.pocket:
@ -100,8 +100,8 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.pocket.import" - '@Wallabag\ImportBundle\Import\PocketImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
@ -109,7 +109,7 @@ services:
wallabag_import.queue.redis.wallabag_v1: wallabag_import.queue.redis.wallabag_v1:
class: Simpleue\Queue\RedisQueue class: Simpleue\Queue\RedisQueue
arguments: arguments:
- "@wallabag_core.redis.client" - '@Predis\Client'
- "wallabag.import.wallabag_v1" - "wallabag.import.wallabag_v1"
wallabag_import.producer.redis.wallabag_v1: wallabag_import.producer.redis.wallabag_v1:
@ -121,8 +121,8 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.wallabag_v1.import" - '@Wallabag\ImportBundle\Import\WallabagV1Import'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
@ -130,7 +130,7 @@ services:
wallabag_import.queue.redis.wallabag_v2: wallabag_import.queue.redis.wallabag_v2:
class: Simpleue\Queue\RedisQueue class: Simpleue\Queue\RedisQueue
arguments: arguments:
- "@wallabag_core.redis.client" - '@Predis\Client'
- "wallabag.import.wallabag_v2" - "wallabag.import.wallabag_v2"
wallabag_import.producer.redis.wallabag_v2: wallabag_import.producer.redis.wallabag_v2:
@ -142,8 +142,8 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.wallabag_v2.import" - '@Wallabag\ImportBundle\Import\WallabagV2Import'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
@ -151,7 +151,7 @@ services:
wallabag_import.queue.redis.elcurator: wallabag_import.queue.redis.elcurator:
class: Simpleue\Queue\RedisQueue class: Simpleue\Queue\RedisQueue
arguments: arguments:
- "@wallabag_core.redis.client" - '@Predis\Client'
- "wallabag.import.elcurator" - "wallabag.import.elcurator"
wallabag_import.producer.redis.elcurator: wallabag_import.producer.redis.elcurator:
@ -163,8 +163,8 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.elcurator.import" - '@Wallabag\ImportBundle\Import\ElcuratorImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
@ -172,7 +172,7 @@ services:
wallabag_import.queue.redis.firefox: wallabag_import.queue.redis.firefox:
class: Simpleue\Queue\RedisQueue class: Simpleue\Queue\RedisQueue
arguments: arguments:
- "@wallabag_core.redis.client" - '@Predis\Client'
- "wallabag.import.firefox" - "wallabag.import.firefox"
wallabag_import.producer.redis.firefox: wallabag_import.producer.redis.firefox:
@ -184,8 +184,8 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.firefox.import" - '@Wallabag\ImportBundle\Import\FirefoxImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"
@ -193,7 +193,7 @@ services:
wallabag_import.queue.redis.chrome: wallabag_import.queue.redis.chrome:
class: Simpleue\Queue\RedisQueue class: Simpleue\Queue\RedisQueue
arguments: arguments:
- "@wallabag_core.redis.client" - '@Predis\Client'
- "wallabag.import.chrome" - "wallabag.import.chrome"
wallabag_import.producer.redis.chrome: wallabag_import.producer.redis.chrome:
@ -205,7 +205,7 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository" - '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.chrome.import" - '@Wallabag\ImportBundle\Import\ChromeImport'
- "@event_dispatcher" - "@event_dispatcher"
- "@logger" - "@logger"

View file

@ -3,18 +3,18 @@ imports:
- { resource: redis.yml } - { resource: redis.yml }
services: services:
wallabag_import.chain: Wallabag\ImportBundle\Import\ImportChain:
class: Wallabag\ImportBundle\Import\ImportChain class: Wallabag\ImportBundle\Import\ImportChain
wallabag_import.pocket.client: wallabag_import.pocket.client:
alias: 'httplug.client.wallabag_import.pocket.client' alias: 'httplug.client.wallabag_import.pocket.client'
wallabag_import.pocket.import: Wallabag\ImportBundle\Import\PocketImport:
class: Wallabag\ImportBundle\Import\PocketImport class: Wallabag\ImportBundle\Import\PocketImport
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy" - '@Wallabag\CoreBundle\Helper\ContentProxy'
- "@wallabag_core.tags_assigner" - '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher" - "@event_dispatcher"
calls: calls:
- [ setClient, [ "@wallabag_import.pocket.client" ] ] - [ setClient, [ "@wallabag_import.pocket.client" ] ]
@ -22,12 +22,12 @@ services:
tags: tags:
- { name: wallabag_import.import, alias: pocket } - { name: wallabag_import.import, alias: pocket }
wallabag_import.wallabag_v1.import: Wallabag\ImportBundle\Import\WallabagV1Import:
class: Wallabag\ImportBundle\Import\WallabagV1Import class: Wallabag\ImportBundle\Import\WallabagV1Import
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy" - '@Wallabag\CoreBundle\Helper\ContentProxy'
- "@wallabag_core.tags_assigner" - '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher" - "@event_dispatcher"
- "%wallabag_core.fetching_error_message_title%" - "%wallabag_core.fetching_error_message_title%"
- "%wallabag_core.fetching_error_message%" - "%wallabag_core.fetching_error_message%"
@ -36,105 +36,102 @@ services:
tags: tags:
- { name: wallabag_import.import, alias: wallabag_v1 } - { name: wallabag_import.import, alias: wallabag_v1 }
wallabag_import.wallabag_v2.import: Wallabag\ImportBundle\Import\WallabagV2Import:
class: Wallabag\ImportBundle\Import\WallabagV2Import class: Wallabag\ImportBundle\Import\WallabagV2Import
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy" - '@Wallabag\CoreBundle\Helper\ContentProxy'
- "@wallabag_core.tags_assigner" - '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher" - "@event_dispatcher"
calls: calls:
- [ setLogger, [ "@logger" ]] - [ setLogger, [ "@logger" ]]
tags: tags:
- { name: wallabag_import.import, alias: wallabag_v2 } - { name: wallabag_import.import, alias: wallabag_v2 }
wallabag_import.elcurator.import: Wallabag\ImportBundle\Import\ElcuratorImport:
class: Wallabag\ImportBundle\Import\ElcuratorImport class: Wallabag\ImportBundle\Import\ElcuratorImport
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy" - '@Wallabag\CoreBundle\Helper\ContentProxy'
- "@wallabag_core.tags_assigner" - '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher" - "@event_dispatcher"
calls: calls:
- [ setLogger, [ "@logger" ]] - [ setLogger, [ "@logger" ]]
tags: tags:
- { name: wallabag_import.import, alias: elcurator } - { name: wallabag_import.import, alias: elcurator }
wallabag_import.readability.import: Wallabag\ImportBundle\Import\ReadabilityImport:
class: Wallabag\ImportBundle\Import\ReadabilityImport class: Wallabag\ImportBundle\Import\ReadabilityImport
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy" - '@Wallabag\CoreBundle\Helper\ContentProxy'
- "@wallabag_core.tags_assigner" - '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher" - "@event_dispatcher"
calls: calls:
- [ setLogger, [ "@logger" ]] - [ setLogger, [ "@logger" ]]
tags: tags:
- { name: wallabag_import.import, alias: readability } - { name: wallabag_import.import, alias: readability }
wallabag_import.instapaper.import: Wallabag\ImportBundle\Import\InstapaperImport:
class: Wallabag\ImportBundle\Import\InstapaperImport class: Wallabag\ImportBundle\Import\InstapaperImport
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy" - '@Wallabag\CoreBundle\Helper\ContentProxy'
- "@wallabag_core.tags_assigner" - '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher" - "@event_dispatcher"
calls: calls:
- [ setLogger, [ "@logger" ]] - [ setLogger, [ "@logger" ]]
tags: tags:
- { name: wallabag_import.import, alias: instapaper } - { name: wallabag_import.import, alias: instapaper }
wallabag_import.pinboard.import: Wallabag\ImportBundle\Import\PinboardImport:
class: Wallabag\ImportBundle\Import\PinboardImport class: Wallabag\ImportBundle\Import\PinboardImport
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy" - '@Wallabag\CoreBundle\Helper\ContentProxy'
- "@wallabag_core.tags_assigner" - '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher" - "@event_dispatcher"
calls: calls:
- [ setLogger, [ "@logger" ]] - [ setLogger, [ "@logger" ]]
tags: tags:
- { name: wallabag_import.import, alias: pinboard } - { name: wallabag_import.import, alias: pinboard }
wallabag_import.delicious.import: Wallabag\ImportBundle\Import\DeliciousImport:
class: Wallabag\ImportBundle\Import\DeliciousImport class: Wallabag\ImportBundle\Import\DeliciousImport
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy" - '@Wallabag\CoreBundle\Helper\ContentProxy'
- "@wallabag_core.tags_assigner" - '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher" - "@event_dispatcher"
calls: calls:
- [ setLogger, [ "@logger" ]] - [ setLogger, [ "@logger" ]]
tags: tags:
- { name: wallabag_import.import, alias: delicious } - { name: wallabag_import.import, alias: delicious }
wallabag_import.firefox.import: Wallabag\ImportBundle\Import\FirefoxImport:
class: Wallabag\ImportBundle\Import\FirefoxImport class: Wallabag\ImportBundle\Import\FirefoxImport
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy" - '@Wallabag\CoreBundle\Helper\ContentProxy'
- "@wallabag_core.tags_assigner" - '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher" - "@event_dispatcher"
calls: calls:
- [ setLogger, [ "@logger" ]] - [ setLogger, [ "@logger" ]]
tags: tags:
- { name: wallabag_import.import, alias: firefox } - { name: wallabag_import.import, alias: firefox }
wallabag_import.chrome.import:
Wallabag\ImportBundle\Import\ChromeImport:
class: Wallabag\ImportBundle\Import\ChromeImport class: Wallabag\ImportBundle\Import\ChromeImport
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy" - '@Wallabag\CoreBundle\Helper\ContentProxy'
- "@wallabag_core.tags_assigner" - '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher" - "@event_dispatcher"
calls: calls:
- [ setLogger, [ "@logger" ]] - [ setLogger, [ "@logger" ]]
tags: tags:
- { name: wallabag_import.import, alias: chrome } - { name: wallabag_import.import, alias: chrome }
wallabag_import.command.import: Wallabag\ImportBundle\Command\:
class: Wallabag\ImportBundle\Command\ImportCommand resource: ../../Command/*
tags: ['console.command'] autoconfigure: true
wallabag_import.command.redis_worker:
class: Wallabag\ImportBundle\Command\RedisWorkerCommand
tags: ['console.command']

View file

@ -1,5 +1,5 @@
services: services:
wallabag_user.auth_code_mailer: Wallabag\UserBundle\Mailer\AuthCodeMailer:
class: Wallabag\UserBundle\Mailer\AuthCodeMailer class: Wallabag\UserBundle\Mailer\AuthCodeMailer
arguments: arguments:
- "@mailer" - "@mailer"
@ -16,20 +16,20 @@ services:
tags: tags:
- { name: kernel.event_subscriber } - { name: kernel.event_subscriber }
wallabag_user.password_resetting: Wallabag\UserBundle\EventListener\PasswordResettingListener:
class: Wallabag\UserBundle\EventListener\PasswordResettingListener class: Wallabag\UserBundle\EventListener\PasswordResettingListener
arguments: arguments:
- "@router" - "@router"
tags: tags:
- { name: kernel.event_subscriber } - { name: kernel.event_subscriber }
wallabag_user.user_repository: Wallabag\UserBundle\Repository\UserRepository:
class: Wallabag\UserBundle\Repository\UserRepository class: Wallabag\UserBundle\Repository\UserRepository
factory: [ "@doctrine.orm.default_entity_manager", getRepository ] factory: [ "@doctrine.orm.default_entity_manager", getRepository ]
arguments: arguments:
- WallabagUserBundle:User - WallabagUserBundle:User
wallabag_user.listener.create_config: Wallabag\UserBundle\EventListener\CreateConfigListener:
class: Wallabag\UserBundle\EventListener\CreateConfigListener class: Wallabag\UserBundle\EventListener\CreateConfigListener
arguments: arguments:
- "@doctrine.orm.entity_manager" - "@doctrine.orm.entity_manager"
@ -44,7 +44,7 @@ services:
tags: tags:
- { name: kernel.event_subscriber } - { name: kernel.event_subscriber }
wallabag_user.listener.authentication_failure_event_listener: Wallabag\UserBundle\EventListener\AuthenticationFailureListener:
class: Wallabag\UserBundle\EventListener\AuthenticationFailureListener class: Wallabag\UserBundle\EventListener\AuthenticationFailureListener
arguments: arguments:
- "@request_stack" - "@request_stack"

View file

@ -564,7 +564,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
$contentProxy->expects($this->any()) $contentProxy->expects($this->any())
->method('updateEntry') ->method('updateEntry')
->willThrowException(new \Exception('Test Fetch content fails')); ->willThrowException(new \Exception('Test Fetch content fails'));
$container->set('wallabag_core.content_proxy', $contentProxy); $container->set(ContentProxy::class, $contentProxy);
try { try {
$this->client->request('POST', '/api/entries.json', [ $this->client->request('POST', '/api/entries.json', [

View file

@ -9,6 +9,7 @@ use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\SiteCredential; use Wallabag\CoreBundle\Entity\SiteCredential;
use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Helper\ContentProxy; use Wallabag\CoreBundle\Helper\ContentProxy;
use Wallabag\CoreBundle\Helper\CryptoProxy;
class EntryControllerTest extends WallabagCoreTestCase class EntryControllerTest extends WallabagCoreTestCase
{ {
@ -1553,8 +1554,8 @@ class EntryControllerTest extends WallabagCoreTestCase
$user = $client->getContainer()->get('security.token_storage')->getToken()->getUser(); $user = $client->getContainer()->get('security.token_storage')->getToken()->getUser();
$credential = new SiteCredential($user); $credential = new SiteCredential($user);
$credential->setHost('monde-diplomatique.fr'); $credential->setHost('monde-diplomatique.fr');
$credential->setUsername($client->getContainer()->get('wallabag_core.helper.crypto_proxy')->crypt('foo')); $credential->setUsername($client->getContainer()->get(CryptoProxy::class)->crypt('foo'));
$credential->setPassword($client->getContainer()->get('wallabag_core.helper.crypto_proxy')->crypt('bar')); $credential->setPassword($client->getContainer()->get(CryptoProxy::class)->crypt('bar'));
$em->persist($credential); $em->persist($credential);
$em->flush(); $em->flush();
@ -1621,7 +1622,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$cookie = $client->getCookieJar()->all(); $cookie = $client->getCookieJar()->all();
$client = $this->getNewClient(); $client = $this->getNewClient();
$client->getCookieJar()->set($cookie[0]); $client->getCookieJar()->set($cookie[0]);
$client->getContainer()->set('wallabag_core.content_proxy', $contentProxy); $client->getContainer()->set(ContentProxy::class, $contentProxy);
$client->submit($form, $data); $client->submit($form, $data);
$this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertSame(302, $client->getResponse()->getStatusCode());

View file

@ -9,6 +9,7 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder; use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder;
use Wallabag\CoreBundle\Repository\SiteCredentialRepository;
class GrabySiteConfigBuilderTest extends WallabagCoreTestCase class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
{ {
@ -300,7 +301,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
$builder = new GrabySiteConfigBuilder( $builder = new GrabySiteConfigBuilder(
$grabyConfigBuilderMock, $grabyConfigBuilderMock,
$tokenStorage, $tokenStorage,
$this->getClient()->getContainer()->get('wallabag_core.site_credential_repository'), $this->getClient()->getContainer()->get(SiteCredentialRepository::class),
$logger $logger
); );

View file

@ -164,7 +164,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
protected function checkRedis() protected function checkRedis()
{ {
try { try {
$this->client->getContainer()->get('wallabag_core.redis.client')->connect(); $this->client->getContainer()->get(\Predis\Client::class)->connect();
} catch (\Exception $e) { } catch (\Exception $e) {
$this->markTestSkipped('Redis is not installed/activated'); $this->markTestSkipped('Redis is not installed/activated');
} }

View file

@ -3,6 +3,7 @@
namespace Tests\Wallabag\ImportBundle\Command; namespace Tests\Wallabag\ImportBundle\Command;
use M6Web\Component\RedisMock\RedisMockFactory; use M6Web\Component\RedisMock\RedisMockFactory;
use Predis\Client;
use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Console\Tester\CommandTester;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -51,7 +52,7 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase
$factory = new RedisMockFactory(); $factory = new RedisMockFactory();
$redisMock = $factory->getAdapter('Predis\Client', true); $redisMock = $factory->getAdapter('Predis\Client', true);
$application->getKernel()->getContainer()->set('wallabag_core.redis.client', $redisMock); $application->getKernel()->getContainer()->set(Client::class, $redisMock);
// put a fake message in the queue so the worker will stop after reading that message // put a fake message in the queue so the worker will stop after reading that message
// instead of waiting for others // instead of waiting for others

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller; namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -82,7 +83,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
$this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.chrome')); $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.chrome'));
$client->getContainer()->get('craue_config')->set('import_with_redis', 0); $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
} }

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller; namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -82,7 +83,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
$this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.delicious')); $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.delicious'));
$client->getContainer()->get('craue_config')->set('import_with_redis', 0); $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
} }

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller; namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -83,7 +84,7 @@ class ElcuratorControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
$this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.elcurator')); $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.elcurator'));
$client->getContainer()->get('craue_config')->set('import_with_redis', 0); $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
} }

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller; namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -82,7 +83,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
$this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.firefox')); $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.firefox'));
$client->getContainer()->get('craue_config')->set('import_with_redis', 0); $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
} }

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller; namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -82,7 +83,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
$this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.instapaper')); $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.instapaper'));
$client->getContainer()->get('craue_config')->set('import_with_redis', 0); $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
} }

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller; namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -82,7 +83,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
$this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.pinboard')); $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.pinboard'));
$client->getContainer()->get('craue_config')->set('import_with_redis', 0); $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
} }

View file

@ -3,6 +3,7 @@
namespace Tests\Wallabag\ImportBundle\Controller; namespace Tests\Wallabag\ImportBundle\Controller;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
use Wallabag\ImportBundle\Import\PocketImport;
class PocketControllerTest extends WallabagCoreTestCase class PocketControllerTest extends WallabagCoreTestCase
{ {
@ -72,7 +73,7 @@ class PocketControllerTest extends WallabagCoreTestCase
->method('getRequestToken') ->method('getRequestToken')
->willReturn('token'); ->willReturn('token');
static::$kernel->getContainer()->set('wallabag_import.pocket.import', $pocketImport); static::$kernel->getContainer()->set(PocketImport::class, $pocketImport);
$client->request('GET', '/import/pocket/auth'); $client->request('GET', '/import/pocket/auth');
@ -94,7 +95,7 @@ class PocketControllerTest extends WallabagCoreTestCase
->method('authorize') ->method('authorize')
->willReturn(false); ->willReturn(false);
static::$kernel->getContainer()->set('wallabag_import.pocket.import', $pocketImport); static::$kernel->getContainer()->set(PocketImport::class, $pocketImport);
$client->request('GET', '/import/pocket/callback'); $client->request('GET', '/import/pocket/callback');
@ -128,7 +129,7 @@ class PocketControllerTest extends WallabagCoreTestCase
->method('import') ->method('import')
->willReturn(true); ->willReturn(true);
static::$kernel->getContainer()->set('wallabag_import.pocket.import', $pocketImport); static::$kernel->getContainer()->set(PocketImport::class, $pocketImport);
$client->request('GET', '/import/pocket/callback'); $client->request('GET', '/import/pocket/callback');

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller; namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -82,7 +83,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
$this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.readability')); $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.readability'));
$client->getContainer()->get('craue_config')->set('import_with_redis', 0); $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
} }

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller; namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -83,7 +84,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
$this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.wallabag_v1')); $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.wallabag_v1'));
$client->getContainer()->get('craue_config')->set('import_with_redis', 0); $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
} }

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller; namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -83,7 +84,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
$this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.wallabag_v2')); $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.wallabag_v2'));
$client->getContainer()->get('craue_config')->set('import_with_redis', 0); $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
} }

View file

@ -4,6 +4,7 @@ namespace Tests\Wallabag\ImportBundle\Import;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Wallabag\ImportBundle\Import\ImportChain;
use Wallabag\ImportBundle\Import\ImportCompilerPass; use Wallabag\ImportBundle\Import\ImportCompilerPass;
class ImportCompilerPassTest extends TestCase class ImportCompilerPassTest extends TestCase
@ -20,7 +21,7 @@ class ImportCompilerPassTest extends TestCase
{ {
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$container $container
->register('wallabag_import.chain') ->register(ImportChain::class)
->setPublic(false) ->setPublic(false)
; ;
@ -31,9 +32,9 @@ class ImportCompilerPassTest extends TestCase
$this->process($container); $this->process($container);
$this->assertTrue($container->hasDefinition('wallabag_import.chain')); $this->assertTrue($container->hasDefinition(ImportChain::class));
$definition = $container->getDefinition('wallabag_import.chain'); $definition = $container->getDefinition(ImportChain::class);
$this->assertTrue($definition->hasMethodCall('addImport')); $this->assertTrue($definition->hasMethodCall('addImport'));
$calls = $definition->getMethodCalls(); $calls = $definition->getMethodCalls();