You are here

function prev_next_reindex in Previous/Next API 7.2

Same name and namespace in other branches
  1. 6 prev_next.module \prev_next_reindex()
  2. 7 prev_next.module \prev_next_reindex()

Module function to initiate a reindexing of nodes.

2 calls to prev_next_reindex()
prev_next_admin_submit in ./prev_next.admin.inc
Submit callback.
prev_next_reindex_confirm_submit in ./prev_next.admin.inc
@todo Please document this function.

File

./prev_next.module, line 50
The previous next module indexes the previous and next nodes based upon user-selectable criteria and stores this index in the database for faster retrieval later.

Code

function prev_next_reindex() {

  // Wipe the table clean
  db_query('TRUNCATE {prev_next_node}');

  // Get the highest nid
  $max_nid = db_query('SELECT MAX(nid) FROM {node}')
    ->fetchField();

  // Set the variable to that
  variable_set('prev_next_index_nid', $max_nid);
  if ($max_nid) {
    drupal_set_message(t('Prev/Next will index from node %nid downward.', array(
      '%nid' => $max_nid,
    )));
  }
}