aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Import
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-03-27 20:35:56 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-03-27 20:54:57 +0200
commit4d0ec0e72108ff47952906e5d968a7c3eb0a76f9 (patch)
treeb8e9cd86010368631296c22a2352f5dbedb429a1 /src/Wallabag/ImportBundle/Import
parent5d6f6f56a2a0f72a67c2d3f96eb61986cf821a1e (diff)
downloadwallabag-4d0ec0e72108ff47952906e5d968a7c3eb0a76f9.tar.gz
wallabag-4d0ec0e72108ff47952906e5d968a7c3eb0a76f9.tar.zst
wallabag-4d0ec0e72108ff47952906e5d968a7c3eb0a76f9.zip
Fix some Scrutinizer issues
Diffstat (limited to 'src/Wallabag/ImportBundle/Import')
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagV1Import.php25
2 files changed, 16 insertions, 11 deletions
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index 4499ce69..f598e611 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -68,7 +68,7 @@ class PocketImport implements ImportInterface
68 * 68 *
69 * @param string $redirectUri Redirect url in case of error 69 * @param string $redirectUri Redirect url in case of error
70 * 70 *
71 * @return string request_token for callback method 71 * @return string|false request_token for callback method
72 */ 72 */
73 public function getRequestToken($redirectUri) 73 public function getRequestToken($redirectUri)
74 { 74 {
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;
7use Doctrine\ORM\EntityManager; 7use Doctrine\ORM\EntityManager;
8use Wallabag\CoreBundle\Entity\Entry; 8use Wallabag\CoreBundle\Entity\Entry;
9use Wallabag\UserBundle\Entity\User; 9use Wallabag\UserBundle\Entity\User;
10use Wallabag\CoreBundle\Tools\Utils;
11use Wallabag\CoreBundle\Helper\ContentProxy; 10use Wallabag\CoreBundle\Helper\ContentProxy;
12 11
13class WallabagV1Import implements ImportInterface 12class 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,