diff options
-rw-r--r-- | composer.lock | 71 | ||||
-rw-r--r-- | src/Wallabag/ImportBundle/Command/ImportCommand.php | 17 |
2 files changed, 51 insertions, 37 deletions
diff --git a/composer.lock b/composer.lock index ac56e474..5d853f44 100644 --- a/composer.lock +++ b/composer.lock | |||
@@ -350,20 +350,21 @@ | |||
350 | }, | 350 | }, |
351 | { | 351 | { |
352 | "name": "doctrine/annotations", | 352 | "name": "doctrine/annotations", |
353 | "version": "v1.8.0", | 353 | "version": "1.10.1", |
354 | "source": { | 354 | "source": { |
355 | "type": "git", | 355 | "type": "git", |
356 | "url": "https://github.com/doctrine/annotations.git", | 356 | "url": "https://github.com/doctrine/annotations.git", |
357 | "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc" | 357 | "reference": "5eb79f3dbdffed6544e1fc287572c0f462bd29bb" |
358 | }, | 358 | }, |
359 | "dist": { | 359 | "dist": { |
360 | "type": "zip", | 360 | "type": "zip", |
361 | "url": "https://api.github.com/repos/doctrine/annotations/zipball/904dca4eb10715b92569fbcd79e201d5c349b6bc", | 361 | "url": "https://api.github.com/repos/doctrine/annotations/zipball/5eb79f3dbdffed6544e1fc287572c0f462bd29bb", |
362 | "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc", | 362 | "reference": "5eb79f3dbdffed6544e1fc287572c0f462bd29bb", |
363 | "shasum": "" | 363 | "shasum": "" |
364 | }, | 364 | }, |
365 | "require": { | 365 | "require": { |
366 | "doctrine/lexer": "1.*", | 366 | "doctrine/lexer": "1.*", |
367 | "ext-tokenizer": "*", | ||
367 | "php": "^7.1" | 368 | "php": "^7.1" |
368 | }, | 369 | }, |
369 | "require-dev": { | 370 | "require-dev": { |
@@ -373,7 +374,7 @@ | |||
373 | "type": "library", | 374 | "type": "library", |
374 | "extra": { | 375 | "extra": { |
375 | "branch-alias": { | 376 | "branch-alias": { |
376 | "dev-master": "1.7.x-dev" | 377 | "dev-master": "1.9.x-dev" |
377 | } | 378 | } |
378 | }, | 379 | }, |
379 | "autoload": { | 380 | "autoload": { |
@@ -414,7 +415,7 @@ | |||
414 | "docblock", | 415 | "docblock", |
415 | "parser" | 416 | "parser" |
416 | ], | 417 | ], |
417 | "time": "2019-10-01T18:55:10+00:00" | 418 | "time": "2020-04-02T12:33:25+00:00" |
418 | }, | 419 | }, |
419 | { | 420 | { |
420 | "name": "doctrine/cache", | 421 | "name": "doctrine/cache", |
@@ -8722,16 +8723,16 @@ | |||
8722 | }, | 8723 | }, |
8723 | { | 8724 | { |
8724 | "name": "symfony/polyfill-php72", | 8725 | "name": "symfony/polyfill-php72", |
8725 | "version": "v1.13.1", | 8726 | "version": "v1.15.0", |
8726 | "source": { | 8727 | "source": { |
8727 | "type": "git", | 8728 | "type": "git", |
8728 | "url": "https://github.com/symfony/polyfill-php72.git", | 8729 | "url": "https://github.com/symfony/polyfill-php72.git", |
8729 | "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" | 8730 | "reference": "37b0976c78b94856543260ce09b460a7bc852747" |
8730 | }, | 8731 | }, |
8731 | "dist": { | 8732 | "dist": { |
8732 | "type": "zip", | 8733 | "type": "zip", |
8733 | "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", | 8734 | "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/37b0976c78b94856543260ce09b460a7bc852747", |
8734 | "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", | 8735 | "reference": "37b0976c78b94856543260ce09b460a7bc852747", |
8735 | "shasum": "" | 8736 | "shasum": "" |
8736 | }, | 8737 | }, |
8737 | "require": { | 8738 | "require": { |
@@ -8740,7 +8741,7 @@ | |||
8740 | "type": "library", | 8741 | "type": "library", |
8741 | "extra": { | 8742 | "extra": { |
8742 | "branch-alias": { | 8743 | "branch-alias": { |
8743 | "dev-master": "1.13-dev" | 8744 | "dev-master": "1.15-dev" |
8744 | } | 8745 | } |
8745 | }, | 8746 | }, |
8746 | "autoload": { | 8747 | "autoload": { |
@@ -8773,7 +8774,7 @@ | |||
8773 | "portable", | 8774 | "portable", |
8774 | "shim" | 8775 | "shim" |
8775 | ], | 8776 | ], |
8776 | "time": "2019-11-27T13:56:44+00:00" | 8777 | "time": "2020-02-27T09:26:54+00:00" |
8777 | }, | 8778 | }, |
8778 | { | 8779 | { |
8779 | "name": "symfony/polyfill-php73", | 8780 | "name": "symfony/polyfill-php73", |
@@ -9968,24 +9969,23 @@ | |||
9968 | "packages-dev": [ | 9969 | "packages-dev": [ |
9969 | { | 9970 | { |
9970 | "name": "composer/semver", | 9971 | "name": "composer/semver", |
9971 | "version": "1.5.0", | 9972 | "version": "1.5.1", |
9972 | "source": { | 9973 | "source": { |
9973 | "type": "git", | 9974 | "type": "git", |
9974 | "url": "https://github.com/composer/semver.git", | 9975 | "url": "https://github.com/composer/semver.git", |
9975 | "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e" | 9976 | "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de" |
9976 | }, | 9977 | }, |
9977 | "dist": { | 9978 | "dist": { |
9978 | "type": "zip", | 9979 | "type": "zip", |
9979 | "url": "https://api.github.com/repos/composer/semver/zipball/46d9139568ccb8d9e7cdd4539cab7347568a5e2e", | 9980 | "url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de", |
9980 | "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e", | 9981 | "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de", |
9981 | "shasum": "" | 9982 | "shasum": "" |
9982 | }, | 9983 | }, |
9983 | "require": { | 9984 | "require": { |
9984 | "php": "^5.3.2 || ^7.0" | 9985 | "php": "^5.3.2 || ^7.0" |
9985 | }, | 9986 | }, |
9986 | "require-dev": { | 9987 | "require-dev": { |
9987 | "phpunit/phpunit": "^4.5 || ^5.0.5", | 9988 | "phpunit/phpunit": "^4.5 || ^5.0.5" |
9988 | "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" | ||
9989 | }, | 9989 | }, |
9990 | "type": "library", | 9990 | "type": "library", |
9991 | "extra": { | 9991 | "extra": { |
@@ -10026,20 +10026,20 @@ | |||
10026 | "validation", | 10026 | "validation", |
10027 | "versioning" | 10027 | "versioning" |
10028 | ], | 10028 | ], |
10029 | "time": "2019-03-19T17:25:45+00:00" | 10029 | "time": "2020-01-13T12:06:48+00:00" |
10030 | }, | 10030 | }, |
10031 | { | 10031 | { |
10032 | "name": "composer/xdebug-handler", | 10032 | "name": "composer/xdebug-handler", |
10033 | "version": "1.4.0", | 10033 | "version": "1.4.1", |
10034 | "source": { | 10034 | "source": { |
10035 | "type": "git", | 10035 | "type": "git", |
10036 | "url": "https://github.com/composer/xdebug-handler.git", | 10036 | "url": "https://github.com/composer/xdebug-handler.git", |
10037 | "reference": "cbe23383749496fe0f373345208b79568e4bc248" | 10037 | "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7" |
10038 | }, | 10038 | }, |
10039 | "dist": { | 10039 | "dist": { |
10040 | "type": "zip", | 10040 | "type": "zip", |
10041 | "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/cbe23383749496fe0f373345208b79568e4bc248", | 10041 | "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/1ab9842d69e64fb3a01be6b656501032d1b78cb7", |
10042 | "reference": "cbe23383749496fe0f373345208b79568e4bc248", | 10042 | "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7", |
10043 | "shasum": "" | 10043 | "shasum": "" |
10044 | }, | 10044 | }, |
10045 | "require": { | 10045 | "require": { |
@@ -10070,7 +10070,7 @@ | |||
10070 | "Xdebug", | 10070 | "Xdebug", |
10071 | "performance" | 10071 | "performance" |
10072 | ], | 10072 | ], |
10073 | "time": "2019-11-06T16:40:04+00:00" | 10073 | "time": "2020-03-01T12:26:26+00:00" |
10074 | }, | 10074 | }, |
10075 | { | 10075 | { |
10076 | "name": "dama/doctrine-test-bundle", | 10076 | "name": "dama/doctrine-test-bundle", |
@@ -10195,22 +10195,23 @@ | |||
10195 | }, | 10195 | }, |
10196 | { | 10196 | { |
10197 | "name": "doctrine/doctrine-fixtures-bundle", | 10197 | "name": "doctrine/doctrine-fixtures-bundle", |
10198 | "version": "3.3.0", | 10198 | "version": "3.3.1", |
10199 | "source": { | 10199 | "source": { |
10200 | "type": "git", | 10200 | "type": "git", |
10201 | "url": "https://github.com/doctrine/DoctrineFixturesBundle.git", | 10201 | "url": "https://github.com/doctrine/DoctrineFixturesBundle.git", |
10202 | "reference": "8f07fcfdac7f3591f3c4bf13a50cbae05f65ed70" | 10202 | "reference": "39defca57ee0949e1475c46177b30b6d1b732e8f" |
10203 | }, | 10203 | }, |
10204 | "dist": { | 10204 | "dist": { |
10205 | "type": "zip", | 10205 | "type": "zip", |
10206 | "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/8f07fcfdac7f3591f3c4bf13a50cbae05f65ed70", | 10206 | "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/39defca57ee0949e1475c46177b30b6d1b732e8f", |
10207 | "reference": "8f07fcfdac7f3591f3c4bf13a50cbae05f65ed70", | 10207 | "reference": "39defca57ee0949e1475c46177b30b6d1b732e8f", |
10208 | "shasum": "" | 10208 | "shasum": "" |
10209 | }, | 10209 | }, |
10210 | "require": { | 10210 | "require": { |
10211 | "doctrine/data-fixtures": "^1.3", | 10211 | "doctrine/data-fixtures": "^1.3", |
10212 | "doctrine/doctrine-bundle": "^1.11|^2.0", | 10212 | "doctrine/doctrine-bundle": "^1.11|^2.0", |
10213 | "doctrine/orm": "^2.6.0", | 10213 | "doctrine/orm": "^2.6.0", |
10214 | "doctrine/persistence": "^1.3", | ||
10214 | "php": "^7.1", | 10215 | "php": "^7.1", |
10215 | "symfony/config": "^3.4|^4.3|^5.0", | 10216 | "symfony/config": "^3.4|^4.3|^5.0", |
10216 | "symfony/console": "^3.4|^4.3|^5.0", | 10217 | "symfony/console": "^3.4|^4.3|^5.0", |
@@ -10258,20 +10259,20 @@ | |||
10258 | "Fixture", | 10259 | "Fixture", |
10259 | "persistence" | 10260 | "persistence" |
10260 | ], | 10261 | ], |
10261 | "time": "2019-11-13T15:46:58+00:00" | 10262 | "time": "2020-04-02T16:40:37+00:00" |
10262 | }, | 10263 | }, |
10263 | { | 10264 | { |
10264 | "name": "friendsofphp/php-cs-fixer", | 10265 | "name": "friendsofphp/php-cs-fixer", |
10265 | "version": "v2.16.1", | 10266 | "version": "v2.16.2", |
10266 | "source": { | 10267 | "source": { |
10267 | "type": "git", | 10268 | "type": "git", |
10268 | "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", | 10269 | "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", |
10269 | "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02" | 10270 | "reference": "c460a3cbaa58f983fe026cd52c45950bf61e9239" |
10270 | }, | 10271 | }, |
10271 | "dist": { | 10272 | "dist": { |
10272 | "type": "zip", | 10273 | "type": "zip", |
10273 | "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c8afb599858876e95e8ebfcd97812d383fa23f02", | 10274 | "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c460a3cbaa58f983fe026cd52c45950bf61e9239", |
10274 | "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02", | 10275 | "reference": "c460a3cbaa58f983fe026cd52c45950bf61e9239", |
10275 | "shasum": "" | 10276 | "shasum": "" |
10276 | }, | 10277 | }, |
10277 | "require": { | 10278 | "require": { |
@@ -10307,6 +10308,7 @@ | |||
10307 | "symfony/yaml": "^3.0 || ^4.0 || ^5.0" | 10308 | "symfony/yaml": "^3.0 || ^4.0 || ^5.0" |
10308 | }, | 10309 | }, |
10309 | "suggest": { | 10310 | "suggest": { |
10311 | "ext-dom": "For handling output formats in XML", | ||
10310 | "ext-mbstring": "For handling non-UTF8 characters in cache signature.", | 10312 | "ext-mbstring": "For handling non-UTF8 characters in cache signature.", |
10311 | "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", | 10313 | "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", |
10312 | "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", | 10314 | "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", |
@@ -10329,6 +10331,7 @@ | |||
10329 | "tests/Test/IntegrationCaseFactory.php", | 10331 | "tests/Test/IntegrationCaseFactory.php", |
10330 | "tests/Test/IntegrationCaseFactoryInterface.php", | 10332 | "tests/Test/IntegrationCaseFactoryInterface.php", |
10331 | "tests/Test/InternalIntegrationCaseFactory.php", | 10333 | "tests/Test/InternalIntegrationCaseFactory.php", |
10334 | "tests/Test/IsIdenticalConstraint.php", | ||
10332 | "tests/TestCase.php" | 10335 | "tests/TestCase.php" |
10333 | ] | 10336 | ] |
10334 | }, | 10337 | }, |
@@ -10347,7 +10350,7 @@ | |||
10347 | } | 10350 | } |
10348 | ], | 10351 | ], |
10349 | "description": "A tool to automatically fix PHP code style", | 10352 | "description": "A tool to automatically fix PHP code style", |
10350 | "time": "2019-11-25T22:10:32+00:00" | 10353 | "time": "2020-04-10T21:08:06+00:00" |
10351 | }, | 10354 | }, |
10352 | { | 10355 | { |
10353 | "name": "m6web/redis-mock", | 10356 | "name": "m6web/redis-mock", |
diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php index f9ffe994..26903e9c 100644 --- a/src/Wallabag/ImportBundle/Command/ImportCommand.php +++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php | |||
@@ -8,6 +8,7 @@ use Symfony\Component\Console\Input\InputArgument; | |||
8 | use Symfony\Component\Console\Input\InputInterface; | 8 | use Symfony\Component\Console\Input\InputInterface; |
9 | use Symfony\Component\Console\Input\InputOption; | 9 | use Symfony\Component\Console\Input\InputOption; |
10 | use Symfony\Component\Console\Output\OutputInterface; | 10 | use Symfony\Component\Console\Output\OutputInterface; |
11 | use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; | ||
11 | 12 | ||
12 | class ImportCommand extends ContainerAwareCommand | 13 | class ImportCommand extends ContainerAwareCommand |
13 | { | 14 | { |
@@ -38,15 +39,25 @@ class ImportCommand extends ContainerAwareCommand | |||
38 | $em->getConnection()->getConfiguration()->setSQLLogger(null); | 39 | $em->getConnection()->getConfiguration()->setSQLLogger(null); |
39 | 40 | ||
40 | if ($input->getOption('useUserId')) { | 41 | if ($input->getOption('useUserId')) { |
41 | $user = $em->getRepository('WallabagUserBundle:User')->findOneById($input->getArgument('username')); | 42 | $entityUser = $em->getRepository('WallabagUserBundle:User')->findOneById($input->getArgument('username')); |
42 | } else { | 43 | } else { |
43 | $user = $em->getRepository('WallabagUserBundle:User')->findOneByUsername($input->getArgument('username')); | 44 | $entityUser = $em->getRepository('WallabagUserBundle:User')->findOneByUsername($input->getArgument('username')); |
44 | } | 45 | } |
45 | 46 | ||
46 | if (!\is_object($user)) { | 47 | if (!\is_object($entityUser)) { |
47 | throw new Exception(sprintf('User "%s" not found', $input->getArgument('username'))); | 48 | throw new Exception(sprintf('User "%s" not found', $input->getArgument('username'))); |
48 | } | 49 | } |
49 | 50 | ||
51 | // Authenticate user for paywalled websites | ||
52 | $token = new UsernamePasswordToken( | ||
53 | $entityUser, | ||
54 | null, | ||
55 | 'main', | ||
56 | $entityUser->getRoles()); | ||
57 | |||
58 | $this->getContainer()->get('security.token_storage')->setToken($token); | ||
59 | $user = $this->getContainer()->get('security.token_storage')->getToken()->getUser(); | ||
60 | |||
50 | switch ($input->getOption('importer')) { | 61 | switch ($input->getOption('importer')) { |
51 | case 'v2': | 62 | case 'v2': |
52 | $import = $this->getContainer()->get('wallabag_import.wallabag_v2.import'); | 63 | $import = $this->getContainer()->get('wallabag_import.wallabag_v2.import'); |