3 namespace Wallabag\ImportBundle\Import
;
5 class WallabagV1Import
extends WallabagImport
10 public function getName()
18 public function getUrl()
20 return 'import_wallabag_v1';
26 public function getDescription()
28 return 'import.wallabag_v1.description';
34 protected function prepareEntry($entry = [])
37 'title' => $entry['title'],
38 'html' => $entry['content'],
39 'url' => $entry['url'],
42 'is_archived' => $entry['is_read'] || $this->markAsRead
,
43 'is_starred' => $entry['is_fav'],
47 // force content to be refreshed in case on bad fetch in the v1 installation
48 if (in_array($entry['title'], $this->untitled
)) {
53 if (array_key_exists('tags', $entry) && $entry['tags'] != '') {
54 $data['tags'] = $entry['tags'];
60 protected function parseEntriesForProducer($entries)
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();
66 if ($this->markAsRead
) {
67 $importedEntry['is_read'] = 1;
70 ++
$this->importedEntries
;
72 $this->producer
->publish(json_encode($importedEntry));