3 namespace Wallabag\ImportBundle\Import
;
5 class WallabagV1Import
extends WallabagImport
7 protected $fetchingErrorMessage;
8 protected $fetchingErrorMessageTitle;
10 public function __construct($em, $contentProxy, $tagsAssigner, $eventDispatcher, $fetchingErrorMessageTitle, $fetchingErrorMessage)
12 $this->fetchingErrorMessageTitle
= $fetchingErrorMessageTitle;
13 $this->fetchingErrorMessage
= $fetchingErrorMessage;
15 parent
::__construct($em, $contentProxy, $tagsAssigner, $eventDispatcher);
21 public function getName()
29 public function getUrl()
31 return 'import_wallabag_v1';
37 public function getDescription()
39 return 'import.wallabag_v1.description';
45 protected function prepareEntry($entry = [])
48 'title' => $entry['title'],
49 'html' => $entry['content'],
50 'url' => $entry['url'],
51 'is_archived' => $entry['is_read'] || $this->markAsRead
,
52 'is_starred' => $entry['is_fav'],
57 // In case of a bad fetch in v1, replace title and content with v2 error strings
58 // If fetching fails again, they will get this instead of the v1 strings
59 if (\
in_array($entry['title'], $this->untitled
, true)) {
60 $data['title'] = $this->fetchingErrorMessageTitle
;
61 $data['html'] = $this->fetchingErrorMessage
;
64 if (array_key_exists('tags', $entry) && '' !== $entry['tags']) {
65 $data['tags'] = $entry['tags'];
74 protected function setEntryAsRead(array $importedEntry)
76 $importedEntry['is_read'] = 1;
78 return $importedEntry;