You are here

function forum_pathauto_bulkupdate in Pathauto 5.2

Same name and namespace in other branches
  1. 5 pathauto_taxonomy.inc \forum_pathauto_bulkupdate()
  2. 6 pathauto_taxonomy.inc \forum_pathauto_bulkupdate()

Generate aliases for all forums and forum containers without aliases.

File

./pathauto_taxonomy.inc, line 156
Hook implementations for taxonomy module integration.

Code

function forum_pathauto_bulkupdate() {
  $forum_vid = variable_get('forum_nav_vocabulary', '');
  $query = "SELECT tid, vid, name, src, dst FROM {term_data} LEFT JOIN {url_alias} ON CONCAT('forum/', CAST(tid AS CHAR)) = src WHERE vid = %d AND src IS NULL";
  $result = db_query_range($query, $forum_vid, 0, variable_get('pathauto_max_bulk_update', 50));
  $count = 0;
  $placeholders = array();
  while ($category = db_fetch_object($result)) {
    $count = _taxonomy_pathauto_alias($category, 'bulkupdate') + $count;
  }
  drupal_set_message(format_plural($count, 'Bulk update of forums and forum containers completed, one alias generated.', 'Bulk update of forums and forum containers completed, @count aliases generated.'));
}