diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-09-04 21:49:21 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-09-11 21:58:31 +0200 |
commit | c98db1b653b5dc8b701422190b02d9fbf10c4e68 (patch) | |
tree | 5f02de371264143a4e81231ad16f605435cb4d22 /src/Wallabag/ImportBundle/Import/WallabagV1Import.php | |
parent | ef75e1220ebb76a8df019d946460ad612759f0bb (diff) | |
download | wallabag-c98db1b653b5dc8b701422190b02d9fbf10c4e68.tar.gz wallabag-c98db1b653b5dc8b701422190b02d9fbf10c4e68.tar.zst wallabag-c98db1b653b5dc8b701422190b02d9fbf10c4e68.zip |
Convert other imports to Rabbit
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/WallabagV1Import.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Import/WallabagV1Import.php | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php index 6cf3467a..86734652 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php | |||
@@ -31,7 +31,7 @@ class WallabagV1Import 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 | $data = [ | 36 | $data = [ |
37 | 'title' => $entry['title'], | 37 | 'title' => $entry['title'], |
@@ -39,7 +39,7 @@ class WallabagV1Import extends WallabagImport | |||
39 | 'url' => $entry['url'], | 39 | 'url' => $entry['url'], |
40 | 'content_type' => '', | 40 | 'content_type' => '', |
41 | 'language' => '', | 41 | 'language' => '', |
42 | 'is_archived' => $entry['is_read'] || $markAsRead, | 42 | 'is_archived' => $entry['is_read'] || $this->markAsRead, |
43 | 'is_starred' => $entry['is_fav'], | 43 | 'is_starred' => $entry['is_fav'], |
44 | 'tags' => '', | 44 | 'tags' => '', |
45 | ]; | 45 | ]; |
@@ -56,4 +56,20 @@ class WallabagV1Import extends WallabagImport | |||
56 | 56 | ||
57 | return $data; | 57 | return $data; |
58 | } | 58 | } |
59 | |||
60 | protected function parseEntriesForProducer($entries) | ||
61 | { | ||
62 | foreach ($entries as $importedEntry) { | ||
63 | // set userId for the producer (it won't know which user is connected) | ||
64 | $importedEntry['userId'] = $this->user->getId(); | ||
65 | |||
66 | if ($this->markAsRead) { | ||
67 | $importedEntry['is_read'] = 1; | ||
68 | } | ||
69 | |||
70 | ++$this->importedEntries; | ||
71 | |||
72 | $this->producer->publish(json_encode($importedEntry)); | ||
73 | } | ||
74 | } | ||
59 | } | 75 | } |