]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #3294 from wallabag/export-tag-null
authorJérémy Benoist <j0k3r@users.noreply.github.com>
Wed, 30 Aug 2017 11:51:20 +0000 (13:51 +0200)
committerGitHub <noreply@github.com>
Wed, 30 Aug 2017 11:51:20 +0000 (13:51 +0200)
Empty currentTag should be null

41 files changed:
Makefile
README.md
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml
src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php
src/Wallabag/ApiBundle/Controller/EntryRestController.php
src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php
src/Wallabag/CoreBundle/Command/ExportCommand.php
src/Wallabag/CoreBundle/Command/InstallCommand.php
src/Wallabag/CoreBundle/Command/ListUserCommand.php [new file with mode: 0644]
src/Wallabag/CoreBundle/Command/ReloadEntryCommand.php [new file with mode: 0644]
src/Wallabag/CoreBundle/Command/ShowUserCommand.php
src/Wallabag/CoreBundle/Command/TagAllCommand.php
src/Wallabag/CoreBundle/Controller/EntryController.php
src/Wallabag/CoreBundle/Controller/TagController.php
src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
src/Wallabag/CoreBundle/Helper/EntriesExport.php
src/Wallabag/CoreBundle/Repository/EntryRepository.php
src/Wallabag/CoreBundle/Repository/TagRepository.php
src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_title.html.twig
src/Wallabag/ImportBundle/Controller/WallabagController.php
src/Wallabag/ImportBundle/Import/BrowserImport.php
src/Wallabag/UserBundle/Repository/UserRepository.php
src/Wallabag/UserBundle/Resources/translations/wallabag_user.oc.yml
tests/Wallabag/CoreBundle/Command/ExportCommandTest.php
tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php [new file with mode: 0644]
tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php [new file with mode: 0644]
tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php
tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php

index b33352616488d2c8a2c3a13d674f73714184eaf1..ffbe102a045c05f09ca3201322592e3ff153a111 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -23,8 +23,8 @@ dev: ## Install the latest dev version
 run: ## Run the wallabag built-in server
        @php bin/console server:run --env=$(ENV)
 
-build: ## Run grunt
-       @grunt
+build: ## Run webpack
+       @npm run build:$(ENV)
 
 test: ## Launch wallabag testsuite
        @ant prepare && bin/simple-phpunit -v
index 1b20e5d1cd383a285046b8bf64139ad87b530223..ebcdc5644f0487e509856d153f3588eb430e715e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
 [![Gitter](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/wallabag/wallabag)
 
 # What is wallabag?
-wallabag is a self hostable application allowing you to not miss any content anymore.
+wallabag is a self-hostable PHP application allowing you to not miss any content anymore.
 Click, save and read it when you can. It extracts content so that you can read it when you have time.
 
 More information on our website: [wallabag.org](https://wallabag.org).
index 66d9ae266f8f7ebdf4dec58395fb2b7d1494125a..0861d59cc05549b31bde8f28384c2ccc6486ea1d 100644 (file)
@@ -9,7 +9,7 @@ export_csv: Activar l'expòrt CSV
 export_json: Activar l'expòrt JSON
 export_txt: Activar l'expòrt TXT
 export_xml: Activar l'expòrt XML
-import_with_rabbitmq: Activar Enable RabbitMQ per importar de donadas de manièra asincròna
+import_with_rabbitmq: Activar RabbitMQ per importar de donadas de manièra asincròna
 import_with_redis: Activar Redis per importar de donadas de manièra asincròna
 shaarli_url: URL de Shaarli, se lo servici Shaarli es activat
 share_diaspora: Activar lo partatge cap a Diaspora
@@ -33,4 +33,4 @@ demo_mode_username: "Utilizaire de la demostracion"
 share_public: Autorizar una URL publica pels articles
 download_images_enabled: Telecargar los imatges en local
 restricted_access: Activar l'autenticacion pels sites amb peatge
-# api_user_registration: Enable user to be registered using the API
+api_user_registration: Autorizar los utilizaires a se marcar amb l'API
index 014c29b65f97b39758880c894106652dbcf830d3..b44f7e647acc4d35a5d0af70a63fd0bc48785680 100644 (file)
@@ -3,6 +3,8 @@
 namespace Wallabag\AnnotationBundle\Repository;
 
 use Doctrine\ORM\EntityRepository;
+use Doctrine\ORM\QueryBuilder;
+use Wallabag\AnnotationBundle\Entity\Annotation;
 
 /**
  * AnnotationRepository.
index 9277e1a19f093837efbb34540bc0996b02d32bc0..bc1b6f926ecbf28a04aeca3b8e4e7650199f599d 100644 (file)
@@ -8,6 +8,7 @@ use JMS\Serializer\SerializationContext;
 use Nelmio\ApiDocBundle\Annotation\ApiDoc;
 use Symfony\Component\HttpFoundation\JsonResponse;
 use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\HttpKernel\Exception\HttpException;
 use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
 use Wallabag\CoreBundle\Entity\Entry;
index b4aa4e470359cae82597b3173776876dee241aa7..b58909db9f9c40b8c6cadbbdf25f27d7a8240a86 100644 (file)
@@ -7,13 +7,14 @@ use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
 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\Entity\Entry;
 use Wallabag\UserBundle\Entity\User;
 
 class CleanDuplicatesCommand extends ContainerAwareCommand
 {
-    /** @var OutputInterface */
-    protected $output;
+    /** @var SymfonyStyle */
+    protected $io;
 
     protected $duplicates = 0;
 
@@ -32,7 +33,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
 
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $this->output = $output;
+        $this->io = new SymfonyStyle($input, $output);
 
         $username = $input->getArgument('username');
 
@@ -41,20 +42,22 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
                 $user = $this->getUser($username);
                 $this->cleanDuplicates($user);
             } catch (NoResultException $e) {
-                $output->writeln(sprintf('<error>User "%s" not found.</error>', $username));
+                $this->io->error(sprintf('User "%s" not found.', $username));
 
                 return 1;
             }
+
+            $this->io->success('Finished cleaning.');
         } else {
             $users = $this->getContainer()->get('wallabag_user.user_repository')->findAll();
 
-            $output->writeln(sprintf('Cleaning through %d user accounts', count($users)));
+            $this->io->text(sprintf('Cleaning through <info>%d</info> user accounts', count($users)));
 
             foreach ($users as $user) {
-                $output->writeln(sprintf('Processing user %s', $user->getUsername()));
+                $this->io->text(sprintf('Processing user <info>%s</info>', $user->getUsername()));
                 $this->cleanDuplicates($user);
             }
-            $output->writeln(sprintf('Finished cleaning. %d duplicates found in total', $this->duplicates));
+            $this->io->success(sprintf('Finished cleaning. %d duplicates found in total', $this->duplicates));
         }
 
         return 0;
@@ -68,7 +71,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
         $em = $this->getContainer()->get('doctrine.orm.entity_manager');
         $repo = $this->getContainer()->get('wallabag_core.entry_repository');
 
-        $entries = $repo->getAllEntriesIdAndUrl($user->getId());
+        $entries = $repo->findAllEntriesIdAndUrlByUserId($user->getId());
 
         $duplicatesCount = 0;
         $urls = [];
@@ -88,7 +91,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
 
         $this->duplicates += $duplicatesCount;
 
-        $this->output->writeln(sprintf('Cleaned %d duplicates for user %s', $duplicatesCount, $user->getUserName()));
+        $this->io->text(sprintf('Cleaned <info>%d</info> duplicates for user <info>%s</info>', $duplicatesCount, $user->getUserName()));
     }
 
     private function similarUrl($url)
index 291926e4e00807aed327412f37e32767300f9e66..b07087c8a1219e847d79eefb9bb8a5cd7852e593 100644 (file)
@@ -7,6 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
 use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
 
 class ExportCommand extends ContainerAwareCommand
 {
@@ -31,10 +32,12 @@ class ExportCommand extends ContainerAwareCommand
 
     protected function execute(InputInterface $input, OutputInterface $output)
     {
+        $io = new SymfonyStyle($input, $output);
+
         try {
             $user = $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($input->getArgument('username'));
         } catch (NoResultException $e) {
-            $output->writeln(sprintf('<error>User "%s" not found.</error>', $input->getArgument('username')));
+            $io->error(sprintf('User "%s" not found.', $input->getArgument('username')));
 
             return 1;
         }
@@ -44,7 +47,7 @@ class ExportCommand extends ContainerAwareCommand
             ->getQuery()
             ->getResult();
 
-        $output->write(sprintf('Exporting %d entrie(s) for user « <comment>%s</comment> »... ', count($entries), $user->getUserName()));
+        $io->text(sprintf('Exporting <info>%d</info> entrie(s) for user <info>%s</info>...', count($entries), $user->getUserName()));
 
         $filePath = $input->getArgument('filepath');
 
@@ -60,12 +63,12 @@ class ExportCommand extends ContainerAwareCommand
                 ->exportJsonData();
             file_put_contents($filePath, $data);
         } catch (\InvalidArgumentException $e) {
-            $output->writeln(sprintf('<error>Error: "%s"</error>', $e->getMessage()));
+            $io->error(sprintf('Error: "%s"', $e->getMessage()));
 
             return 1;
         }
 
-        $output->writeln('<info>Done.</info>');
+        $io->success('Done.');
 
         return 0;
     }
