You are here

protected function FeedsCommentProcessor::existingItemId in Feeds Comment Processor 6

Get cid of an existing feed item comment if available.

Overrides FeedsProcessor::existingItemId

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

File

./FeedsCommentProcessor.inc, line 309
Class definition of FeedsCommentProcessor.

Class

FeedsCommentProcessor
Creates comments from feed items.

Code

protected function existingItemId($source_item, FeedsSource $source) {

  // Iterate through all unique targets and test whether they do already
  // exist in the database.
  foreach ($this
    ->uniqueTargets($source_item) as $target => $value) {
    switch ($target) {
      case 'guid':
        $cid = db_result(db_query("SELECT cid FROM {feeds_comment_item} WHERE feed_nid = %d AND id = '%s' AND guid = '%s'", $source->feed_nid, $source->id, $value));
        break;
    }
    if ($cid) {

      // Return with the first nid found.
      return $cid;
    }
  }
  return 0;
}