X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FImportBundle%2FImport%2FReadabilityImport.php;h=c5abf18921f1a40ba8efa68bc48177a362f8c2ab;hb=5419a8368ebb4b4d57f481b842f1fcc576c9149d;hp=fa2b705391707848389189a5810c2937303b5498;hpb=637aa17e6b52dd8021854a809053560a27caca72;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php index fa2b7053..c5abf189 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,11 +110,10 @@ 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 = new Entry($this->user); @@ -108,9 +121,9 @@ class ReadabilityImport extends AbstractImport $entry->setTitle($data['title']); // update entry with content (in case fetching failed, the given entry will be return) - $entry = $this->fetchContent($entry, $data['url'], $data); + $this->fetchContent($entry, $data['url'], $data); - $entry->setArchived($data['is_archived']); + $entry->updateArchived($data['is_archived']); $entry->setStarred($data['is_starred']); $entry->setCreatedAt(new \DateTime($data['created_at']));