diff options
Diffstat (limited to 'src/Wallabag/ImportBundle/Command/ImportCommand.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Command/ImportCommand.php | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php index d1325338..13f3dcb9 100644 --- a/src/Wallabag/ImportBundle/Command/ImportCommand.php +++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php | |||
@@ -14,10 +14,10 @@ class ImportCommand extends ContainerAwareCommand | |||
14 | { | 14 | { |
15 | $this | 15 | $this |
16 | ->setName('wallabag:import') | 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') |
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: wallabag v1, v2, firefox or chrome', 'v1') | 20 | ->addOption('importer', null, InputArgument::OPTIONAL, 'The importer to use: v1, v2, instapaper, readability, firefox or chrome', 'v1') |
21 | ->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read', false) | 21 | ->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read', false) |
22 | ; | 22 | ; |
23 | } | 23 | } |
@@ -42,32 +42,38 @@ class ImportCommand extends ContainerAwareCommand | |||
42 | 42 | ||
43 | switch ($input->getOption('importer')) { | 43 | switch ($input->getOption('importer')) { |
44 | case 'v2': | 44 | case 'v2': |
45 | $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v2.import'); | 45 | $import = $this->getContainer()->get('wallabag_import.wallabag_v2.import'); |
46 | break; | 46 | break; |
47 | case 'firefox': | 47 | case 'firefox': |
48 | $wallabag = $this->getContainer()->get('wallabag_import.firefox.import'); | 48 | $import = $this->getContainer()->get('wallabag_import.firefox.import'); |
49 | break; | 49 | break; |
50 | case 'chrome': | 50 | case 'chrome': |
51 | $wallabag = $this->getContainer()->get('wallabag_import.chrome.import'); | 51 | $import = $this->getContainer()->get('wallabag_import.chrome.import'); |
52 | break; | ||
53 | case 'readability': | ||
54 | $import = $this->getContainer()->get('wallabag_import.readability.import'); | ||
55 | break; | ||
56 | case 'instapaper': | ||
57 | $import = $this->getContainer()->get('wallabag_import.instapaper.import'); | ||
52 | break; | 58 | break; |
53 | case 'instapaper': | 59 | case 'instapaper': |
54 | $wallabag = $this->getContainer()->get('wallabag_import.instapaper.import'); | 60 | $wallabag = $this->getContainer()->get('wallabag_import.instapaper.import'); |
55 | break; | 61 | break; |
56 | case 'v1': | 62 | case 'v1': |
57 | default: | 63 | default: |
58 | $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); | 64 | $import = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); |
59 | break; | 65 | break; |
60 | } | 66 | } |
61 | 67 | ||
62 | $wallabag->setMarkAsRead($input->getOption('markAsRead')); | 68 | $import->setMarkAsRead($input->getOption('markAsRead')); |
63 | $wallabag->setUser($user); | 69 | $import->setUser($user); |
64 | 70 | ||
65 | $res = $wallabag | 71 | $res = $import |
66 | ->setFilepath($input->getArgument('filepath')) | 72 | ->setFilepath($input->getArgument('filepath')) |
67 | ->import(); | 73 | ->import(); |
68 | 74 | ||
69 | if (true === $res) { | 75 | if (true === $res) { |
70 | $summary = $wallabag->getSummary(); | 76 | $summary = $import->getSummary(); |
71 | $output->writeln('<info>'.$summary['imported'].' imported</info>'); | 77 | $output->writeln('<info>'.$summary['imported'].' imported</info>'); |
72 | $output->writeln('<comment>'.$summary['skipped'].' already saved</comment>'); | 78 | $output->writeln('<comment>'.$summary['skipped'].' already saved</comment>'); |
73 | } | 79 | } |