index c78090539ae05f74234f846473148ce0adaaa404..877dbfa27a65ee6d8c50763d341a65e05e8b6234 100644 (file)
@@ -6,14 +6,13 @@ use Craue\ConfigBundle\Entity\Setting;
 use FOS\UserBundle\Event\UserEvent;
 use FOS\UserBundle\FOSUserEvents;
 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
-use Symfony\Component\Console\Helper\Table;
 use Symfony\Component\Console\Input\ArrayInput;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\BufferedOutput;
 use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Question\ConfirmationQuestion;
 use Symfony\Component\Console\Question\Question;
+use Symfony\Component\Console\Style\SymfonyStyle;
 
 class InstallCommand extends ContainerAwareCommand
 {
@@ -23,9 +22,9 @@ class InstallCommand extends ContainerAwareCommand
     protected $defaultInput;
 
     /**
-     * @var OutputInterface
+     * @var SymfonyStyle
      */
-    protected $defaultOutput;
+    protected $io;
 
     /**
      * @var array
@@ -52,10 +51,10 @@ class InstallCommand extends ContainerAwareCommand
     protected function execute(InputInterface $input, OutputInterface $output)
     {
         $this->defaultInput = $input;
-        $this->defaultOutput = $output;
 
-        $output->writeln('<info>Installing wallabag...</info>');
-        $output->writeln('');
+        $this->io = new SymfonyStyle($input, $output);
+
+        $this->io->title('Wallabag installer');
 
         $this
             ->checkRequirements()
@@ -65,13 +64,14 @@ class InstallCommand extends ContainerAwareCommand
             ->runMigrations()
         ;
 
-        $output->writeln('<info>wallabag has been successfully installed.</info>');
-        $output->writeln('<comment>Just execute `php bin/console server:run --env=prod` for using wallabag: http://localhost:8000</comment>');
+        $this->io->success('Wallabag has been successfully installed.');
+        $this->io->note('Just execute `php bin/console server:run --env=prod` for using wallabag: http://localhost:8000');
     }
 
     protected function checkRequirements()
     {
-        $this->defaultOutput->writeln('<info><comment>Step 1 of 5.</comment> Checking system requirements.</info>');
+        $this->io->section('Step 1 of 5: Checking system requirements.');
+
         $doctrineManager = $this->getContainer()->get('doctrine')->getManager();
 
         $rows = [];
@@ -156,30 +156,24 @@ class InstallCommand extends ContainerAwareCommand
             $rows[] = [$label, $status, $help];
         }
 
-        $table = new Table($this->defaultOutput);
-        $table
-            ->setHeaders(['Checked', 'Status', 'Recommendation'])
-            ->setRows($rows)
-            ->render();
+        $this->io->table(['Checked', 'Status', 'Recommendation'], $rows);
 
         if (!$fulfilled) {
             throw new \RuntimeException('Some system requirements are not fulfilled. Please check output messages and fix them.');
         }
 
-        $this->defaultOutput->writeln('<info>Success! Your system can run wallabag properly.</info>');
-
-        $this->defaultOutput->writeln('');
+        $this->io->success('Success! Your system can run wallabag properly.');
 
         return $this;
     }
 
     protected function setupDatabase()
     {
-        $this->defaultOutput->writeln('<info><comment>Step 2 of 5.</comment> Setting up database.</info>');
+        $this->io->section('Step 2 of 5: Setting up database.');
 
         // user want to reset everything? Don't care about what is already here
         if (true === $this->defaultInput->getOption('reset')) {
-            $this->defaultOutput->writeln('Dropping database, creating database and schema, clearing the cache');
+            $this->io->text('Dropping database, creating database and schema, clearing the cache');
 
             $this
                 ->runCommand('doctrine:database:drop', ['--force' => true])
@@ -188,13 +182,13 @@ class InstallCommand extends ContainerAwareCommand
                 ->runCommand('cache:clear')
             ;
 
-            $this->defaultOutput->writeln('');
+            $this->io->newLine();
 
             return $this;
         }
 
         if (!$this->isDatabasePresent()) {
-            $this->defaultOutput->writeln('Creating database and schema, clearing the cache');
+            $this->io->text('Creating database and schema, clearing the cache');
 
             $this
                 ->runCommand('doctrine:database:create')
@@ -202,16 +196,13 @@ class InstallCommand extends ContainerAwareCommand
                 ->runCommand('cache:clear')
             ;
 
-            $this->defaultOutput->writeln('');
+            $this->io->newLine();
 
             return $this;
         }
 
-        $questionHelper = $this->getHelper('question');
-        $question = new ConfirmationQuestion('It appears that your database already exists. Would you like to reset it? (y/N)', false);
-
-        if ($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)) {
-            $this->defaultOutput->writeln('Dropping database, creating database and schema');
+        if ($this->io->confirm('It appears that your database already exists. Would you like to reset it?', false)) {
+            $this->io->text('Dropping database, creating database and schema...');
 
             $this
                 ->runCommand('doctrine:database:drop', ['--force' => true])
@@ -219,9 +210,8 @@ class InstallCommand extends ContainerAwareCommand
                 ->runCommand('doctrine:schema:create')
             ;
         } elseif ($this->isSchemaPresent()) {
-            $question = new ConfirmationQuestion('Seems like your database contains schema. Do you want to reset it? (y/N)', false);
-            if ($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)) {
-                $this->defaultOutput->writeln('Dropping schema and creating schema');
+            if ($this->io->confirm('Seems like your database contains schema. Do you want to reset it?', false)) {
+                $this->io->text('Dropping schema and creating schema...');
 
                 $this
                     ->runCommand('doctrine:schema:drop', ['--force' => true])
@@ -229,29 +219,27 @@ class InstallCommand extends ContainerAwareCommand
                 ;
             }
         } else {
-            $this->defaultOutput->writeln('Creating schema');
+            $this->io->text('Creating schema...');
 
             $this
                 ->runCommand('doctrine:schema:create')
             ;
         }
 
-        $this->defaultOutput->writeln('Clearing the cache');
+        $this->io->text('Clearing the cache...');
         $this->runCommand('cache:clear');
 
-        $this->defaultOutput->writeln('');
+        $this->io->newLine();
+        $this->io->text('<info>Database successfully setup.</info>');
 
         return $this;
     }
 
     protected function setupAdmin()
     {
-        $this->defaultOutput->writeln('<info><comment>Step 3 of 5.</comment> Administration setup.</info>');
-
-        $questionHelper = $this->getHelperSet()->get('question');
-        $question = new ConfirmationQuestion('Would you like to create a new admin user (recommended) ? (Y/n)', true);
+        $this->io->section('Step 3 of 5: Administration setup.');
 
-        if (!$questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)) {
+        if (!$this->io->confirm('Would you like to create a new admin user (recommended)?', true)) {
             return $this;
         }
 
@@ -260,14 +248,13 @@ class InstallCommand extends ContainerAwareCommand
         $userManager = $this->getContainer()->get('fos_user.user_manager');
         $user = $userManager->createUser();
 
-        $question = new Question('Username (default: wallabag) :', 'wallabag');
-        $user->setUsername($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question));
+        $user->setUsername($this->io->ask('Username', 'wallabag'));
 
-        $question = new Question('Password (default: wallabag) :', 'wallabag');
-        $user->setPlainPassword($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question));
+        $question = new Question('Password', 'wallabag');
+        $question->setHidden(true);
+        $user->setPlainPassword($this->io->askQuestion($question));
 
-        $question = new Question('Email:', '');
-        $user->setEmail($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question));
+        $user->setEmail($this->io->ask('Email', ''));
 
         $user->setEnabled(true);
         $user->addRole('ROLE_SUPER_ADMIN');
@@ -278,14 +265,14 @@ class InstallCommand extends ContainerAwareCommand
         $event = new UserEvent($user);
         $this->getContainer()->get('event_dispatcher')->dispatch(FOSUserEvents::USER_CREATED, $event);
 
-        $this->defaultOutput->writeln('');
+        $this->io->text('<info>Administration successfully setup.</info>');
 
         return $this;
     }
 
     protected function setupConfig()
     {
-        $this->defaultOutput->writeln('<info><comment>Step 4 of 5.</comment> Config setup.</info>');
+        $this->io->section('Step 4 of 5: Config setup.');
         $em = $this->getContainer()->get('doctrine.orm.entity_manager');
 
         // cleanup before insert new stuff
@@ -301,18 +288,20 @@ class InstallCommand extends ContainerAwareCommand
 
         $em->flush();
 
-        $this->defaultOutput->writeln('');
+        $this->io->text('<info>Config successfully setup.</info>');
 
         return $this;
     }
 
     protected function runMigrations()
     {
-        $this->defaultOutput->writeln('<info><comment>Step 5 of 5.</comment> Run migrations.</info>');
+        $this->io->section('Step 5 of 5: Run migrations.');
 
         $this
             ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true]);
 
+        $this->io->text('<info>Migrations successfully executed.</info>');
+
         return $this;
     }
 
diff --git a/src/Wallabag/CoreBundle/Command/ListUserCommand.php b/src/Wallabag/CoreBundle/Command/ListUserCommand.php
new file mode 100644 (file)
index 0000000..20660d1
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+
+namespace Wallabag\CoreBundle\Command;
+
+use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
+
+class ListUserCommand extends ContainerAwareCommand
+{
+    protected function configure()
+    {
+        $this
+            ->setName('wallabag:user:list')
+            ->setDescription('List all users')
+            ->setHelp('This command list all existing users')
+            ->addArgument('search', InputArgument::OPTIONAL, 'Filter list by given search term')
+            ->addOption('limit', 'l', InputOption::VALUE_REQUIRED, 'Max number of displayed users', 100)
+        ;
+    }
+
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        $io = new SymfonyStyle($input, $output);
+
+        $users = $this->getContainer()->get('wallabag_user.user_repository')
+            ->getQueryBuilderForSearch($input->getArgument('search'))
+            ->setMaxResults($input->getOption('limit'))
+            ->getQuery()
+            ->getResult();
+
+        $nbUsers = $this->getContainer()->get('wallabag_user.user_repository')
+            ->getSumUsers();
+
+        $rows = [];
+        foreach ($users as $user) {
+            $rows[] = [
+                $user->getUsername(),
+                $user->getEmail(),
+                $user->isEnabled() ? 'yes' : 'no',
+                $user->hasRole('ROLE_SUPER_ADMIN') || $user->hasRole('ROLE_ADMIN') ? 'yes' : 'no',
+            ];
+        }
+
+        $io->table(['username', 'email', 'is enabled?', 'is admin?'], $rows);
+
+        $io->success(
+            sprintf(
+                '%s/%s%s user(s) displayed.',
+                count($users),
+                $nbUsers,
+                $input->getArgument('search') === null ? '' : ' (filtered)'
+            )
+        );
+
+        return 0;
+    }
+}
diff --git a/src/Wallabag/CoreBundle/Command/ReloadEntryCommand.php b/src/Wallabag/CoreBundle/Command/ReloadEntryCommand.php
new file mode 100644 (file)
index 0000000..9199884
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+
+namespace Wallabag\CoreBundle\Command;
+
+use Doctrine\ORM\NoResultException;
+use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
+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\Event\EntrySavedEvent;
+
+class ReloadEntryCommand extends ContainerAwareCommand
+{
+    protected function configure()
+    {
+        $this
+            ->setName('wallabag:entry:reload')
+            ->setDescription('Reload entries')
+            ->setHelp('This command reload entries')
+            ->addArgument('username', InputArgument::OPTIONAL, 'Reload entries only for the given user')
+        ;
+    }
+
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        $io = new SymfonyStyle($input, $output);
+
+        $userId = null;
+        if ($username = $input->getArgument('username')) {
+            try {
+                $userId = $this->getContainer()
+                    ->get('wallabag_user.user_repository')
+                    ->findOneByUserName($username)
+                    ->getId();
+            } catch (NoResultException $e) {
+                $io->error(sprintf('User "%s" not found.', $username));
+
+                return 1;
+            }
+        }
+
+        $entryRepository = $this->getContainer()->get('wallabag_core.entry_repository');
+        $entryIds = $entryRepository->findAllEntriesIdByUserId($userId);
+
+        $nbEntries = count($entryIds);
+        if (!$nbEntries) {
+            $io->success('No entry to reload.');
+
+            return 0;
+        }
+
+        $io->note(
+            sprintf(
+                "You're going to reload %s entries. Depending on the number of entry to reload, this could be a very long process.",
+                $nbEntries
+            )
+        );
+
+        if (!$io->confirm('Are you sure you want to proceed?')) {
+            return 0;
+        }
+
+        $progressBar = $io->createProgressBar($nbEntries);
+
+        $contentProxy = $this->getContainer()->get('wallabag_core.content_proxy');
+        $em = $this->getContainer()->get('doctrine')->getManager();
+        $dispatcher = $this->getContainer()->get('event_dispatcher');
+
+        $progressBar->start();
+        foreach ($entryIds as $entryId) {
+            $entry = $entryRepository->find($entryId);
+
+            $contentProxy->updateEntry($entry, $entry->getUrl());
+            $em->persist($entry);
+            $em->flush();
+
+            $dispatcher->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry));
+            $progressBar->advance();
+
+            $em->detach($entry);
+        }
+        $progressBar->finish();
+
+        $io->newLine(2);
+        $io->success('Done.');
+
+        return 0;
+    }
+}
index 090309d9807d827a70af62f81c7ee4f6220dd538..2dca32c40a469a47cc6a18e6f5c692e5a80709bb 100644 (file)
@@ -52,11 +52,11 @@ class ShowUserCommand extends ContainerAwareCommand
     private function showUser(User $user)
     {
         $this->io->listing([
-            sprintf('Username : %s', $user->getUsername()),
-            sprintf('Email : %s', $user->getEmail()),
-            sprintf('Display name : %s', $user->getName()),
-            sprintf('Creation date : %s', $user->getCreatedAt()->format('Y-m-d H:i:s')),
-            sprintf('Last login : %s', $user->getLastLogin() !== null ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'),
+            sprintf('Username: %s', $user->getUsername()),
+            sprintf('Email: %s', $user->getEmail()),
+            sprintf('Display name: %s', $user->getName()),
+            sprintf('Creation date: %s', $user->getCreatedAt()->format('Y-m-d H:i:s')),
+            sprintf('Last login: %s', $user->getLastLogin() !== null ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'),
             sprintf('2FA activated: %s', $user->isTwoFactorAuthentication() ? 'yes' : 'no'),
         ]);
     }
index 9843674e23980173e46f41b30f6d158c8c75fc00..4afac2d45808fb5ee69e559afb59585538b2cae1 100644 (file)
@@ -7,6 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
 use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
 
 class TagAllCommand extends ContainerAwareCommand
 {
@@ -25,21 +26,22 @@ class TagAllCommand extends ContainerAwareCommand
 
     protected function execute(InputInterface $input, OutputInterface $output)
     {
+        $io = new SymfonyStyle($input, $output);
+
         try {
             $user = $this->getUser($input->getArgument('username'));
         } catch (NoResultException $e) {
-            $output->writeln(sprintf('<error>User "%s" not found.</error>', $input->getArgument('username')));
+            $io->error(sprintf('User "%s" not found.', $input->getArgument('username')));
 
             return 1;
         }
         $tagger = $this->getContainer()->get('wallabag_core.rule_based_tagger');
 
-        $output->write(sprintf('Tagging entries for user « <comment>%s</comment> »... ', $user->getUserName()));
+        $io->text(sprintf('Tagging entries for user <info>%s</info>...', $user->getUserName()));
 
         $entries = $tagger->tagAllForUser($user);
 
-        $output->writeln('<info>Done.</info>');
-        $output->write(sprintf('Persist entries ... ', $user->getUserName()));
+        $io->text('Persist entries... ');
 
         $em = $this->getDoctrine()->getManager();
         foreach ($entries as $entry) {
@@ -47,7 +49,9 @@ class TagAllCommand extends ContainerAwareCommand
         }
         $em->flush();
 
-        $output->writeln('<info>Done.</info>');
+        $io->success('Done.');
+
+        return 0;
     }
 
     /**
index 845ebef680aef6df2f21096fa9785f28bedfd224..3dcfbebeeb00f94afde4cf42dc658411a026b395 100644 (file)
@@ -573,6 +573,7 @@ class EntryController extends Controller
                 'entries' => $entries,
                 'currentPage' => $page,
                 'searchTerm' => $searchTerm,
+                'isFiltered' => $form->isSubmitted(),
             ]
         );
     }
index f2ca58c6af004ee74d1b42ccc7d6865be38a8507..be2dff98b3b62fcb69849f505fba3be6e7659929 100644 (file)
@@ -84,28 +84,11 @@ class TagController extends Controller
      */
     public function showTagAction()
     {
-        $repository = $this->get('wallabag_core.entry_repository');
         $tags = $this->get('wallabag_core.tag_repository')
-            ->findAllTags($this->getUser()->getId());
-
-        $flatTags = [];
-
-        foreach ($tags as $tag) {
-            $nbEntries = $repository->countAllEntriesByUserIdAndTagId(
-                $this->getUser()->getId(),
-                $tag->getId()
-            );
-
-            $flatTags[] = [
-                'id' => $tag->getId(),
-                'label' => $tag->getLabel(),
-                'slug' => $tag->getSlug(),
-                'nbEntries' => $nbEntries,
-            ];
-        }
+            ->findAllFlatTagsWithNbEntries($this->getUser()->getId());
 
         return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [
-            'tags' => $flatTags,
+            'tags' => $tags,
         ]);
     }
 
