aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/config/config.yml26
-rw-r--r--src/Wallabag/ImportBundle/Controller/ChromeController.php4
-rw-r--r--src/Wallabag/ImportBundle/Controller/FirefoxController.php4
-rw-r--r--src/Wallabag/ImportBundle/Import/BrowserImport.php9
-rw-r--r--src/Wallabag/ImportBundle/Import/ChromeImport.php10
-rw-r--r--src/Wallabag/ImportBundle/Import/FirefoxImport.php20
6 files changed, 40 insertions, 33 deletions
diff --git a/app/config/config.yml b/app/config/config.yml
index 7ee0cfb8..a4584a1b 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -246,6 +246,16 @@ old_sound_rabbit_mq:
246 exchange_options: 246 exchange_options:
247 name: 'wallabag.import.wallabag_v2' 247 name: 'wallabag.import.wallabag_v2'
248 type: topic 248 type: topic
249 import_firefox:
250 connection: default
251 exchange_options:
252 name: 'wallabag.import.firefox'
253 type: topic
254 import_chrome:
255 connection: default
256 exchange_options:
257 name: 'wallabag.import.chrome'
258 type: topic
249 consumers: 259 consumers:
250 import_pocket: 260 import_pocket:
251 connection: default 261 connection: default
@@ -279,3 +289,19 @@ old_sound_rabbit_mq:
279 queue_options: 289 queue_options:
280 name: 'wallabag.import.wallabag_v2' 290 name: 'wallabag.import.wallabag_v2'
281 callback: wallabag_import.consumer.amqp.wallabag_v2 291 callback: wallabag_import.consumer.amqp.wallabag_v2
292 import_firefox:
293 connection: default
294 exchange_options:
295 name: 'wallabag.import.firefox'
296 type: topic
297 queue_options:
298 name: 'wallabag.import.firefox'
299 callback: wallabag_import.consumer.amqp.firefox
300 import_chrome:
301 connection: default
302 exchange_options:
303 name: 'wallabag.import.chrome'
304 type: topic
305 queue_options:
306 name: 'wallabag.import.chrome'
307 callback: wallabag_import.consumer.amqp.chrome
diff --git a/src/Wallabag/ImportBundle/Controller/ChromeController.php b/src/Wallabag/ImportBundle/Controller/ChromeController.php
index e4cc322a..454f3347 100644
--- a/src/Wallabag/ImportBundle/Controller/ChromeController.php
+++ b/src/Wallabag/ImportBundle/Controller/ChromeController.php
@@ -15,9 +15,9 @@ class ChromeController extends BrowserController
15 $service = $this->get('wallabag_import.chrome.import'); 15 $service = $this->get('wallabag_import.chrome.import');
16 16
17 if ($this->get('craue_config')->get('import_with_rabbitmq')) { 17 if ($this->get('craue_config')->get('import_with_rabbitmq')) {
18 $service->setProducer($this->get('old_sound_rabbit_mq.import_wallabag_v1_producer')); 18 $service->setProducer($this->get('old_sound_rabbit_mq.import_chrome_producer'));
19 } elseif ($this->get('craue_config')->get('import_with_redis')) { 19 } elseif ($this->get('craue_config')->get('import_with_redis')) {
20 $service->setProducer($this->get('wallabag_import.producer.redis.wallabag_v1')); 20 $service->setProducer($this->get('wallabag_import.producer.redis.chrome'));
21 } 21 }
22 22
23 return $service; 23 return $service;
diff --git a/src/Wallabag/ImportBundle/Controller/FirefoxController.php b/src/Wallabag/ImportBundle/Controller/FirefoxController.php
index e0dd8214..c329b9c4 100644
--- a/src/Wallabag/ImportBundle/Controller/FirefoxController.php
+++ b/src/Wallabag/ImportBundle/Controller/FirefoxController.php
@@ -15,9 +15,9 @@ class FirefoxController extends BrowserController
15 $service = $this->get('wallabag_import.firefox.import'); 15 $service = $this->get('wallabag_import.firefox.import');
16 16
17 if ($this->get('craue_config')->get('import_with_rabbitmq')) { 17 if ($this->get('craue_config')->get('import_with_rabbitmq')) {
18 $service->setProducer($this->get('old_sound_rabbit_mq.import_wallabag_v1_producer')); 18 $service->setProducer($this->get('old_sound_rabbit_mq.import_firefox_producer'));
19 } elseif ($this->get('craue_config')->get('import_with_redis')) { 19 } elseif ($this->get('craue_config')->get('import_with_redis')) {
20 $service->setProducer($this->get('wallabag_import.producer.redis.wallabag_v1')); 20 $service->setProducer($this->get('wallabag_import.producer.redis.firefox'));
21 } 21 }
22 22
23 return $service; 23 return $service;
diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php
index ef7d6d95..3e1cb12b 100644
--- a/src/Wallabag/ImportBundle/Import/BrowserImport.php
+++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php
@@ -2,9 +2,6 @@
2 2
3namespace Wallabag\ImportBundle\Import; 3namespace Wallabag\ImportBundle\Import;
4 4
5use Psr\Log\LoggerInterface;
6use Psr\Log\NullLogger;
7use Doctrine\ORM\EntityManager;
8use Wallabag\CoreBundle\Entity\Entry; 5use Wallabag\CoreBundle\Entity\Entry;
9use Wallabag\UserBundle\Entity\User; 6use Wallabag\UserBundle\Entity\User;
10use Wallabag\CoreBundle\Helper\ContentProxy; 7use Wallabag\CoreBundle\Helper\ContentProxy;
@@ -121,7 +118,6 @@ abstract class BrowserImport extends AbstractImport
121 protected function parseEntriesForProducer(array $entries) 118 protected function parseEntriesForProducer(array $entries)
122 { 119 {
123 foreach ($entries as $importedEntry) { 120 foreach ($entries as $importedEntry) {
124
125 if ((array) $importedEntry !== $importedEntry) { 121 if ((array) $importedEntry !== $importedEntry) {
126 continue; 122 continue;
127 } 123 }
@@ -144,14 +140,15 @@ abstract class BrowserImport extends AbstractImport
144 */ 140 */
145 public function parseEntry(array $importedEntry) 141 public function parseEntry(array $importedEntry)
146 { 142 {
147
148 if ((!key_exists('guid', $importedEntry) || (!key_exists('id', $importedEntry))) && is_array(reset($importedEntry))) { 143 if ((!key_exists('guid', $importedEntry) || (!key_exists('id', $importedEntry))) && is_array(reset($importedEntry))) {
149 $this->parseEntries($importedEntry); 144 $this->parseEntries($importedEntry);
145
150 return; 146 return;
151 } 147 }
152 148
153 if (key_exists('children', $importedEntry)) { 149 if (key_exists('children', $importedEntry)) {
154 $this->parseEntries($importedEntry['children']); 150 $this->parseEntries($importedEntry['children']);
151
155 return; 152 return;
156 } 153 }
157 154
@@ -191,7 +188,7 @@ abstract class BrowserImport extends AbstractImport
191 188
192 if (!empty($data['created_at'])) { 189 if (!empty($data['created_at'])) {
193 $dt = new \DateTime(); 190 $dt = new \DateTime();
194 $entry->setCreatedAt($dt->setTimestamp($data['created_at']/1000)); 191 $entry->setCreatedAt($dt->setTimestamp($data['created_at'] / 1000));
195 } 192 }
196 193
197 $this->em->persist($entry); 194 $this->em->persist($entry);
diff --git a/src/Wallabag/ImportBundle/Import/ChromeImport.php b/src/Wallabag/ImportBundle/Import/ChromeImport.php
index 7936ee2f..941d68d3 100644
--- a/src/Wallabag/ImportBundle/Import/ChromeImport.php
+++ b/src/Wallabag/ImportBundle/Import/ChromeImport.php
@@ -2,13 +2,6 @@
2 2
3namespace Wallabag\ImportBundle\Import; 3namespace Wallabag\ImportBundle\Import;
4 4
5use Psr\Log\LoggerInterface;
6use Psr\Log\NullLogger;
7use Doctrine\ORM\EntityManager;
8use Wallabag\CoreBundle\Entity\Entry;
9use Wallabag\UserBundle\Entity\User;
10use Wallabag\CoreBundle\Helper\ContentProxy;
11
12class ChromeImport extends BrowserImport 5class ChromeImport extends BrowserImport
13{ 6{
14 protected $filepath; 7 protected $filepath;
@@ -37,7 +30,7 @@ class ChromeImport extends BrowserImport
37 return 'import.chrome.description'; 30 return 'import.chrome.description';
38 } 31 }
39 32
40 /** 33 /**
41 * {@inheritdoc} 34 * {@inheritdoc}
42 */ 35 */
43 protected function prepareEntry($entry = []) 36 protected function prepareEntry($entry = [])
@@ -58,7 +51,6 @@ class ChromeImport extends BrowserImport
58 return $data; 51 return $data;
59 } 52 }
60 53
61
62 /** 54 /**
63 * {@inheritdoc} 55 * {@inheritdoc}
64 */ 56 */
diff --git a/src/Wallabag/ImportBundle/Import/FirefoxImport.php b/src/Wallabag/ImportBundle/Import/FirefoxImport.php
index cbf10b87..351cbef1 100644
--- a/src/Wallabag/ImportBundle/Import/FirefoxImport.php
+++ b/src/Wallabag/ImportBundle/Import/FirefoxImport.php
@@ -2,13 +2,6 @@
2 2
3namespace Wallabag\ImportBundle\Import; 3namespace Wallabag\ImportBundle\Import;
4 4
5use Psr\Log\LoggerInterface;
6use Psr\Log\NullLogger;
7use Doctrine\ORM\EntityManager;
8use Wallabag\CoreBundle\Entity\Entry;
9use Wallabag\UserBundle\Entity\User;
10use Wallabag\CoreBundle\Helper\ContentProxy;
11
12class FirefoxImport extends BrowserImport 5class FirefoxImport extends BrowserImport
13{ 6{
14 protected $filepath; 7 protected $filepath;
@@ -42,7 +35,7 @@ class FirefoxImport extends BrowserImport
42 */ 35 */
43 protected function prepareEntry($entry = []) 36 protected function prepareEntry($entry = [])
44 { 37 {
45 $data = [ 38 $data = [
46 'title' => $entry['name'], 39 'title' => $entry['name'],
47 'html' => '', 40 'html' => '',
48 'url' => $entry['url'], 41 'url' => $entry['url'],
@@ -51,13 +44,12 @@ class FirefoxImport extends BrowserImport
51 'created_at' => $entry['date_added'], 44 'created_at' => $entry['date_added'],
52 ]; 45 ];
53 46
54 if (array_key_exists('tags', $entry) && $entry['tags'] != '') { 47 if (array_key_exists('tags', $entry) && $entry['tags'] != '') {
55 $data['tags'] = $entry['tags']; 48 $data['tags'] = $entry['tags'];
56 } 49 }
57
58 return $data;
59 }
60 50
51 return $data;
52 }
61 53
62 /** 54 /**
63 * {@inheritdoc} 55 * {@inheritdoc}