From 28db5dd2858002b376c920ec1d1aaad4ef254d54 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 23 Sep 2017 12:32:35 +0200 Subject: Fix SQL constraint insert into entrytmp table https://github.com/FreshRSS/FreshRSS/issues/1614 --- app/Controllers/importExportController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/Controllers/importExportController.php') diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index a69490e70..a76dd9a2b 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -426,7 +426,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { } // For this feed, check existing GUIDs already in database. $existingHashForGuids = $this->entryDAO->listHashForFeedGuids($feed->id(), $newGuids); - unset($newGuids); + $newGuids = array(); // Then, articles are imported. $this->entryDAO->beginTransaction(); @@ -455,6 +455,11 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $entry->_id(min(time(), $entry->date(true)) . uSecString()); $entry->_tags($tags); + if (isset($newGuids[$entry->guid()])) { + continue; //Skip subsequent articles with same GUID + } + $newGuids[$entry->guid()] = true; + $entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry); if ($entry == null) { // An extension has returned a null value, there is nothing to insert. -- cgit v1.2.3