aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Import/AbstractImport.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2019-01-15 09:41:18 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-01-15 09:41:18 +0100
commit5419a8368ebb4b4d57f481b842f1fcc576c9149d (patch)
treecd970bb8f3ec5e6487fc1e3bd2de1f89455d3d90 /src/Wallabag/ImportBundle/Import/AbstractImport.php
parent5c331bf0f9ef679aaf91ef29b13120272fcccbf5 (diff)
parentf6b9e883c01196d5aec249f6e8e02e07d0da4089 (diff)
downloadwallabag-5419a8368ebb4b4d57f481b842f1fcc576c9149d.tar.gz
wallabag-5419a8368ebb4b4d57f481b842f1fcc576c9149d.tar.zst
wallabag-5419a8368ebb4b4d57f481b842f1fcc576c9149d.zip
Merge remote-tracking branch 'origin/master' into 2.4
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/AbstractImport.php')
-rw-r--r--src/Wallabag/ImportBundle/Import/AbstractImport.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php
index 58a234f4..d39d71b6 100644
--- a/src/Wallabag/ImportBundle/Import/AbstractImport.php
+++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php
@@ -119,6 +119,15 @@ abstract class AbstractImport implements ImportInterface
119 abstract public function parseEntry(array $importedEntry); 119 abstract public function parseEntry(array $importedEntry);
120 120
121 /** 121 /**
122 * Validate that an entry is valid (like has some required keys, etc.).
123 *
124 * @param array $importedEntry
125 *
126 * @return bool
127 */
128 abstract public function validateEntry(array $importedEntry);
129
130 /**
122 * Fetch content from the ContentProxy (using graby). 131 * Fetch content from the ContentProxy (using graby).
123 * If it fails return the given entry to be saved in all case (to avoid user to loose the content). 132 * If it fails return the given entry to be saved in all case (to avoid user to loose the content).
124 * 133 *
@@ -141,9 +150,9 @@ abstract class AbstractImport implements ImportInterface
141 /** 150 /**
142 * Parse and insert all given entries. 151 * Parse and insert all given entries.
143 * 152 *
144 * @param $entries 153 * @param array $entries
145 */ 154 */
146 protected function parseEntries($entries) 155 protected function parseEntries(array $entries)
147 { 156 {
148 $i = 1; 157 $i = 1;
149 $entryToBeFlushed = []; 158 $entryToBeFlushed = [];
@@ -153,6 +162,10 @@ abstract class AbstractImport implements ImportInterface
153 $importedEntry = $this->setEntryAsRead($importedEntry); 162 $importedEntry = $this->setEntryAsRead($importedEntry);
154 } 163 }
155 164
165 if (false === $this->validateEntry($importedEntry)) {
166 continue;
167 }
168
156 $entry = $this->parseEntry($importedEntry); 169 $entry = $this->parseEntry($importedEntry);
157 170
158 if (null === $entry) { 171 if (null === $entry) {