aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php7
-rw-r--r--src/Wallabag/ImportBundle/Command/ImportCommand.php11
2 files changed, 14 insertions, 4 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 33b5e2ad..4eb314f7 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -406,7 +406,7 @@ class EntryController extends Controller
406 $url = $this->generateUrl( 406 $url = $this->generateUrl(
407 'view', 407 'view',
408 ['id' => $entry->getId()], 408 ['id' => $entry->getId()],
409 UrlGeneratorInterface::ABSOLUTE_URL 409 UrlGeneratorInterface::ABSOLUTE_PATH
410 ); 410 );
411 411
412 $em = $this->getDoctrine()->getManager(); 412 $em = $this->getDoctrine()->getManager();
@@ -418,8 +418,9 @@ class EntryController extends Controller
418 'flashes.entry.notice.entry_deleted' 418 'flashes.entry.notice.entry_deleted'
419 ); 419 );
420 420
421 // don't redirect user to the deleted entry 421 // don't redirect user to the deleted entry (check that the referer doesn't end with the same url)
422 $to = ($url !== $request->headers->get('referer') ? $request->headers->get('referer') : null); 422 $referer = $request->headers->get('referer');
423 $to = (1 !== preg_match('#'.$url.'$#i', $referer) ? $referer : null);
423 424
424 $redirectUrl = $this->get('wallabag_core.helper.redirect')->to($to); 425 $redirectUrl = $this->get('wallabag_core.helper.redirect')->to($to);
425 426
diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php
index dfbfc2f7..a4aa8531 100644
--- a/src/Wallabag/ImportBundle/Command/ImportCommand.php
+++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php
@@ -13,10 +13,12 @@ class ImportCommand extends ContainerAwareCommand
13 protected function configure() 13 protected function configure()
14 { 14 {
15 $this 15 $this
16 ->setName('wallabag:import-v1') 16 ->setName('wallabag:import')
17 ->setDescription('Import entries from a JSON export from a wallabag v1 instance') 17 ->setDescription('Import entries from a JSON export from a wallabag v1 instance')
18 ->addArgument('userId', InputArgument::REQUIRED, 'User ID to populate') 18 ->addArgument('userId', InputArgument::REQUIRED, 'User ID to populate')
19 ->addArgument('filepath', InputArgument::REQUIRED, 'Path to the JSON file') 19 ->addArgument('filepath', InputArgument::REQUIRED, 'Path to the JSON file')
20 ->addOption('importer', null, InputArgument::OPTIONAL, 'The importer to use: v1 or v2', 'v1')
21 ->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read', false)
20 ; 22 ;
21 } 23 }
22 24
@@ -35,6 +37,13 @@ class ImportCommand extends ContainerAwareCommand
35 } 37 }
36 38
37 $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); 39 $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v1.import');
40
41 if ('v2' === $input->getOption('importer')) {
42 $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v2.import');
43 }
44
45 $wallabag->setMarkAsRead($input->getOption('markAsRead'));
46
38 $res = $wallabag 47 $res = $wallabag
39 ->setUser($user) 48 ->setUser($user)
40 ->setFilepath($input->getArgument('filepath')) 49 ->setFilepath($input->getArgument('filepath'))