aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2016-09-21 18:00:08 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-25 12:29:19 +0200
commit2c61db30b737685ae9102ec10f2371778fb13f1a (patch)
treeeb5d963e6c0609cf7371ab0d1625e4dd03359f4b /src
parent59201088b4fc13fd361238396f630dabd9bd1990 (diff)
downloadwallabag-2c61db30b737685ae9102ec10f2371778fb13f1a.tar.gz
wallabag-2c61db30b737685ae9102ec10f2371778fb13f1a.tar.zst
wallabag-2c61db30b737685ae9102ec10f2371778fb13f1a.zip
cs & fixes
Diffstat (limited to 'src')
-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
5 files changed, 14 insertions, 33 deletions
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}