aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Import/WallabagV2Import.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-09-04 21:49:21 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-11 21:58:31 +0200
commitc98db1b653b5dc8b701422190b02d9fbf10c4e68 (patch)
tree5f02de371264143a4e81231ad16f605435cb4d22 /src/Wallabag/ImportBundle/Import/WallabagV2Import.php
parentef75e1220ebb76a8df019d946460ad612759f0bb (diff)
downloadwallabag-c98db1b653b5dc8b701422190b02d9fbf10c4e68.tar.gz
wallabag-c98db1b653b5dc8b701422190b02d9fbf10c4e68.tar.zst
wallabag-c98db1b653b5dc8b701422190b02d9fbf10c4e68.zip
Convert other imports to Rabbit
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/WallabagV2Import.php')
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagV2Import.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV2Import.php b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php
index d0035b63..faf4236f 100644
--- a/src/Wallabag/ImportBundle/Import/WallabagV2Import.php
+++ b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php
@@ -31,12 +31,28 @@ class WallabagV2Import extends WallabagImport
31 /** 31 /**
32 * {@inheritdoc} 32 * {@inheritdoc}
33 */ 33 */
34 protected function prepareEntry($entry = [], $markAsRead = false) 34 protected function prepareEntry($entry = [])
35 { 35 {
36 return [ 36 return [
37 'html' => $entry['content'], 37 'html' => $entry['content'],
38 'content_type' => $entry['mimetype'], 38 'content_type' => $entry['mimetype'],
39 'is_archived' => ($entry['is_archived'] || $markAsRead), 39 'is_archived' => ($entry['is_archived'] || $this->markAsRead),
40 ] + $entry; 40 ] + $entry;
41 } 41 }
42
43 protected function parseEntriesForProducer($entries)
44 {
45 foreach ($entries as $importedEntry) {
46 // set userId for the producer (it won't know which user is connected)
47 $importedEntry['userId'] = $this->user->getId();
48
49 if ($this->markAsRead) {
50 $importedEntry['is_archived'] = 1;
51 }
52
53 ++$this->importedEntries;
54
55 $this->producer->publish(json_encode($importedEntry));
56 }
57 }
42} 58}