diff options
| author | 2017-09-24 13:02:15 +0200 | |
|---|---|---|
| committer | 2017-09-24 13:02:15 +0200 | |
| commit | a38bd3da8a25dc250793fdb3938ab89c366a0d07 (patch) | |
| tree | 4cd58ec38337cdb014538a2ec1c84b6b340308be /app/Controllers | |
| parent | 0578abf310314c81c97c98b647c186459486801f (diff) | |
| parent | 8cbb052758b02f266f42b6ba953c32419c0bcd4d (diff) | |
Merge pull request #1638 from Alkarex/tmp_unique_guids
Fix SQL constraint insert into entrytmp table
Diffstat (limited to 'app/Controllers')
| -rwxr-xr-x | app/Controllers/feedController.php | 7 | ||||
| -rw-r--r-- | app/Controllers/importExportController.php | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 66b1167a8..45cba9e98 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -320,11 +320,16 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } // For this feed, check existing GUIDs already in database. $existingHashForGuids = $entryDAO->listHashForFeedGuids($feed->id(), $newGuids); - unset($newGuids); + $newGuids = array(); $oldGuids = array(); // Add entries in database if possible. foreach ($entries as $entry) { + if (isset($newGuids[$entry->guid()])) { + continue; //Skip subsequent articles with same GUID + } + $newGuids[$entry->guid()] = true; + $entry_date = $entry->date(true); if (isset($existingHashForGuids[$entry->guid()])) { $existingHash = $existingHashForGuids[$entry->guid()]; 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. |
