You are here

function forum_pathauto_bulkupdate in Pathauto 6

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

Generate aliases for all forums and forum containers without aliases.

File

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

Code

function forum_pathauto_bulkupdate() {
  $concat = _pathauto_sql_concat("'forum/'", 'td.tid');
  $forum_vid = variable_get('forum_nav_vocabulary', '');
  $sql = "SELECT td.tid FROM {term_data} td LEFT JOIN {url_alias} ua ON {$concat} = ua.src WHERE ua.src IS NULL AND td.vid = %d";
  $query = db_query_range($sql, $forum_vid, 0, variable_get('pathauto_max_bulk_update', 50));
  $count = 0;
  while ($tid = db_result($query)) {
    $term = taxonomy_get_term($tid);
    $count += _taxonomy_pathauto_alias($term, 'bulkupdate');
  }
  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.'));
}