diff options
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/WallabagV1Import.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Import/WallabagV1Import.php | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php index 173a587f..82160bae 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php | |||
@@ -7,7 +7,6 @@ use Psr\Log\NullLogger; | |||
7 | use Doctrine\ORM\EntityManager; | 7 | use Doctrine\ORM\EntityManager; |
8 | use Wallabag\CoreBundle\Entity\Entry; | 8 | use Wallabag\CoreBundle\Entity\Entry; |
9 | use Wallabag\UserBundle\Entity\User; | 9 | use Wallabag\UserBundle\Entity\User; |
10 | use Wallabag\CoreBundle\Tools\Utils; | ||
11 | use Wallabag\CoreBundle\Helper\ContentProxy; | 10 | use Wallabag\CoreBundle\Helper\ContentProxy; |
12 | 11 | ||
13 | class WallabagV1Import implements ImportInterface | 12 | class WallabagV1Import implements ImportInterface |
@@ -153,19 +152,25 @@ class WallabagV1Import implements ImportInterface | |||
153 | continue; | 152 | continue; |
154 | } | 153 | } |
155 | 154 | ||
156 | // @see ContentProxy->updateEntry | 155 | $data = [ |
157 | $entry = new Entry($this->user); | 156 | 'title' => $importedEntry['title'], |
158 | $entry->setUrl($importedEntry['url']); | 157 | 'html' => $importedEntry['content'], |
158 | 'url' => $importedEntry['url'], | ||
159 | 'content_type' => '', | ||
160 | 'language' => '', | ||
161 | ]; | ||
159 | 162 | ||
163 | // force content to be refreshed in case on bad fetch in the v1 installation | ||
160 | if (in_array($importedEntry['title'], $untitled)) { | 164 | if (in_array($importedEntry['title'], $untitled)) { |
161 | $entry = $this->contentProxy->updateEntry($entry, $importedEntry['url']); | 165 | $data = []; |
162 | } else { | ||
163 | $entry->setContent($importedEntry['content']); | ||
164 | $entry->setTitle($importedEntry['title']); | ||
165 | $entry->setReadingTime(Utils::getReadingTime($importedEntry['content'])); | ||
166 | $entry->setDomainName(parse_url($importedEntry['url'], PHP_URL_HOST)); | ||
167 | } | 166 | } |
168 | 167 | ||
168 | $entry = $this->contentProxy->updateEntry( | ||
169 | new Entry($this->user), | ||
170 | $importedEntry['url'], | ||
171 | $data | ||
172 | ); | ||
173 | |||
169 | if (array_key_exists('tags', $importedEntry) && $importedEntry['tags'] != '') { | 174 | if (array_key_exists('tags', $importedEntry) && $importedEntry['tags'] != '') { |
170 | $this->contentProxy->assignTagsToEntry( | 175 | $this->contentProxy->assignTagsToEntry( |
171 | $entry, | 176 | $entry, |