X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FImportBundle%2FImport%2FReadabilityImport.php;h=a5f3798e0277f05b4167c6318be47a9cb5d603b7;hb=9f8f188d928b47503d39348c5990379a572b570a;hp=b852f8f01c4066a20a849f89da9acbe1fee3b19c;hpb=c80cc01afa315dcfa38b2a01c5b05d4516659c24;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php index b852f8f0..a5f3798e 100644 --- a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php +++ b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php @@ -64,6 +64,8 @@ class ReadabilityImport extends AbstractImport $data = json_decode(file_get_contents($this->filepath), true); if (empty($data) || empty($data['bookmarks'])) { + $this->logger->error('ReadabilityImport: no entries in imported file'); + return false; } @@ -78,6 +80,18 @@ class ReadabilityImport extends AbstractImport return true; } + /** + * {@inheritdoc} + */ + public function validateEntry(array $importedEntry) + { + if (empty($importedEntry['article__url'])) { + return false; + } + + return true; + } + /** * {@inheritdoc} */ @@ -96,25 +110,18 @@ class ReadabilityImport extends AbstractImport $data = [ 'title' => $importedEntry['article__title'], 'url' => $importedEntry['article__url'], - 'content_type' => '', - 'language' => '', 'is_archived' => $importedEntry['archive'] || $this->markAsRead, 'is_starred' => $importedEntry['favorite'], 'created_at' => $importedEntry['date_added'], + 'html' => false, ]; - $entry = $this->fetchContent( - new Entry($this->user), - $data['url'], - $data - ); + $entry = new Entry($this->user); + $entry->setUrl($data['url']); + $entry->setTitle($data['title']); - // jump to next entry in case of problem while getting content - if (false === $entry) { - ++$this->skippedEntries; - - return; - } + // update entry with content (in case fetching failed, the given entry will be return) + $this->fetchContent($entry, $data['url'], $data); $entry->setArchived($data['is_archived']); $entry->setStarred($data['is_starred']);