index 10689c62bbf82e631dda0da5f708b23dccc163f2..da19fe3124a2d555ff0b8adc4ccf16923623a851 100644 (file)
@@ -8,6 +8,7 @@ use Graby\SiteConfig\ConfigBuilder;
 use Psr\Log\LoggerInterface;
 use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
 use Wallabag\CoreBundle\Repository\SiteCredentialRepository;
+use Wallabag\UserBundle\Entity\User;
 
 class GrabySiteConfigBuilder implements SiteConfigBuilder
 {
@@ -27,7 +28,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder
     private $logger;
 
     /**
-     * @var Wallabag\UserBundle\Entity\User|null
+     * @var User|null
      */
     private $currentUser;
 
index 64d8219325d532e3eed2f8d88a7b31286489f26f..de259e7ffc25246acbab2299078b63afd38778cd 100644 (file)
@@ -2,12 +2,12 @@
 
 namespace Wallabag\CoreBundle\Helper;
 
-use JMS\Serializer;
 use JMS\Serializer\SerializationContext;
 use JMS\Serializer\SerializerBuilder;
 use PHPePub\Core\EPub;
 use PHPePub\Core\Structure\OPF\DublinCore;
 use Symfony\Component\HttpFoundation\Response;
+use Wallabag\CoreBundle\Entity\Entry;
 
 /**
  * This class doesn't have unit test BUT it's fully covered by a functional test with ExportControllerTest.
@@ -427,7 +427,7 @@ class EntriesExport
      *
      * @param string $format
      *
-     * @return Serializer
+     * @return string
      */
     private function prepareSerializingContent($format)
     {
index c27ee90cc197c45ed9733db448b1d1f29f795741..eb5e3205ceeb8b41c81d182e2d9a99f1c33f3d83 100644 (file)
@@ -3,9 +3,10 @@
 namespace Wallabag\CoreBundle\Repository;
 
 use Doctrine\ORM\EntityRepository;
-use Doctrine\ORM\Query;
+use Doctrine\ORM\QueryBuilder;
 use Pagerfanta\Adapter\DoctrineORMAdapter;
 use Pagerfanta\Pagerfanta;
+use Wallabag\CoreBundle\Entity\Entry;
 use Wallabag\CoreBundle\Entity\Tag;
 
 class EntryRepository extends EntityRepository
@@ -74,7 +75,7 @@ class EntryRepository extends EntityRepository
      *
      * @param int    $userId
      * @param string $term
-     * @param strint $currentRoute
+     * @param string $currentRoute
      *
      * @return QueryBuilder
      */
@@ -126,7 +127,7 @@ class EntryRepository extends EntityRepository
      * @param int    $since
      * @param string $tags
      *
-     * @return array
+     * @return Pagerfanta
      */
     public function findEntries($userId, $isArchived = null, $isStarred = null, $isPublic = null, $sort = 'created', $order = 'ASC', $since = 0, $tags = '')
     {
@@ -172,7 +173,7 @@ class EntryRepository extends EntityRepository
      *
      * @param int $userId
      *
-     * @return Entry
+     * @return array
      */
     public function findOneWithTags($userId)
     {
@@ -328,26 +329,6 @@ class EntryRepository extends EntityRepository
         return (int) $qb->getQuery()->getSingleScalarResult();
     }
 
-    /**
-     * Count all entries for a tag and a user.
-     *
-     * @param int $userId
-     * @param int $tagId
-     *
-     * @return int
-     */
-    public function countAllEntriesByUserIdAndTagId($userId, $tagId)
-    {
-        $qb = $this->createQueryBuilder('e')
-            ->select('count(e.id)')
-            ->leftJoin('e.tags', 't')
-            ->where('e.user=:userId')->setParameter('userId', $userId)
-            ->andWhere('t.id=:tagId')->setParameter('tagId', $tagId)
-        ;
-
-        return (int) $qb->getQuery()->getSingleScalarResult();
-    }
-
     /**
      * Remove all entries for a user id.
      * Used when a user want to reset all informations.
@@ -374,7 +355,7 @@ class EntryRepository extends EntityRepository
      * Get id and url from all entries
      * Used for the clean-duplicates command.
      */
-    public function getAllEntriesIdAndUrl($userId)
+    public function findAllEntriesIdAndUrlByUserId($userId)
     {
         $qb = $this->createQueryBuilder('e')
             ->select('e.id, e.url')
@@ -383,6 +364,23 @@ class EntryRepository extends EntityRepository
         return $qb->getQuery()->getArrayResult();
     }
 
+    /**
+     * @param int $userId
+     *
+     * @return array
+     */
+    public function findAllEntriesIdByUserId($userId = null)
+    {
+        $qb = $this->createQueryBuilder('e')
+            ->select('e.id');
+
+        if (null !== $userId) {
+            $qb->where('e.user = :userid')->setParameter(':userid', $userId);
+        }
+
+        return $qb->getQuery()->getArrayResult();
+    }
+
     /**
      * Find all entries by url and owner.
      *
index 6c63a6a2792e8f276d49b098eed055c688834d8e..5c45211f6beb1e2820e9ed5ddba79f95c10a04df 100644 (file)
@@ -3,6 +3,7 @@
 namespace Wallabag\CoreBundle\Repository;
 
 use Doctrine\ORM\EntityRepository;
+use Wallabag\CoreBundle\Entity\Tag;
 
 class TagRepository extends EntityRepository
 {
@@ -61,6 +62,27 @@ class TagRepository extends EntityRepository
         return $tags;
     }
 
+    /**
+     * Find all tags (flat) per user with nb entries.
+     *
+     * @param int $userId
+     *
+     * @return array
+     */
+    public function findAllFlatTagsWithNbEntries($userId)
+    {
+        return $this->createQueryBuilder('t')
+            ->select('t.id, t.label, t.slug, count(e.id) as nbEntries')
+            ->distinct(true)
+            ->leftJoin('t.entries', 'e')
+            ->where('e.user = :userId')
+            ->groupBy('t.id')
+            ->orderBy('t.slug')
+            ->setParameter('userId', $userId)
+            ->getQuery()
+            ->getArrayResult();
+    }
+
     /**
      * Used only in test case to get a tag for our entry.
      *
index 5229ac73287f5f00ac85a3a16893718cb39e468c..5e5bbde2f0a4739043cdf7176753858ed5381def 100644 (file)
@@ -169,6 +169,7 @@ entry:
         # filtered_tags: 'Filtered by tags:'
         # filtered_search: 'Filtered by search:'
         # untagged: 'Untagged entries'
+        # all: 'All entries'
     list:
         # number_on_the_page: '{0} There is no entry.|{1} There is one entry.|]1,Inf[ There are %count% entries.'
         reading_time: 'estimeret læsetid'
index 996f173a892f08db3285b606f3a86c505181bbdb..48f8a53539cb6f08b73b2cd7095aa81ca5a57304 100644 (file)
@@ -169,6 +169,7 @@ entry:
         filtered_tags: 'Gefiltert nach Tags:'
         filtered_search: 'Gefiltert nach Suche:'
         untagged: 'Nicht getaggte Einträge'
+        all: 'Alle Einträge'
     list:
         number_on_the_page: '{0} Es gibt keine Einträge.|{1} Es gibt einen Eintrag.|]1,Inf[ Es gibt %count% Einträge.'
         reading_time: 'geschätzte Lesezeit'
index aa1cd1a970b1d8ea23a964757cf859795315f498..f41a7c8532ef08b4ac0decbfdb2b0f5bb7b5f527 100644 (file)
@@ -169,6 +169,7 @@ entry:
         filtered_tags: 'Filtered by tags:'
         filtered_search: 'Filtered by search:'
         untagged: 'Untagged entries'
+        all: 'All entries'
     list:
         number_on_the_page: '{0} There are no entries.|{1} There is one entry.|]1,Inf[ There are %count% entries.'
         reading_time: 'estimated reading time'
index 96998f53579b8c38882918bdc729680148134684..ea4d84ba51d20380169a4f00ad12eba5164a8102 100644 (file)
@@ -169,6 +169,7 @@ entry:
         filtered_tags: 'Filtrado por etiquetas:'
         filtered_search: 'Filtrado por búsqueda:'
         untagged: 'Artículos sin etiquetas'
+        all: "Todos los artículos"
     list:
         number_on_the_page: '{0} No hay artículos.|{1} Hay un artículo.|]1,Inf[ Hay %count% artículos.'
         reading_time: 'tiempo estimado de lectura'
index 57e6c0298150a77fb170836eed848bc25841bad4..11047e830029833611751804625f9c7610e2065d 100644 (file)
@@ -169,6 +169,7 @@ entry:
         # filtered_tags: 'Filtered by tags:'
         # filtered_search: 'Filtered by search:'
         # untagged: 'Untagged entries'
+        # all: 'All entries'
     list:
         number_on_the_page: '{0} هیج مقاله‌ای نیست.|{1} یک مقاله هست.|]1,Inf[ %count% مقاله هست.'
         reading_time: 'زمان تخمینی برای خواندن'
index 6eac4c36d2e9f3fea5197c1606c20cbe8e753cc5..246add86de7db9754439b7cc0c1cabb2489431dc 100644 (file)
@@ -169,6 +169,7 @@ entry:
         filtered_tags: "Articles filtrés par tags :"
         filtered_search: "Articles filtrés par recherche :"
         untagged: "Article sans tag"
+        all: "Tous les articles"
     list:
         number_on_the_page: "{0} Il n’y a pas d’article.|{1} Il y a un article.|]1,Inf[ Il y a %count% articles."
         reading_time: "durée de lecture"
index fa7ae0b20d12e8c060413f0ef93285ea1e2fbeff..0de8bed7fec5807d8ad5c2be645217bc7ec8205a 100644 (file)
@@ -169,6 +169,7 @@ entry:
         filtered_tags: 'Filtrati per etichetta:'
         filtered_search: 'Filtrati per ricerca:'
         untagged: 'Articoli non etichettati'
+        all: 'Tutti gli articoli'
     list:
         number_on_the_page: "{0} Non ci sono contenuti.|{1} C'è un contenuto.|]1,Inf[ Ci sono %count% contenuti."
         reading_time: 'tempo di lettura stimato'
index be57e9034af7efe8b8c5a6d6d3bc0e87c98a9a4e..c2b4924711ea70da7c2c354108588fc9c3e9ed73 100644 (file)
@@ -2,7 +2,7 @@ security:
     login:
         page_title: 'Benvenguda sus wallabag !'
         keep_logged_in: 'Demorar connectat'
-        forgot_password: 'Senhal doblidat ?'
+        forgot_password: 'Senhal oblidat ?'
         submit: 'Se connectar'
         register: 'Crear un compte'
         username: "Nom d'utilizaire"
@@ -12,7 +12,7 @@ security:
         description: "Picatz vòstra adreça de corrièl çai-jos, vos mandarem las instruccions per reïnicializar vòstre senhal."
     register:
         page_title: 'Se crear un compte'
-        go_to_account: 'Anar sus vòstre compte'
+        go_to_account: 'Anar a vòstre compte'
 
 menu:
     left:
@@ -22,7 +22,7 @@ menu:
         all_articles: 'Totes los articles'
         config: 'Configuracion'
         tags: 'Etiquetas'
-        internal_settings: 'Configuracion interna'
+        internal_settings: 'Configuracion intèrna'
         import: 'Importar'
         howto: 'Ajuda'
         developer: 'Gestion dels clients API'
@@ -32,7 +32,7 @@ menu:
         save_link: 'Enregistrar un novèl article'
         back_to_unread: 'Tornar als articles pas legits'
         users_management: 'Gestion dels utilizaires'
-        # site_credentials: 'Site credentials'
+        site_credentials: 'Identificants del site'
     top:
         add_new_entry: 'Enregistrar un novèl article'
         search: 'Cercar'
@@ -77,7 +77,7 @@ config:
             redirect_current_page: 'A la pagina actuala'
         pocket_consumer_key_label: Clau d'autentificacion Pocket per importar las donadas
         android_configuration: Configuratz vòstra aplicacion Android
-        # android_instruction: "Touch here to prefill your Android application"
+        android_instruction: "Tocatz aquí per garnir las informacions de l'aplicacion Android"
         help_theme: "wallabag es personalizable. Podètz causir vòstre tèma preferit aquí."
         help_items_per_page: "Podètz cambiar lo nombre d'articles afichats per pagina."
         help_reading_speed: "wallabag calcula lo temps de lectura per cada article. Podètz lo definir aquí, gràcias a aquesta lista, se sètz un legeire rapid o lent. wallabag tornarà calcular lo temps de lectura per cada article."
@@ -94,14 +94,14 @@ config:
             unread: 'Pas legits'
             starred: 'Favorits'
             archive: 'Legits'
-            # all: 'All'
+            all: 'Totes'
         rss_limit: "Nombre d'articles dins un flux RSS"
     form_user:
-        two_factor_description: "Activar l'autentificacion doble-factor vòl dire que recebretz un còdi per corrièl per cada novèla connexion pas aprovada."
+        two_factor_description: "Activar l'autentificacion en dos temps vòl dire que recebretz un còdi per corrièl per cada novèla connexion pas aprovada."
         name_label: 'Nom'
         email_label: 'Adreça de corrièl'
         twoFactorAuthentication_label: 'Dobla autentificacion'
-        help_twoFactorAuthentication: "S'avètz activat 2FA, cada còp que volètz vos connectar a wallabag, recebretz un còdi per corrièl."
+        help_twoFactorAuthentication: "S'avètz activat l'autentificacion en dos temps, cada còp que volètz vos connectar a wallabag, recebretz un còdi per corrièl."
         delete:
             title: Suprimir mon compte (Mèfi zòna perilhosa)
             description: Se confirmatz la supression de vòstre compte, TOTES vòstres articles, TOTAS vòstras etiquetas, TOTAS vòstras anotacions e vòstre compte seràn suprimits per totjorn. E aquò es IRREVERSIBLE. Puèi seretz desconnectat.
@@ -169,6 +169,7 @@ entry:
         filtered_tags: 'Articles filtrats per etiquetas :'
         filtered_search: 'Articles filtrats per recèrca :'
         untagged: 'Articles sens etiqueta'
+        all: 'Totes los articles'
     list:
         number_on_the_page: "{0} I a pas cap d'article.|{1} I a un article.|]1,Inf[ I a %count% articles."
         reading_time: 'durada de lectura'
@@ -190,8 +191,8 @@ entry:
         unread_label: 'Pas legits'
         preview_picture_label: 'A un imatge'
         preview_picture_help: 'Imatge'
-        # is_public_label: 'Has a public link'
-        # is_public_help: 'Public link'
+        is_public_label: 'Ten un ligam public'
+        is_public_help: 'Ligam public'
         language_label: 'Lenga'
         http_status_label: 'Estatut HTTP'
         reading_time:
@@ -212,7 +213,7 @@ entry:
             back_to_homepage: 'Tornar'
             set_as_read: 'Marcar coma legit'
             set_as_unread: 'Marcar coma pas legit'
-            set_as_starred: 'Metre en favori'
+            set_as_starred: 'Metre en favorit'
             view_original_article: 'Article original'
             re_fetch_content: 'Tornar cargar lo contengut'
             delete: 'Suprimir'
@@ -247,8 +248,8 @@ entry:
     public:
         shared_by_wallabag: "Aqueste article es estat partejat per <a href='%wallabag_instance%'>wallabag</a>"
     confirm:
-        # delete: "Are you sure you want to remove that article?"
-        # delete_tag: "Are you sure you want to remove that tag from that article?"
+        delete: "Sètz segur de voler suprimir aqueste article ?"
+        delete_tag: "Sètz segur de voler levar aquesta etiqueta de l'article ?"
 
 about:
     page_title: 'A prepaus'
@@ -338,7 +339,7 @@ quickstart:
     more: 'Mai…'
     intro:
         title: 'Benvenguda sus wallabag !'
-        paragraph_1: "Anem vos guidar per far lo torn de la proprietat e vos presentar unas fonccionalitats que vos poirián interessar per vos apropriar aquesta aisina."
+        paragraph_1: "Anem vos guidar per far lo torn de la proprietat e vos presentar unas foncionalitats que vos poirián interessar per vos apropriar aquesta aisina."
         paragraph_2: 'Seguètz-nos !'
     configure:
         title: "Configuratz l'aplicacion"
@@ -358,7 +359,7 @@ quickstart:
         title: 'Primièrs passes'
         description: "Ara wallabag es ben configurat, es lo moment d'archivar lo web. Podètz clicar sul signe + a man drecha amont per ajustar un ligam."
         new_article: 'Ajustatz vòstre primièr article'
-        unread_articles: 'E racaptatz-lo !'
+        unread_articles: 'E recaptatz-lo !'
     migrate:
         title: 'Migrar dempuèi un servici existent'
         description: "Sètz un ancian utilizaire d'un servici existent ? Vos ajudarem a trapar vòstras donadas sus wallabag."
@@ -374,7 +375,7 @@ quickstart:
         use_docker: 'Utilizar Docker per installar wallabag'
     docs:
         title: 'Documentacion complèta'
-        description: "I a un fum de fonccionalitats dins wallabag. Esitetz pas a legir lo manual per las conéisser e aprendre a las utilizar."
+        description: "I a un fum de foncionalitats dins wallabag. Esitetz pas a legir lo manual per las conéisser e aprendre a las utilizar."
         annotate: 'Anotar vòstre article'
         export: 'Convertissètz vòstres articles en ePub o en PDF'
         search_filters: "Aprenètz a utilizar lo motor de recèrca e los filtres per retrobar l'article que vos interèssa"
@@ -417,11 +418,11 @@ import:
         connect_to_pocket: 'Se connectar a Pocket e importar las donadas'
     wallabag_v1:
         page_title: 'Importar > Wallabag v1'
-        description: 'Aquesta aisina importarà totas vòstras donadas de wallabag v1. Sus vòstre pagina de configuracion de wallabag v1, clicatz sus \"Export JSON\" dins la seccion \"Exportar vòstras donadas de wallabag\". Traparatz un fichièr \"wallabag-export-1-xxxx-xx-xx.json\".'
+        description: 'Aquesta aisina importarà totas vòstras donadas de wallabag v1. Sus vòstre pagina de configuracion de wallabag v1, clicatz sus \"Export JSON\" dins la seccion \"Exportar vòstras donadas de wallabag\". Traparetz un fichièr \"wallabag-export-1-xxxx-xx-xx.json\".'
         how_to: "Causissètz lo fichièr de vòstra exportacion wallabag v1 e clicatz sul boton çai-jos per l'importar."
     wallabag_v2:
         page_title: 'Importar > Wallabag v2'
-        description: "Aquesta aisina importarà totas vòstras donadas d'una instància mai de wallabag v2. Anatz dins totes vòstres articles, puèi, sus la barra laterala, clicatz sus \"JSON\". Traparatz un fichièr \"All articles.json\"."
+        description: "Aquesta aisina importarà totas vòstras donadas d'una instància mai de wallabag v2. Anatz dins totes vòstres articles, puèi, sus la barra laterala, clicatz sus \"JSON\". Traparetz un fichièr \"All articles.json\"."
     readability:
         page_title: 'Importar > Readability'
         description: "Aquesta aisina importarà totas vòstres articles de Readability. Sus la pagina de l'aisina (https://www.readability.com/tools/), clicatz sus \"Export your data\" dins la seccion \"Data Export\". Recebretz un corrièl per telecargar un json (qu'acaba pas amb un .json de fach)."
@@ -431,7 +432,7 @@ import:
         download_images_warning: "Avètz activat lo telecargament de los imatges de vòstres articles. Combinat amb l'importacion classica, aquò pòt tardar un long moment (o benlèu fracassar). <strong>Recomandem fòrtament</strong> l'activacion de l'importacion asincròna per evitar las errors."
     firefox:
         page_title: 'Importar > Firefox'
-        description: "Aquesta aisina importarà totas vòstres favorits de Firefox. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
+        description: "Aquesta aisina importarà totas vòstres favorits de Firefox. Anatz simplament dins vòstres marcapaginas (Ctrl+Maj+O), puèi dins \"Impòrt e salvagarda\", causissètz \"Salvagardar...\". Auretz un fichièr .json."
         how_to: "Mercés de causir lo fichièr de salvagarda e de clicar sul boton dejós per l'importar. Notatz que lo tractament pòt durar un moment ja que totes los articles an d'èsser recuperats."
     chrome:
         page_title: 'Importar > Chrome'
@@ -459,12 +460,12 @@ developer:
     existing_clients:
         title: 'Los clients existents'
         field_id: 'ID Client'
-        field_secret: 'Clé secreta'
+        field_secret: 'Clau secrèta'
         field_uris: 'URLs de redireccion'
         field_grant_types: 'Tipe de privilègi acordat'
         no_client: 'Pas cap de client pel moment.'
     remove:
-        warn_message_1: 'Avètz la possibilitat de supriimr un client. Aquesta accion es IRREVERSIBLA !'
+        warn_message_1: 'Avètz la possibilitat de suprimir un client. Aquesta accion es IRREVERSIBLA !'
         warn_message_2: "Se suprimissètz un client, totas las aplicacions que l'emplegan foncionaràn pas mai amb vòstre compte wallabag."
         action: 'Suprimir aqueste client'
     client:
@@ -525,20 +526,20 @@ user:
         placeholder: "Filtrar per nom d'utilizaire o corrièl"
 
 site_credential:
-    # page_title: Site credentials management
-    # new_site_credential: Create a credential
-    # edit_site_credential: Edit an existing credential
-    # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
+    page_title: Gestion dels identificants
+    new_site_credential: Crear un identificant
+    edit_site_credential: Modificar un identificant
+    description: "Aquí podètz gerir vòstres identificants pels sites que los demandan (ne crear, ne modifiar, ne suprimir) coma los sites a peatge, etc."
     list:
          actions: 'Accions'
          edit_action: 'Modificar'
          yes: 'Òc'
          no: 'Non'
-        # create_new_one: Create a new credential
+         create_new_one: Crear un novèl identificant
     form:
-        # username_label: 'Username'
-        # host_label: 'Host'
-        # password_label: 'Password'
+        username_label: "Nom d'utilizaire"
+        host_label: 'Òste'
+        password_label: 'Senhal'
         save: 'Enregistrar'
         delete: 'Suprimir'
         delete_confirm: 'Sètz segur ?'
@@ -552,7 +553,7 @@ flashes:
         notice:
             config_saved: 'Los paramètres son ben estats meses a jorn.'
             password_updated: 'Vòstre senhal es ben estat mes a jorn'
-            password_not_updated_demo: "En demostration, podètz pas cambiar lo senhal d'aqueste utilizaire."
+            password_not_updated_demo: "En demostracion, podètz pas cambiar lo senhal d'aqueste utilizaire."
             user_updated: 'Vòstres informacions personnelas son ben estadas mesas a jorn'
             rss_updated: 'La configuracion dels fluxes RSS es ben estada mesa a jorn'
             tagging_rules_updated: 'Règlas misa a jorn'
@@ -564,7 +565,7 @@ flashes:
             archived_reset: Articles archivat suprimits
     entry:
         notice:
-            entry_already_saved: 'Article ja salvargardat lo %date%'
+            entry_already_saved: 'Article ja salvagardat lo %date%'
             entry_saved: 'Article enregistrat'
             entry_saved_failed: 'Article salvat mai fracàs de la recuperacion del contengut'
             entry_updated: 'Article mes a jorn'
@@ -581,9 +582,9 @@ flashes:
     import:
         notice:
             failed: "L'importacion a fracassat, mercés de tornar ensajar."
-            failed_on_file: "Errorr pendent du tractament de l'import. Mercés de verificar vòstre fichièr."
-            summary: "Rapòrt d'import: %imported% importats, %skipped% ja presents."
-            summary_with_queue: "Rapòrt d'import : %queued% en espèra de tractament."
+            failed_on_file: "Error en tractar l'impòrt. Mercés de verificar vòstre fichièr."
+            summary: "Rapòrt d'impòrt: %imported% importats, %skipped% ja presents."
+            summary_with_queue: "Rapòrt d'impòrt : %queued% en espèra de tractament."
         error:
             redis_enabled_not_installed: "Redis es capable d'importar de manièra asincròna mai sembla que <u>podèm pas nos conectar amb el</u>. Mercés de verificar la configuracion de Redis."
             rabbit_enabled_not_installed: "RabbitMQ es capable d'importar de manièra asincròna mai sembla que <u>podèm pas nos conectar amb el</u>. Mercés de verificar la configuracion de RabbitMQ."
@@ -598,6 +599,6 @@ flashes:
             deleted: 'Utilizaire "%username%" suprimit'
     site_credential:
         notice:
-            # added: 'Site credential for "%host%" added'
-            # updated: 'Site credential for "%host%" updated'
-            # deleted: 'Site credential for "%host%" deleted'
+            added: 'Identificant per "%host%" ajustat'
+            updated: 'Identificant per "%host%" mes a jorn'
+            deleted: 'Identificant per "%host%" suprimit'
index 00c559ede0c5602bbb6adc26c4c0fd7ecd9dc80f..c8e6cf6c78ea578eb27f1d0b7b08dfa093a092d5 100644 (file)
@@ -32,7 +32,7 @@ menu:
         save_link: 'Zapisz link'
         back_to_unread: 'Powrót do nieprzeczytanych artykułów'
         users_management: 'Zarządzanie użytkownikami'
-        # site_credentials: 'Site credentials'
+        site_credentials: 'Poświadczenia strony'
     top:
         add_new_entry: 'Dodaj nowy wpis'
         search: 'Szukaj'
@@ -94,7 +94,7 @@ config:
             unread: 'Nieprzeczytane'
             starred: 'Oznaczone gwiazdką'
             archive: 'Archiwum'
-            # all: 'All'
+            all: 'Wszystkie'
         rss_limit: 'Link do RSS'
     form_user:
         two_factor_description: "Włączenie autoryzacji dwuetapowej oznacza, że będziesz otrzymywał maile z kodem przy każdym nowym, niezaufanym połączeniu"
@@ -169,6 +169,7 @@ entry:
         filtered_tags: 'Filtrowane po tagach:'
         filtered_search: 'Filtrowanie po wyszukiwaniu:'
         untagged: 'Odtaguj wpisy'
+        all: 'Wszystkie przedmioty'
     list:
         number_on_the_page: '{0} Nie ma wpisów.|{1} Jest jeden wpis.|]1,Inf[ Są %count% wpisy.'
         reading_time: 'szacunkowy czas czytania'
@@ -525,20 +526,20 @@ user:
         placeholder: Filtruj po nazwie użytkownika lub adresie e-mail
 
 site_credential:
-    # page_title: Site credentials management
-    # new_site_credential: Create a credential
-    # edit_site_credential: Edit an existing credential
-    # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
+    page_title: Zarządzanie poświadczeniami strony
+    new_site_credential: Stwórz nowe poświadczenie
+    edit_site_credential: Edytuj istniejące poświadczenie
+    description: "Tutaj możesz zarządzać wszystkim poświadczeniami wymaganymi przez strony (stwórz, edytuj i usuń ), takie jak paywall, autentykacja, itp."
     list:
         actions: Akcje
         edit_action: Edytuj
         yes: Tak
         no: Nie
-        # create_new_one: Create a new credential
+        create_new_one: Stwórz nowe poświadczenie
     form:
-        # username_label: 'Username'
-        host_label: 'Host'
-        # password_label: 'Password'
+        username_label: 'Nazwa użytkownika'
+        host_label: 'Host'
+        password_label: 'Hasło'
         save: Zapisz
         delete: Usuń
         delete_confirm: Jesteś pewien?
@@ -598,6 +599,6 @@ flashes:
             deleted: 'Użytkownik "%username%" usunięty'
     site_credential:
         notice:
-            # added: 'Site credential for "%host%" added'
-            # updated: 'Site credential for "%host%" updated'
-            # deleted: 'Site credential for "%host%" deleted'
+            added: 'Poświadczenie dla "%host%" dodane'
+            updated: 'Poświadczenie dla "%host%" zaktualizowane'
+            deleted: 'Poświadczenie dla "%host%" usuniętę'
index 4ab5f144c590fddfd335cbb2bc61c01cc3c3258c..5c1ae0584470324b088cf8c115fbf1870f9d53eb 100644 (file)
@@ -169,6 +169,7 @@ entry:
         filtered_tags: 'Filtrar por tags:'
         # filtered_search: 'Filtered by search:'
         untagged: 'Entradas sem tags'
+        # all: 'All entries'
     list:
         number_on_the_page: '{0} Não existem entradas.|{1} Existe uma entrada.|]1,Inf[ Existem %count% entradas.'
         reading_time: 'tempo estimado de leitura'
index f16504eda89bc849adbf230e8f60c10d1838c782..0d6f5f8e38fd4433052b8c6c91e150480c66196b 100644 (file)
@@ -169,6 +169,7 @@ entry:
         # filtered_tags: 'Filtered by tags:'
         # filtered_search: 'Filtered by search:'
         # untagged: 'Untagged entries'
+        # all: 'All entries'
     list:
         # number_on_the_page: '{0} There is no entry.|{1} There is one entry.|]1,Inf[ There are %count% entries.'
         reading_time: 'timp estimat de citire'
index 90a140cd4f9386738ace39726c3b5bd741bad621..87b5e20043614e15b458a92e03019811f83e35dd 100644 (file)
@@ -169,6 +169,7 @@ entry:
         # filtered_tags: 'Filtered by tags:'
         # filtered_search: 'Filtered by search:'
         # untagged: 'Untagged entries'
+        # all: 'All entries'
     list:
         number_on_the_page: '{0} Herhangi bir makale yok.|{1} Burada bir adet makale var.|]1,Inf[ Burada %count% adet makale var.'
         reading_time: 'tahmini okuma süresi'
index 3d20a6bc92418ea3c5e905c3d0f02a5796537375..f8723189b725592fd6a9721e363dc7fbaab7d125 100644 (file)
@@ -35,9 +35,9 @@
                 {% if craue_setting('share_unmark') %}<li><a href="{{ craue_setting('unmark_url') }}/mark/add?url={{ entry.url|url_encode }}&amp;title={{entry.title|url_encode}}&amp;v=6" target="_blank" class="tool unmark icon-image icon-image--unmark" title="unmark"><span>unmark.it</span></a></li>{% endif %}
                 {% if craue_setting('carrot') %}<li><a href="https://secure.carrot.org/GiveAndGetBack.do?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" class="tool carrot icon-image icon-image--carrot" target="_blank" title="carrot"><span>Carrot</span></a></li>{% endif %}
                 {% if craue_setting('show_printlink') %}<li><a title="{{ 'entry.view.left_menu.print'|trans }}" class="tool icon icon-print" href="javascript: window.print();"><span>{{ 'entry.view.left_menu.print'|trans }}</span></a></li>{% endif %}
-                {% if craue_setting('export_epub') %}<li><a href="?epub&amp;method=id&amp;value={{ entry.id }}" title="Generate ePub file">EPUB</a></li>{% endif %}
-                {% if craue_setting('export_mobi') %}<li><a href="?mobi&amp;method=id&amp;value={{ entry.id }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
-                {% if craue_setting('export_pdf') %}<li><a href="?pdf&amp;method=id&amp;value={{ entry.id }}" title="Generate PDF file">PDF</a></li>{% endif %}
+                {% if craue_setting('export_epub') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'epub' }) }}" title="Generate ePub file">EPUB</a></li>{% endif %}
+                {% if craue_setting('export_mobi') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'mobi' }) }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
+                {% if craue_setting('export_pdf') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'pdf' }) }}" title="Generate PDF file">PDF</a></li>{% endif %}
                 <li><a href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&amp;body={{ entry.url|url_encode }}" title="{{ 'entry.view.left_menu.problem.label'|trans }}" class="tool bad-display icon icon-delete"><span>{{ 'entry.view.left_menu.problem.label'|trans }}</span></a></li>
             </ul>
         </div>
index 654c1d2dd1410bccfb40ba6cd87b2db600a7fb8f..5c17e9f7b78d5ced3f91807059e0c8f2b466b224 100644 (file)
@@ -5,7 +5,7 @@
 {% elseif currentRoute == 'archive' %}
     {{ 'entry.page_titles.archived'|trans }}
 {% elseif currentRoute == 'all' %}
-    {{ 'entry.page_titles.filtered'|trans }}
+    {{ isFiltered ? 'entry.page_titles.filtered'|trans : 'entry.page_titles.all'|trans }}
 {% elseif currentRoute == 'search' %}
     {{ 'entry.page_titles.filtered_search'|trans }} {{ filter }}
 {% elseif currentRoute == 'tag_entries' %}
index 7b61805b51cec4f7dfb72d466928ae3a584855c4..6e6524b4cd151cd0c855d2101e91cbc44bc6af11 100644 (file)
@@ -3,7 +3,9 @@
 namespace Wallabag\ImportBundle\Controller;
 
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+use Symfony\Component\HttpFoundation\RedirectResponse;
 use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
 use Wallabag\ImportBundle\Form\Type\UploadImportType;
 
 /**
index f11958247e4f3ac8622add715c59ab1e1c583eab..780773246e6a3d8343646eab5d0da0ba20d44d82 100644 (file)
@@ -4,7 +4,6 @@ namespace Wallabag\ImportBundle\Import;
 
 use Wallabag\CoreBundle\Entity\Entry;
 use Wallabag\CoreBundle\Event\EntrySavedEvent;
-use Wallabag\UserBundle\Entity\User;
 
 abstract class BrowserImport extends AbstractImport
 {
@@ -232,4 +231,6 @@ abstract class BrowserImport extends AbstractImport
 
         return $importedEntry;
     }
+
+    abstract protected function prepareEntry(array $entry = []);
 }
index b1d753d2f42e97d2b1e016f45a87cc5ee546ec61..be693d3b1312f6e86aae660c3798ee2b1e5d6530 100644 (file)
@@ -3,6 +3,8 @@
 namespace Wallabag\UserBundle\Repository;
 
 use Doctrine\ORM\EntityRepository;
+use Doctrine\ORM\QueryBuilder;
+use Wallabag\UserBundle\Entity\User;
 
 class UserRepository extends EntityRepository
 {
@@ -53,6 +55,19 @@ class UserRepository extends EntityRepository
             ->getSingleScalarResult();
     }
 
+    /**
+     * Count how many users are existing.
+     *
+     * @return int
+     */
+    public function getSumUsers()
+    {
+        return $this->createQueryBuilder('u')
+            ->select('count(u)')
+            ->getQuery()
+            ->getSingleScalarResult();
+    }
+
     /**
      * Retrieves users filtered with a search term.
      *
index 53a1afd11bd9030fa93197774c4ca2f45c6b388e..cebf8f28645a84c60952692ebcedf9231cf6e0bf 100644 (file)
@@ -5,7 +5,7 @@ auth_code:
         subject: "Còdi d'autentificacion wallabag"
         body:
             hello: "Bonjorn %user%,"
-            first_para: "Estant qu'avètz activat la dobla autentificacion sus vòtre compte wallabag e que venètz de vos conectar dempuèi un novèl aparelh (ordinador, mobil, etc.) vos mandem un còdi per validar la connexion."
-            second_para: "Vaquí lo còdi a dintrar :"
-            support: "S'avètz un problèma de connexion, dobtetz pas a contacter l'assisténcia : "
+            first_para: "Estant qu'avètz activat l'autentificacion en dos temps sus vòstre compte wallabag e que venètz de vos connectar dempuèi un novèl periferic (ordinador, mobil, etc.) vos mandem un còdi per validar la connexion."
+            second_para: "Vaquí lo còdi per dintrar :"
+            support: "S'avètz un problèma de connexion, dobtetz pas a contactar l'assisténcia : "
             signature: "La còla de wallabag"
index 25de2730a6fac033a751d9701eaa0f5b9ec0e436..210b2ab64e2f0b9221a5af6ff711e30f50358ee9 100644 (file)
@@ -55,7 +55,8 @@ class ExportCommandTest extends WallabagCoreTestCase
             'username' => 'admin',
         ]);
 
-        $this->assertContains('Exporting 5 entrie(s) for user « admin »... Done', $tester->getDisplay());
+        $this->assertContains('Exporting 5 entrie(s) for user admin...', $tester->getDisplay());
+        $this->assertContains('Done', $tester->getDisplay());
         $this->assertFileExists('admin-export.json');
     }
 
diff --git a/tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php b/tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php
new file mode 100644 (file)
index 0000000..9068cf5
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+
+namespace Tests\Wallabag\CoreBundle\Command;
+
+use Symfony\Bundle\FrameworkBundle\Console\Application;
+use Symfony\Component\Console\Tester\CommandTester;
+use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
+use Wallabag\CoreBundle\Command\ListUserCommand;
+
+class ListUserCommandTest extends WallabagCoreTestCase
+{
+    public function testRunListUserCommand()
+    {
+        $application = new Application($this->getClient()->getKernel());
+        $application->add(new ListUserCommand());
+
+        $command = $application->find('wallabag:user:list');
+
+        $tester = new CommandTester($command);
+        $tester->execute([
+            'command' => $command->getName(),
+        ]);
+
+        $this->assertContains('3/3 user(s) displayed.', $tester->getDisplay());
+    }
+
+    public function testRunListUserCommandWithLimit()
+    {
+        $application = new Application($this->getClient()->getKernel());
+        $application->add(new ListUserCommand());
+
+        $command = $application->find('wallabag:user:list');
+
+        $tester = new CommandTester($command);
+        $tester->execute([
+            'command' => $command->getName(),
+            '--limit' => 2,
+        ]);
+
+        $this->assertContains('2/3 user(s) displayed.', $tester->getDisplay());
+    }
+
+    public function testRunListUserCommandWithSearch()
+    {
+        $application = new Application($this->getClient()->getKernel());
+        $application->add(new ListUserCommand());
+
+        $command = $application->find('wallabag:user:list');
+
+        $tester = new CommandTester($command);
+        $tester->execute([
+            'command' => $command->getName(),
+            'search' => 'boss',
+        ]);
+
+        $this->assertContains('1/3 (filtered) user(s) displayed.', $tester->getDisplay());
+    }
+
+    public function testRunListUserCommandWithSearchAndLimit()
+    {
+        $application = new Application($this->getClient()->getKernel());
+        $application->add(new ListUserCommand());
+
+        $command = $application->find('wallabag:user:list');
+
+        $tester = new CommandTester($command);
+        $tester->execute([
+            'command' => $command->getName(),
+            'search' => 'bo',
+            '--limit' => 1,
+        ]);
+
+        $this->assertContains('1/3 (filtered) user(s) displayed.', $tester->getDisplay());
+    }
+}
diff --git a/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php b/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php
new file mode 100644 (file)
index 0000000..63c068b
--- /dev/null
@@ -0,0 +1,115 @@
+<?php
+
+namespace Tests\Wallabag\CoreBundle\Command;
+
+use Symfony\Bundle\FrameworkBundle\Console\Application;
+use Symfony\Component\Console\Tester\CommandTester;
+use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
+use Wallabag\CoreBundle\Command\ReloadEntryCommand;
+use Wallabag\CoreBundle\Entity\Entry;
+
+class ReloadEntryCommandTest extends WallabagCoreTestCase
+{
+    public $url = 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html';
+
+    /**
+     * @var entry
+     */
+    public $adminEntry;
+
+    /**
+     * @var Entry
+     */
+    public $bobEntry;
+
+    public function setUp()
+    {
+        parent::setUp();
+
+        $userRepository = $this->getClient()->getContainer()->get('wallabag_user.user_repository');
+
+        $user = $userRepository->findOneByUserName('admin');
+        $this->adminEntry = new Entry($user);
+        $this->adminEntry->setUrl($this->url);
+        $this->adminEntry->setTitle('title foo');
+        $this->adminEntry->setContent('');
+        $this->getEntityManager()->persist($this->adminEntry);
+
+        $user = $userRepository->findOneByUserName('bob');
+        $this->bobEntry = new Entry($user);
+        $this->bobEntry->setUrl($this->url);
+        $this->bobEntry->setTitle('title foo');
+        $this->bobEntry->setContent('');
+        $this->getEntityManager()->persist($this->bobEntry);
+
+        $this->getEntityManager()->flush();
+    }
+
+    public function testRunReloadEntryCommand()
+    {
+        $application = new Application($this->getClient()->getKernel());
+        $application->add(new ReloadEntryCommand());
+
+        $command = $application->find('wallabag:entry:reload');
+        $tester = new CommandTester($command);
+        $tester->execute([
+            'command' => $command->getName(),
+        ], [
+            'interactive' => false,
+        ]);
+
+        $reloadedEntries = $this->getClient()
+            ->getContainer()
+            ->get('wallabag_core.entry_repository')
+            ->findById([$this->adminEntry->getId(), $this->bobEntry->getId()]);
+
+        foreach ($reloadedEntries as $reloadedEntry) {
+            $this->assertNotEmpty($reloadedEntry->getContent());
+        }
+
+        $this->assertContains('Done', $tester->getDisplay());
+    }
+
+    public function testRunReloadEntryWithUsernameCommand()
+    {
+        $application = new Application($this->getClient()->getKernel());
+        $application->add(new ReloadEntryCommand());
+
+        $command = $application->find('wallabag:entry:reload');
+        $tester = new CommandTester($command);
+        $tester->execute([
+            'command' => $command->getName(),
+            'username' => 'admin',
+        ], [
+            'interactive' => false,
+        ]);
+
+        $entryRepository = $this->getClient()->getContainer()->get('wallabag_core.entry_repository');
+
+        $reloadedAdminEntry = $entryRepository->find($this->adminEntry->getId());
+        $this->assertNotEmpty($reloadedAdminEntry->getContent());
+
+        $reloadedBobEntry = $entryRepository->find($this->bobEntry->getId());
+        $this->assertEmpty($reloadedBobEntry->getContent());
+
+        $this->assertContains('Done', $tester->getDisplay());
+    }
+
+    public function testRunReloadEntryWithoutEntryCommand()
+    {
+        $application = new Application($this->getClient()->getKernel());
+        $application->add(new ReloadEntryCommand());
+
+        $command = $application->find('wallabag:entry:reload');
+        $tester = new CommandTester($command);
+        $tester->execute([
+            'command' => $command->getName(),
+            'username' => 'empty',
+        ], [
+            'interactive' => false,
+        ]);
+
+        $this->assertContains('No entry to reload', $tester->getDisplay());
+        $this->assertNotContains('Done', $tester->getDisplay());
+    }
+}
index c0a4acfaa62b994ca2eafe96cfac4ae73cecc1ce..9b34f2a087c421ba5b631d203d0221b24fcdd44e 100644 (file)
@@ -56,9 +56,9 @@ class ShowUserCommandTest extends WallabagCoreTestCase
             'username' => 'admin',
         ]);
 
