diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-09-17 07:40:56 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-09-17 07:40:56 +0200 |
commit | 59b97fae996d8307b9d957d210d46200f6d206bf (patch) | |
tree | 9481859d10fafed91067ac7736480e91cd6eb4bb /src/Wallabag/ImportBundle/Import/ReadabilityImport.php | |
parent | fbb319f064e6336a3b44bda12cdc51c93c51f379 (diff) | |
download | wallabag-59b97fae996d8307b9d957d210d46200f6d206bf.tar.gz wallabag-59b97fae996d8307b9d957d210d46200f6d206bf.tar.zst wallabag-59b97fae996d8307b9d957d210d46200f6d206bf.zip |
Avoid losing entry when fetching fail
Instead of just say “Failed to save entry” we’ll save the entry at all cost and try to fetch content. If fetching content failed, the entry will still be saved at least, but without content.
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/ReadabilityImport.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Import/ReadabilityImport.php | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php index b852f8f0..fa2b7053 100644 --- a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php +++ b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php | |||
@@ -103,18 +103,12 @@ class ReadabilityImport extends AbstractImport | |||
103 | 'created_at' => $importedEntry['date_added'], | 103 | 'created_at' => $importedEntry['date_added'], |
104 | ]; | 104 | ]; |
105 | 105 | ||
106 | $entry = $this->fetchContent( | 106 | $entry = new Entry($this->user); |
107 | new Entry($this->user), | 107 | $entry->setUrl($data['url']); |
108 | $data['url'], | 108 | $entry->setTitle($data['title']); |
109 | $data | ||
110 | ); | ||
111 | |||
112 | // jump to next entry in case of problem while getting content | ||
113 | if (false === $entry) { | ||
114 | ++$this->skippedEntries; | ||
115 | 109 | ||
116 | return; | 110 | // update entry with content (in case fetching failed, the given entry will be return) |
117 | } | 111 | $entry = $this->fetchContent($entry, $data['url'], $data); |
118 | 112 | ||
119 | $entry->setArchived($data['is_archived']); | 113 | $entry->setArchived($data['is_archived']); |
120 | $entry->setStarred($data['is_starred']); | 114 | $entry->setStarred($data['is_starred']); |