You are here

function ip_backlog_comments in IP address manager 7

Same name and namespace in other branches
  1. 8.2 ip.module \ip_backlog_comments()
  2. 6 ip.module \ip_backlog_comments()
  3. 7.2 ip.module \ip_backlog_comments()

Handle backlog of comments.

1 call to ip_backlog_comments()
ip_cron in ./ip.module
Implements hook_cron().

File

./ip.module, line 390
IP address manager module.

Code

function ip_backlog_comments() {
  if (module_exists('comment')) {
    $result = db_query_range("SELECT c.cid AS cid, c.hostname AS hostname" . " FROM {comment} c" . " LEFT JOIN {ip_posts} i" . " ON i.type = 'comment'" . " AND (c.cid = i.id OR i.id IS NULL)" . " WHERE i.id IS NULL" . " ORDER BY c.cid DESC", 0, 50);
    foreach ($result as $row) {
      ip_posts_insert('comment', $row->cid, $row->hostname);
    }
  }
}