You are here

function nodewords_mass_update in Nodewords: D6 Meta Tags 6

Delete the nodes meta tags.

Parameters

$ids: An array of IDs.

$type: The type of the object associated with the IDs (NODEWORDS_TYPE_NODE, NODEWORDS_TYPE_USER, NODEWORDS_TYPE_PAGER, NODEWORDS_TYPE_PAGE, ...).

$operation: The operation to execute (currently implemented: delete).

2 string references to 'nodewords_mass_update'
nodewords_node_operations in ./nodewords.module
Implements hook_node_operations().
nodewords_user_operations in ./nodewords.module
Implements hook_user_operations().

File

./nodewords.module, line 979
Implement an API that other modules can use to implement meta tags.

Code

function nodewords_mass_update($ids, $type, $operation = 'delete') {
  if ($operation == 'delete') {
    if ($count = count($ids)) {
      if ($count <= 10) {
        db_query("DELETE FROM {nodewords} WHERE id IN (" . db_placeholders($ids, 'int') . ") AND type = %d", array_merge($ids, array(
          $type,
        )));
        if ($type == NODEWORDS_TYPE_PAGE) {
          db_query("DELETE FROM {nodewords_custom} WHERE pid IN (" . db_placeholders($ids, 'int') . ")", $ids);
        }
        drupal_set_message(t('The update has been performed.'));
      }
      else {
        $batch = array(
          'operations' => array(
            array(
              '_nodewords_mass_delete_batch_process',
              array(
                $ids,
                $type,
              ),
            ),
          ),
          'finished' => '_nodewords_mass_update_batch_finished',
          'title' => t('Processing'),
          'progress_message' => '',
          'error_message' => t('The update has encountered an error.'),
          'file' => drupal_get_path('module', 'nodewords') . '/nodewords.admin.inc',
        );
        batch_set($batch);
      }
    }
  }
}