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/WallabagImport.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/WallabagImport.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Import/WallabagImport.php | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/Wallabag/ImportBundle/Import/WallabagImport.php b/src/Wallabag/ImportBundle/Import/WallabagImport.php index 969a6a04..043bb0a2 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagImport.php +++ b/src/Wallabag/ImportBundle/Import/WallabagImport.php | |||
@@ -101,18 +101,12 @@ abstract class WallabagImport extends AbstractImport | |||
101 | 101 | ||
102 | $data = $this->prepareEntry($importedEntry); | 102 | $data = $this->prepareEntry($importedEntry); |
103 | 103 | ||
104 | $entry = $this->fetchContent( | 104 | $entry = new Entry($this->user); |
105 | new Entry($this->user), | 105 | $entry->setUrl($data['url']); |
106 | $importedEntry['url'], | 106 | $entry->setTitle($data['title']); |
107 | $data | ||
108 | ); | ||
109 | |||
110 | // jump to next entry in case of problem while getting content | ||
111 | if (false === $entry) { | ||
112 | ++$this->skippedEntries; | ||
113 | 107 | ||
114 | return; | 108 | // update entry with content (in case fetching failed, the given entry will be return) |
115 | } | 109 | $entry = $this->fetchContent($entry, $data['url'], $data); |
116 | 110 | ||
117 | if (array_key_exists('tags', $data)) { | 111 | if (array_key_exists('tags', $data)) { |
118 | $this->contentProxy->assignTagsToEntry( | 112 | $this->contentProxy->assignTagsToEntry( |