You are here

protected function FeedsFeedNodeProcessor::existingItemId in Feeds 6

Same name and namespace in other branches
  1. 7 plugins/FeedsFeedNodeProcessor.inc \FeedsFeedNodeProcessor::existingItemId()

Get nid of an existing feed item node if available.

Overrides FeedsProcessor::existingItemId

1 call to FeedsFeedNodeProcessor::existingItemId()
FeedsFeedNodeProcessor::process in plugins/FeedsFeedNodeProcessor.inc
Implementation of FeedsProcessor::process().

File

plugins/FeedsFeedNodeProcessor.inc, line 202
Class definition of FeedsFeedNodeProcessor.

Class

FeedsFeedNodeProcessor
Creates *feed* nodes from feed items. The difference to FeedsNodeProcessor is that this plugin only creates nodes that are feed nodes themselves.

Code

protected function existingItemId(FeedsImportBatch $batch, FeedsSource $source) {

  // We only support one unique target: source
  foreach ($this
    ->uniqueTargets($batch) as $target => $value) {
    if ($target == 'source') {
      return db_result(db_query("SELECT fs.feed_nid FROM {node} n JOIN {feeds_source} fs ON n.nid = fs.feed_nid WHERE fs.id = '%s' AND fs.source = '%s'", $this
        ->feedNodeImporter()->id, $value));
    }
  }
  return 0;
}