-        $this->assertContains('Username : admin', $tester->getDisplay());
-        $this->assertContains('Email : bigboss@wallabag.org', $tester->getDisplay());
-        $this->assertContains('Display name : Big boss', $tester->getDisplay());
+        $this->assertContains('Username: admin', $tester->getDisplay());
+        $this->assertContains('Email: bigboss@wallabag.org', $tester->getDisplay());
+        $this->assertContains('Display name: Big boss', $tester->getDisplay());
         $this->assertContains('2FA activated: no', $tester->getDisplay());
     }
 
@@ -88,6 +88,6 @@ class ShowUserCommandTest extends WallabagCoreTestCase
             'username' => 'admin',
         ]);
 
-        $this->assertContains('Display name : Bug boss', $tester->getDisplay());
+        $this->assertContains('Display name: Bug boss', $tester->getDisplay());
     }
 }
index 96d0e91fc2865bd1cd7751515682d7f1052a6c0a..b1e56a10e0073348ca60d2a18b04b6ba84fa5e31 100644 (file)
@@ -55,6 +55,7 @@ class TagAllCommandTest extends WallabagCoreTestCase
             'username' => 'admin',
         ]);
 
-        $this->assertContains('Tagging entries for user « admin »... Done', $tester->getDisplay());
+        $this->assertContains('Tagging entries for user admin...', $tester->getDisplay());
+        $this->assertContains('Done', $tester->getDisplay());
     }
 }