You are here

function _drush_ip_backlog_nodes_process_batch_task in IP address manager 7.2

Batch process task: backlog nodes.

1 call to _drush_ip_backlog_nodes_process_batch_task()
_drush_ip_backlog_nodes_process_batch in ./ip.drush.inc
Batch process: backlog nodes.

File

./ip.drush.inc, line 218

Code

function _drush_ip_backlog_nodes_process_batch_task($item) {
  $success = TRUE;
  $nid = str_replace(array(
    '<a href="' . base_path() . 'node/',
    '">view</a>',
  ), array(
    '',
    '',
  ), $item->link);

  // Check if node still exists.
  $node = db_query('SELECT * FROM {node} WHERE nid = :nid', array(
    ':nid' => $nid,
  ))
    ->fetch();
  if (!empty($node) && !ip_posts_load('node', $nid)) {
    try {
      ip_posts_insert('node', $nid, $item->hostname);
    } catch (PDOException $e) {
      $success = FALSE;
    }
  }
  return $success;
}