aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2017-05-31 12:32:09 +0200
committerGitHub <noreply@github.com>2017-05-31 12:32:09 +0200
commit4423b88c5b2c2d530b0a83a822f521a61ca4d4b8 (patch)
tree26f8cf2ead0107ac74a7cd9eeb522f222eecbd53 /src/Wallabag
parentd61fd8be4ffdbba8d0fd02468075602a26dfde1a (diff)
parentbad7df8c0048285e7a6bd539e5e501ce6675d663 (diff)
downloadwallabag-4423b88c5b2c2d530b0a83a822f521a61ca4d4b8.tar.gz
wallabag-4423b88c5b2c2d530b0a83a822f521a61ca4d4b8.tar.zst
wallabag-4423b88c5b2c2d530b0a83a822f521a61ca4d4b8.zip
Merge pull request #3168 from wallabag/instapaper-tags-import
Add support for tag in Instapaper import
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/ImportBundle/Import/InstapaperImport.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php
index 70a53f1a..c8e0cd5b 100644
--- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php
+++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php
@@ -68,6 +68,14 @@ class InstapaperImport extends AbstractImport
68 continue; 68 continue;
69 } 69 }
70 70
71 // last element in the csv is the folder where the content belong
72 // BUT it can also be the status (since status = folder in Instapaper)
73 // and we don't want archive, unread & starred to become a tag
74 $tags = null;
75 if (false === in_array($data[3], ['Archive', 'Unread', 'Starred'])) {
76 $tags = [$data[3]];
77 }
78
71 $entries[] = [ 79 $entries[] = [
72 'url' => $data[0], 80 'url' => $data[0],
73 'title' => $data[1], 81 'title' => $data[1],
@@ -75,6 +83,7 @@ class InstapaperImport extends AbstractImport
75 'is_archived' => $data[3] === 'Archive' || $data[3] === 'Starred', 83 'is_archived' => $data[3] === 'Archive' || $data[3] === 'Starred',
76 'is_starred' => $data[3] === 'Starred', 84 'is_starred' => $data[3] === 'Starred',
77 'html' => false, 85 'html' => false,
86 'tags' => $tags,
78 ]; 87 ];
79 } 88 }
80 fclose($handle); 89 fclose($handle);
@@ -118,6 +127,14 @@ class InstapaperImport extends AbstractImport
118 // update entry with content (in case fetching failed, the given entry will be return) 127 // update entry with content (in case fetching failed, the given entry will be return)
119 $entry = $this->fetchContent($entry, $importedEntry['url'], $importedEntry); 128 $entry = $this->fetchContent($entry, $importedEntry['url'], $importedEntry);
120 129
130 if (!empty($importedEntry['tags'])) {
131 $this->tagsAssigner->assignTagsToEntry(
132 $entry,
133 $importedEntry['tags'],
134 $this->em->getUnitOfWork()->getScheduledEntityInsertions()
135 );
136 }
137
121 $entry->setArchived($importedEntry['is_archived']); 138 $entry->setArchived($importedEntry['is_archived']);
122 $entry->setStarred($importedEntry['is_starred']); 139 $entry->setStarred($importedEntry['is_starred']);
123 140