You are here

function _nodewords_mass_delete_batch_process in Nodewords: D6 Meta Tags 6

1 string reference to '_nodewords_mass_delete_batch_process'
nodewords_mass_update in ./nodewords.module
Delete the nodes meta tags.

File

./nodewords.admin.inc, line 538
Administration interface for nodewords.module.

Code

function _nodewords_mass_delete_batch_process($ids, $type, &$context) {
  if (!isset($context['sandbox']['progress'])) {
    $context['sandbox']['progress'] = 0;
    $context['sandbox']['max'] = count($ids);
    $context['sandbox']['ids'] = $ids;
  }
  $count = min(5, count($context['sandbox']['ids']));
  if (!isset($context['results']['count'])) {
    $context['results']['count'] = 0;
  }
  for ($i = 1; $i <= $count; $i++) {
    $id = array_shift($context['sandbox']['ids']);
    db_query("DELETE FROM {nodewords} WHERE type = %d AND id = %d", $type, $id);
    if ($type == NODEWORDS_TYPE_PAGE) {
      db_query("DELETE FROM {nodewords_custom} WHERE pid = %d", $type, $id);
    }
    $context['results']['count']++;
    $context['sandbox']['progress']++;
  }
  if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
  }
}