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

View file

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

View file

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

View file

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

View file

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

View file

@ -8,6 +8,8 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Finder\Finder;
use Wallabag\CoreBundle\Helper\DownloadImages;
use Wallabag\CoreBundle\Repository\EntryRepository;
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)');
}
$downloadImages = $this->getContainer()->get('wallabag_core.entry.download_images');
$downloadImages = $this->getContainer()->get(DownloadImages::class);
$baseFolder = $downloadImages->getBaseFolder();
$io->text('Retrieve existing images');
@ -56,7 +58,7 @@ class CleanDownloadedImagesCommand extends ContainerAwareCommand
$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
$validPaths = [];

View file

@ -9,7 +9,9 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\UserBundle\Entity\User;
use Wallabag\UserBundle\Repository\UserRepository;
class CleanDuplicatesCommand extends ContainerAwareCommand
{
@ -49,7 +51,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
$this->io->success('Finished cleaning.');
} 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)));
@ -66,7 +68,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
private function cleanDuplicates(User $user)
{
$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());
@ -109,6 +111,6 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
*/
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\Output\OutputInterface;
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
{
@ -35,14 +38,14 @@ class ExportCommand extends ContainerAwareCommand
$io = new SymfonyStyle($input, $output);
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) {
$io->error(sprintf('User "%s" not found.', $input->getArgument('username')));
return 1;
}
$entries = $this->getContainer()->get('wallabag_core.entry_repository')
$entries = $this->getContainer()->get(EntryRepository::class)
->getBuilderForAllByUser($user->getId())
->getQuery()
->getResult();
@ -56,7 +59,7 @@ class ExportCommand extends ContainerAwareCommand
}
try {
$data = $this->getContainer()->get('wallabag_core.helper.entries_export')
$data = $this->getContainer()->get(EntriesExport::class)
->setEntries($entries)
->updateTitle('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\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\UserBundle\Repository\UserRepository;
class ListUserCommand extends ContainerAwareCommand
{
@ -26,13 +27,13 @@ class ListUserCommand extends ContainerAwareCommand
{
$io = new SymfonyStyle($input, $output);
$users = $this->getContainer()->get('wallabag_user.user_repository')
$users = $this->getContainer()->get(UserRepository::class)
->getQueryBuilderForSearch($input->getArgument('search'))
->setMaxResults($input->getOption('limit'))
->getQuery()
->getResult();
$nbUsers = $this->getContainer()->get('wallabag_user.user_repository')
$nbUsers = $this->getContainer()->get(UserRepository::class)
->getSumUsers();
$rows = [];

View file

@ -9,6 +9,9 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\CoreBundle\Event\EntrySavedEvent;
use Wallabag\CoreBundle\Helper\ContentProxy;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\UserBundle\Repository\UserRepository;
class ReloadEntryCommand extends ContainerAwareCommand
{
@ -30,7 +33,7 @@ class ReloadEntryCommand extends ContainerAwareCommand
if ($username = $input->getArgument('username')) {
try {
$userId = $this->getContainer()
->get('wallabag_user.user_repository')
->get(UserRepository::class)
->findOneByUserName($username)
->getId();
} 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);
$nbEntries = \count($entryIds);
@ -63,7 +66,7 @@ class ReloadEntryCommand extends ContainerAwareCommand
$progressBar = $io->createProgressBar($nbEntries);
$contentProxy = $this->getContainer()->get('wallabag_core.content_proxy');
$contentProxy = $this->getContainer()->get(ContentProxy::class);
$em = $this->getContainer()->get('doctrine')->getManager();
$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\Style\SymfonyStyle;
use Wallabag\UserBundle\Entity\User;
use Wallabag\UserBundle\Repository\UserRepository;
class ShowUserCommand extends ContainerAwareCommand
{
@ -68,6 +69,6 @@ class ShowUserCommand extends ContainerAwareCommand
*/
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\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\CoreBundle\Helper\RuleBasedTagger;
use Wallabag\UserBundle\Repository\UserRepository;
class TagAllCommand extends ContainerAwareCommand
{
@ -35,7 +37,7 @@ class TagAllCommand extends ContainerAwareCommand
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()));
@ -63,7 +65,7 @@ class TagAllCommand extends ContainerAwareCommand
*/
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()

View file

@ -24,7 +24,10 @@ use Wallabag\CoreBundle\Form\Type\IgnoreOriginUserRuleType;
use Wallabag\CoreBundle\Form\Type\TaggingRuleImportType;
use Wallabag\CoreBundle\Form\Type\TaggingRuleType;
use Wallabag\CoreBundle\Form\Type\UserInformationType;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\CoreBundle\Repository\TagRepository;
use Wallabag\CoreBundle\Tools\Utils;
use Wallabag\UserBundle\Repository\UserRepository;
class ConfigController extends Controller
{
@ -236,7 +239,7 @@ class ConfigController extends Controller
],
'twofactor_auth' => $this->getParameter('twofactor_auth'),
'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
$this->removeAllTagsByUserId($this->getUser()->getId());
$this->get('wallabag_core.entry_repository')->removeAllByUserId($this->getUser()->getId());
$this->get(EntryRepository::class)->removeAllByUserId($this->getUser()->getId());
break;
case 'archived':
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
$this->removeTagsForArchivedByUserId($this->getUser()->getId());
$this->get('wallabag_core.entry_repository')->removeArchivedByUserId($this->getUser()->getId());
$this->get(EntryRepository::class)->removeArchivedByUserId($this->getUser()->getId());
break;
}
@ -594,7 +597,7 @@ class ConfigController extends Controller
*/
public function deleteAccountAction(Request $request)
{
$enabledUsers = $this->get('wallabag_user.user_repository')
$enabledUsers = $this->get(UserRepository::class)
->getSumEnabledUsers();
if ($enabledUsers <= 1) {
@ -690,7 +693,7 @@ class ConfigController extends Controller
return;
}
$this->get('wallabag_core.entry_repository')
$this->get(EntryRepository::class)
->removeTags($userId, $tags);
// cleanup orphan tags
@ -712,7 +715,7 @@ class ConfigController extends Controller
*/
private function removeAllTagsByUserId($userId)
{
$tags = $this->get('wallabag_core.tag_repository')->findAllTags($userId);
$tags = $this->get(TagRepository::class)->findAllTags($userId);
$this->removeAllTagsByStatusAndUserId($tags, $userId);
}
@ -723,7 +726,7 @@ class ConfigController extends Controller
*/
private function removeTagsForArchivedByUserId($userId)
{
$tags = $this->get('wallabag_core.tag_repository')->findForArchivedArticlesByUser($userId);
$tags = $this->get(TagRepository::class)->findForArchivedArticlesByUser($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\NewEntryType;
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
{
@ -55,7 +60,7 @@ class EntryController extends Controller
$label = substr($label, 1);
$remove = true;
}
$tag = $this->get('wallabag_core.tag_repository')->findOneByLabel($label);
$tag = $this->get(TagRepository::class)->findOneByLabel($label);
if ($remove) {
if (null !== $tag) {
$tagsToRemove[] = $tag;
@ -74,7 +79,7 @@ class EntryController extends Controller
if (isset($values['entry-checkbox'])) {
foreach ($values['entry-checkbox'] as $id) {
/** @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);
@ -98,7 +103,7 @@ class EntryController extends Controller
$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);
}
@ -269,7 +274,7 @@ class EntryController extends Controller
public function showUnreadAction(Request $request, $page)
{
// 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'));
}
@ -344,7 +349,7 @@ class EntryController extends Controller
public function redirectRandomEntryAction($type = 'all')
{
try {
$entry = $this->get('wallabag_core.entry_repository')
$entry = $this->get(EntryRepository::class)
->getRandomEntry($this->getUser()->getId(), $type);
} catch (NoResultException $e) {
$bag = $this->get('session')->getFlashBag();
@ -431,7 +436,7 @@ class EntryController extends Controller
$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);
}
@ -461,7 +466,7 @@ class EntryController extends Controller
$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);
}
@ -501,7 +506,7 @@ class EntryController extends Controller
$referer = $request->headers->get('referer');
$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);
}
@ -597,7 +602,7 @@ class EntryController extends Controller
*/
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'] : '');
$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);
$entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare($pagerAdapter);
$entries = $this->get(PreparePagerForEntries::class)->prepare($pagerAdapter);
try {
$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());
return $this->render(
@ -683,7 +688,7 @@ class EntryController extends Controller
$message = 'flashes.entry.notice.' . $prefixMessage;
try {
$this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
$this->get(ContentProxy::class)->updateEntry($entry, $entry->getUrl());
} catch (\Exception $e) {
$this->get('logger')->error('Error while saving an entry', [
'exception' => $e,
@ -694,11 +699,11 @@ class EntryController extends Controller
}
if (empty($entry->getDomainName())) {
$this->get('wallabag_core.content_proxy')->setEntryDomainName($entry);
$this->get(ContentProxy::class)->setEntryDomainName($entry);
}
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);
@ -721,6 +726,6 @@ class EntryController extends Controller
*/
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\Routing\Annotation\Route;
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.
@ -29,7 +32,7 @@ class ExportController extends Controller
public function downloadEntryAction(Entry $entry, $format)
{
try {
return $this->get('wallabag_core.helper.entries_export')
return $this->get(EntriesExport::class)
->setEntries($entry)
->updateTitle('entry')
->updateAuthor('entry')
@ -56,11 +59,11 @@ class ExportController extends Controller
{
$method = ucfirst($category);
$methodBuilder = 'getBuilderFor' . $method . 'ByUser';
$repository = $this->get('wallabag_core.entry_repository');
$repository = $this->get(EntryRepository::class);
$title = $method;
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(
$this->getUser()->getId(),
@ -95,7 +98,7 @@ class ExportController extends Controller
}
try {
return $this->get('wallabag_core.helper.entries_export')
return $this->get(EntriesExport::class)
->setEntries($entries)
->updateTitle($title)
->updateAuthor($method)

View file

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

View file

@ -6,6 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule;
use Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository;
/**
* IgnoreOriginInstanceRuleController controller.
@ -21,7 +22,7 @@ class IgnoreOriginInstanceRuleController extends Controller
*/
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', [
'rules' => $rules,

View file

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

View file

@ -13,6 +13,11 @@ use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Form\Type\NewTagType;
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
{
@ -27,7 +32,7 @@ class TagController extends Controller
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry(
$this->get(TagsAssigner::class)->assignTagsToEntry(
$entry,
$form->get('label')->getData()
);
@ -69,7 +74,7 @@ class TagController extends Controller
$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);
}
@ -83,9 +88,9 @@ class TagController extends Controller
*/
public function showTagAction()
{
$tags = $this->get('wallabag_core.tag_repository')
$tags = $this->get(TagRepository::class)
->findAllFlatTagsWithNbEntries($this->getUser()->getId());
$nbEntriesUntagged = $this->get('wallabag_core.entry_repository')
$nbEntriesUntagged = $this->get(EntryRepository::class)
->countUntaggedEntriesByUser($this->getUser()->getId());
$renameForms = [];
@ -110,14 +115,14 @@ class TagController extends Controller
*/
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(),
$tag->getId()
);
$pagerAdapter = new ArrayAdapter($entriesByTag);
$entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare($pagerAdapter);
$entries = $this->get(PreparePagerForEntries::class)->prepare($pagerAdapter);
try {
$entries->setCurrentPage($page);
@ -152,7 +157,7 @@ class TagController extends Controller
$form = $this->createForm(RenameTagType::class, new Tag());
$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()) {
$newTag = new Tag();
@ -162,18 +167,18 @@ class TagController extends Controller
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) {
$newTag = $tagFromRepo;
}
$entries = $this->get('wallabag_core.entry_repository')->findAllByTagId(
$entries = $this->get(EntryRepository::class)->findAllByTagId(
$this->getUser()->getId(),
$tag->getId()
);
foreach ($entries as $entry) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry(
$this->get(TagsAssigner::class)->assignTagsToEntry(
$entry,
$newTag->getLabel(),
[$newTag]
@ -204,13 +209,13 @@ class TagController extends Controller
$currentRoute = $request->query->has('currentRoute') ? $request->query->get('currentRoute') : '';
/** @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();
$entries = $qb->getQuery()->getResult();
foreach ($entries as $entry) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry(
$this->get(TagsAssigner::class)->assignTagsToEntry(
$entry,
$filter
);
@ -220,7 +225,7 @@ class TagController extends Controller
$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)
{
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
@ -244,7 +249,7 @@ class TagController extends Controller
$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);
}

View file

@ -8,6 +8,7 @@ use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Wallabag\CoreBundle\Entity\SiteCredential;
use Wallabag\CoreBundle\Helper\CryptoProxy;
use Wallabag\UserBundle\DataFixtures\UserFixtures;
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->setHost('.super.com');
$credential->setUsername($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('.super'));
$credential->setPassword($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('bar'));
$credential->setUsername($this->container->get(CryptoProxy::class)->crypt('.super'));
$credential->setPassword($this->container->get(CryptoProxy::class)->crypt('bar'));
$manager->persist($credential);
$credential = new SiteCredential($this->getReference('admin-user'));
$credential->setHost('paywall.example.com');
$credential->setUsername($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('paywall.example'));
$credential->setPassword($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('bar'));
$credential->setUsername($this->container->get(CryptoProxy::class)->crypt('paywall.example'));
$credential->setPassword($this->container->get(CryptoProxy::class)->crypt('bar'));
$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
* 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
{

View file

@ -10,7 +10,7 @@ namespace Wallabag\CoreBundle\Operator\Doctrine;
*
* This operator will be used to compile tagging rules in DQL, usable
* 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
{

View file

@ -10,7 +10,7 @@ namespace Wallabag\CoreBundle\Operator\PHP;
*
* This operator will be used to compile tagging rules in PHP, usable
* 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
{

View file

@ -10,7 +10,7 @@ namespace Wallabag\CoreBundle\Operator\PHP;
*
* This operator will be used to compile tagging rules in PHP, usable
* 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
{

View file

@ -10,7 +10,7 @@ namespace Wallabag\CoreBundle\Operator\PHP;
*
* This operator will be used to compile ignore origin rules in PHP, usable
* 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
{

View file

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

View file

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

View file

@ -4,6 +4,7 @@ namespace Wallabag\ImportBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Wallabag\ImportBundle\Import\ChromeImport;
class ChromeController extends BrowserController
{
@ -20,7 +21,7 @@ class ChromeController extends BrowserController
*/
protected function getImportService()
{
$service = $this->get('wallabag_import.chrome.import');
$service = $this->get(ChromeImport::class);
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
$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\Routing\Annotation\Route;
use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\DeliciousImport;
class DeliciousController extends Controller
{
@ -17,7 +18,7 @@ class DeliciousController extends Controller
$form = $this->createForm(UploadImportType::class);
$form->handleRequest($request);
$delicious = $this->get('wallabag_import.delicious.import');
$delicious = $this->get(DeliciousImport::class);
$delicious->setUser($this->getUser());
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\Routing\Annotation\Route;
use Wallabag\ImportBundle\Import\ElcuratorImport;
class ElcuratorController extends WallabagController
{
@ -20,7 +21,7 @@ class ElcuratorController extends WallabagController
*/
protected function getImportService()
{
$service = $this->get('wallabag_import.elcurator.import');
$service = $this->get(ElcuratorImport::class);
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
$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\Routing\Annotation\Route;
use Wallabag\ImportBundle\Import\FirefoxImport;
class FirefoxController extends BrowserController
{
@ -20,7 +21,7 @@ class FirefoxController extends BrowserController
*/
protected function getImportService()
{
$service = $this->get('wallabag_import.firefox.import');
$service = $this->get(FirefoxImport::class);
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
$service->setProducer($this->get('old_sound_rabbit_mq.import_firefox_producer'));

View file

@ -2,8 +2,10 @@
namespace Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route;
use Wallabag\ImportBundle\Import\ImportChain;
class ImportController extends Controller
{
@ -13,7 +15,7 @@ class ImportController extends Controller
public function importAction()
{
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;
}
} elseif ($this->get('craue_config')->get('import_with_redis')) {
$redis = $this->get('wallabag_core.redis.client');
$redis = $this->get(Client::class);
try {
$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\Routing\Annotation\Route;
use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\InstapaperImport;
class InstapaperController extends Controller
{
@ -17,7 +18,7 @@ class InstapaperController extends Controller
$form = $this->createForm(UploadImportType::class);
$form->handleRequest($request);
$instapaper = $this->get('wallabag_import.instapaper.import');
$instapaper = $this->get(InstapaperImport::class);
$instapaper->setUser($this->getUser());
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\Routing\Annotation\Route;
use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\PinboardImport;
class PinboardController extends Controller
{
@ -17,7 +18,7 @@ class PinboardController extends Controller
$form = $this->createForm(UploadImportType::class);
$form->handleRequest($request);
$pinboard = $this->get('wallabag_import.pinboard.import');
$pinboard = $this->get(PinboardImport::class);
$pinboard->setUser($this->getUser());
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\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Wallabag\ImportBundle\Import\PocketImport;
class PocketController extends Controller
{
@ -110,7 +111,7 @@ class PocketController extends Controller
*/
private function getPocketImportService()
{
$pocket = $this->get('wallabag_import.pocket.import');
$pocket = $this->get(PocketImport::class);
$pocket->setUser($this->getUser());
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\Routing\Annotation\Route;
use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\ReadabilityImport;
class ReadabilityController extends Controller
{
@ -17,7 +18,7 @@ class ReadabilityController extends Controller
$form = $this->createForm(UploadImportType::class);
$form->handleRequest($request);
$readability = $this->get('wallabag_import.readability.import');
$readability = $this->get(ReadabilityImport::class);
$readability->setUser($this->getUser());
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\Routing\Annotation\Route;
use Wallabag\ImportBundle\Import\WallabagV1Import;
class WallabagV1Controller extends WallabagController
{
@ -20,7 +21,7 @@ class WallabagV1Controller extends WallabagController
*/
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')) {
$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\Routing\Annotation\Route;
use Wallabag\ImportBundle\Import\WallabagV2Import;
class WallabagV2Controller extends WallabagController
{
@ -20,7 +21,7 @@ class WallabagV2Controller extends WallabagController
*/
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')) {
$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)
{
if (!$container->hasDefinition('wallabag_import.chain')) {
if (!$container->hasDefinition(ImportChain::class)) {
return;
}
$definition = $container->getDefinition(
'wallabag_import.chain'
ImportChain::class
);
$taggedServices = $container->findTaggedServiceIds(

View file

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

View file

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

View file

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

View file

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

View file

@ -564,7 +564,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
$contentProxy->expects($this->any())
->method('updateEntry')
->willThrowException(new \Exception('Test Fetch content fails'));
$container->set('wallabag_core.content_proxy', $contentProxy);
$container->set(ContentProxy::class, $contentProxy);
try {
$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\Tag;
use Wallabag\CoreBundle\Helper\ContentProxy;
use Wallabag\CoreBundle\Helper\CryptoProxy;
class EntryControllerTest extends WallabagCoreTestCase
{
@ -1553,8 +1554,8 @@ class EntryControllerTest extends WallabagCoreTestCase
$user = $client->getContainer()->get('security.token_storage')->getToken()->getUser();
$credential = new SiteCredential($user);
$credential->setHost('monde-diplomatique.fr');
$credential->setUsername($client->getContainer()->get('wallabag_core.helper.crypto_proxy')->crypt('foo'));
$credential->setPassword($client->getContainer()->get('wallabag_core.helper.crypto_proxy')->crypt('bar'));
$credential->setUsername($client->getContainer()->get(CryptoProxy::class)->crypt('foo'));
$credential->setPassword($client->getContainer()->get(CryptoProxy::class)->crypt('bar'));
$em->persist($credential);
$em->flush();
@ -1621,7 +1622,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$cookie = $client->getCookieJar()->all();
$client = $this->getNewClient();
$client->getCookieJar()->set($cookie[0]);
$client->getContainer()->set('wallabag_core.content_proxy', $contentProxy);
$client->getContainer()->set(ContentProxy::class, $contentProxy);
$client->submit($form, $data);
$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 Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder;
use Wallabag\CoreBundle\Repository\SiteCredentialRepository;
class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
{
@ -300,7 +301,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
$builder = new GrabySiteConfigBuilder(
$grabyConfigBuilderMock,
$tokenStorage,
$this->getClient()->getContainer()->get('wallabag_core.site_credential_repository'),
$this->getClient()->getContainer()->get(SiteCredentialRepository::class),
$logger
);

View file

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

View file

@ -3,6 +3,7 @@
namespace Tests\Wallabag\ImportBundle\Command;
use M6Web\Component\RedisMock\RedisMockFactory;
use Predis\Client;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -51,7 +52,7 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase
$factory = new RedisMockFactory();
$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
// instead of waiting for others

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -82,7 +83,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$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);
}

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -82,7 +83,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$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);
}

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -83,7 +84,7 @@ class ElcuratorControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$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);
}

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -82,7 +83,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$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);
}

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -82,7 +83,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$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);
}

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -82,7 +83,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$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);
}

View file

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

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -82,7 +83,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$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);
}

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -83,7 +84,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$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);
}

View file

@ -2,6 +2,7 @@
namespace Tests\Wallabag\ImportBundle\Controller;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
@ -83,7 +84,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$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);
}

View file

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