diff options
Diffstat (limited to 'src/Wallabag/ImportBundle/Command')
-rw-r--r-- | src/Wallabag/ImportBundle/Command/ImportCommand.php | 30 | ||||
-rw-r--r-- | src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php | 4 |
2 files changed, 19 insertions, 15 deletions
diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php index d1325338..28d01715 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, pinboard, 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,36 @@ 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'); | ||
52 | break; | 55 | break; |
53 | case 'instapaper': | 56 | case 'instapaper': |
54 | $wallabag = $this->getContainer()->get('wallabag_import.instapaper.import'); | 57 | $import = $this->getContainer()->get('wallabag_import.instapaper.import'); |
55 | break; | 58 | break; |
56 | case 'v1': | 59 | case 'pinboard': |
57 | default: | 60 | $import = $this->getContainer()->get('wallabag_import.pinboard.import'); |
58 | $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); | ||
59 | break; | 61 | break; |
62 | default: | ||
63 | $import = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); | ||
60 | } | 64 | } |
61 | 65 | ||
62 | $wallabag->setMarkAsRead($input->getOption('markAsRead')); | 66 | $import->setMarkAsRead($input->getOption('markAsRead')); |
63 | $wallabag->setUser($user); | 67 | $import->setUser($user); |
64 | 68 | ||
65 | $res = $wallabag | 69 | $res = $import |
66 | ->setFilepath($input->getArgument('filepath')) | 70 | ->setFilepath($input->getArgument('filepath')) |
67 | ->import(); | 71 | ->import(); |
68 | 72 | ||
69 | if (true === $res) { | 73 | if (true === $res) { |
70 | $summary = $wallabag->getSummary(); | 74 | $summary = $import->getSummary(); |
71 | $output->writeln('<info>'.$summary['imported'].' imported</info>'); | 75 | $output->writeln('<info>'.$summary['imported'].' imported</info>'); |
72 | $output->writeln('<comment>'.$summary['skipped'].' already saved</comment>'); | 76 | $output->writeln('<comment>'.$summary['skipped'].' already saved</comment>'); |
73 | } | 77 | } |
diff --git a/src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php b/src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php index c2c11f11..2d06af44 100644 --- a/src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php +++ b/src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php | |||
@@ -17,7 +17,7 @@ class RedisWorkerCommand extends ContainerAwareCommand | |||
17 | $this | 17 | $this |
18 | ->setName('wallabag:import:redis-worker') | 18 | ->setName('wallabag:import:redis-worker') |
19 | ->setDescription('Launch Redis worker') | 19 | ->setDescription('Launch Redis worker') |
20 | ->addArgument('serviceName', InputArgument::REQUIRED, 'Service to use: wallabag_v1, wallabag_v2, pocket, readability, firefox, chrome or instapaper') | 20 | ->addArgument('serviceName', InputArgument::REQUIRED, 'Service to use: wallabag_v1, wallabag_v2, pocket, readability, pinboard, firefox, chrome or instapaper') |
21 | ->addOption('maxIterations', '', InputOption::VALUE_OPTIONAL, 'Number of iterations before stoping', false) | 21 | ->addOption('maxIterations', '', InputOption::VALUE_OPTIONAL, 'Number of iterations before stoping', false) |
22 | ; | 22 | ; |
23 | } | 23 | } |
@@ -36,7 +36,7 @@ class RedisWorkerCommand extends ContainerAwareCommand | |||
36 | $worker = new QueueWorker( | 36 | $worker = new QueueWorker( |
37 | $this->getContainer()->get('wallabag_import.queue.redis.'.$serviceName), | 37 | $this->getContainer()->get('wallabag_import.queue.redis.'.$serviceName), |
38 | $this->getContainer()->get('wallabag_import.consumer.redis.'.$serviceName), | 38 | $this->getContainer()->get('wallabag_import.consumer.redis.'.$serviceName), |
39 | $input->getOption('maxIterations') | 39 | (int) $input->getOption('maxIterations') |
40 | ); | 40 | ); |
41 | 41 | ||
42 | $worker->start(); | 42 | $worker->start(); |