diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 69cbb175ec7ddd26c5499d573711b4bd4d6b544a..ae301b983cd38b6338ee5afb1f3a19214e8d3fc3 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ Feeds 6.x 1.0 XXXXXXXXXXXXXXXXXXXX ---------------------------------- +- #759302 rjb, smartinm, et. al: Fix user warning: Duplicate entry. - #819876 alex_b: Fix field 'url' and 'guid' don't have default values. - #623444 mongolito404, pvhee, pdrake, servantleader, alex_b et. al.: Mapper for link module. diff --git a/includes/FeedsImporter.inc b/includes/FeedsImporter.inc index 2e06e40e9c46268994d1e9d30753004ea9665df7..867e57ccb3e962e6607b64e970ed5fca058bfdad 100644 --- a/includes/FeedsImporter.inc +++ b/includes/FeedsImporter.inc @@ -134,10 +134,10 @@ class FeedsImporter extends FeedsConfigurable { $save = new stdClass(); $save->id = $this->id; $save->config = $this->getConfig(); - // Make sure a source record is present at all time, try to update first, - // then insert. - drupal_write_record('feeds_importer', $save, 'id'); - if (!db_affected_rows()) { + if (db_result(db_query_range("SELECT 1 FROM {feeds_importer} WHERE id = '%s'", $this->id, 0, 1))) { + drupal_write_record('feeds_importer', $save, 'id'); + } + else { drupal_write_record('feeds_importer', $save); } // Clear menu cache, changes to importer can change menu items. diff --git a/includes/FeedsScheduler.inc b/includes/FeedsScheduler.inc index 310e4030974ee3e97170486aa4262e533df9b6db..701336914c7a6fc7fba8bd1f639e39a7b1566691 100644 --- a/includes/FeedsScheduler.inc +++ b/includes/FeedsScheduler.inc @@ -137,8 +137,10 @@ class FeedsScheduler implements FeedsSchedulerInterface { 'last_executed_time' => 0, 'scheduled' => 0, // Means NOT scheduled at the moment. ); - drupal_write_record('feeds_schedule', $save, array('id', 'callback', 'feed_nid')); - if (!db_affected_rows()) { + if (db_result(db_query_range("SELECT 1 FROM {feeds_schedule} WHERE id = '%s' AND callback = '%s' AND feed_nid = %d", $importer_id, $callback, $feed_nid, 0, 1))) { + drupal_write_record('feeds_schedule', $save, array('id', 'callback', 'feed_nid')); + } + else { drupal_write_record('feeds_schedule', $save); } } diff --git a/includes/FeedsSource.inc b/includes/FeedsSource.inc index a5ee9449863a31423f9dec9aa4606b159c7d2859..8f7b3dec88bc3aea8e7e690b08b5bd09f70950a9 100644 --- a/includes/FeedsSource.inc +++ b/includes/FeedsSource.inc @@ -197,10 +197,10 @@ class FeedsSource extends FeedsConfigurable { 'source' => $source, 'batch' => isset($this->batch) ? $this->batch : FALSE, ); - // Make sure a source record is present at all time, try to update first, - // then insert. - drupal_write_record('feeds_source', $object, array('id', 'feed_nid')); - if (!db_affected_rows()) { + if (db_result(db_query_range("SELECT 1 FROM {feeds_source} WHERE id = '%s' AND feed_nid = %d", $this->id, $this->feed_nid, 0, 1))) { + drupal_write_record('feeds_source', $object, array('id', 'feed_nid')); + } + else { drupal_write_record('feeds_source', $object); } }