diff options
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/AbstractImport.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Import/AbstractImport.php | 17 |
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) { |