? patches
? pathauto.temp.inc
Index: pathauto.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.admin.inc,v
retrieving revision 1.38
diff -u -p -r1.38 pathauto.admin.inc
--- pathauto.admin.inc	9 Jul 2010 17:41:56 -0000	1.38
+++ pathauto.admin.inc	28 Jul 2010 19:11:22 -0000
@@ -15,15 +15,10 @@
  * @see system_settings_form()
  */
 function pathauto_patterns_form($form, $form_state) {
-  _pathauto_include();
-
   // Call the hook on all modules - an array of 'settings' objects is returned
   $all_settings = module_invoke_all('pathauto', 'settings');
-  $modulelist = array();
-  $indexcount = 0;
   foreach ($all_settings as $settings) {
     $module = $settings->module;
-    $modulelist[] = $module;
     $patterndescr = $settings->patterndescr;
     $patterndefault = $settings->patterndefault;
     $groupheader = $settings->groupheader;
@@ -84,22 +79,6 @@ function pathauto_patterns_form($form, $
       '#global_types' => FALSE,
     );
 
-    // If the module supports bulk updates, offer the update action here
-    if ($settings->bulkname) {
-      $variable = 'pathauto_' . $module . '_bulkupdate';
-      if (variable_get($variable, FALSE)) {
-        variable_set($variable, FALSE);
-        $function = $module . '_pathauto_bulkupdate';
-        call_user_func($function);
-      }
-      $form[$module][$variable] = array(
-        '#type' => 'checkbox',
-        '#title' => $settings->bulkname,
-        '#default_value' => variable_get($variable, FALSE),
-        '#description' => $settings->bulkdescr,
-      );
-    }
-
     // If the module supports feeds, offer to generate aliases for them
     if ($supportsfeeds) {
       $variable = 'pathauto_' . $module . '_applytofeeds';
@@ -112,18 +91,8 @@ function pathauto_patterns_form($form, $
         '#description' => t('The text to use for aliases for RSS feeds. Examples are "0/feed" (used throughout Drupal core) and "feed" (used by some contributed Drupal modules, like Views).'),
       );
     }
-
-  }
-
-  if (isset($do_index_bulkupdate) && $do_index_bulkupdate) {
-    drupal_set_message(format_plural($indexcount,
-      'Bulk generation of index aliases completed, one alias generated.',
-      'Bulk generation of index aliases completed, @count aliases generated.'));
   }
 
-  // Keep track of which modules currently support pathauto
-  variable_set('pathauto_modulelist', $modulelist);
-
   return system_settings_form($form);
 }
 
@@ -187,17 +156,6 @@ function pathauto_settings_form($form) {
     '#element_validate' => array('_pathauto_validate_numeric_element'),
   );
 
-  $form['pathauto_max_bulk_update'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Maximum number of objects to alias in a bulk update'),
-    '#size' => 4,
-    '#maxlength' => 4,
-    '#default_value' => variable_get('pathauto_max_bulk_update', 50),
-    '#min_value' => 1,
-    '#description' => t('Maximum number of objects of a given type which should be aliased during a bulk update. The default is 50 and the recommended number depends on the speed of your server. If bulk updates "time out" or result in a "white screen" then reduce the number.'),
-    '#element_validate' => array('_pathauto_validate_numeric_element'),
-  );
-
   $form['pathauto_update_action'] = array(
     '#type' => 'radios',
     '#title' => t('Update action'),
@@ -317,6 +275,111 @@ function pathauto_settings_form_validate
 }
 
 /**
+ * Form contructor for path alias bulk update form.
+ *
+ * @see pathauto_bulk_update_form_submit()
+ * @ingroup forms
+ */
+function pathauto_bulk_update_form() {
+  $form['#update_callbacks'] = array();
+
+  $form['update'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Select the types of un-aliased paths for which to generate URL aliases'),
+    '#options' => array(),
+    '#default_value' => array(),
+  );
+
+  $pathauto_settings = module_invoke_all('pathauto', 'settings');
+  foreach ($pathauto_settings as $settings) {
+    if (!empty($settings->batch_update_callback)) {
+      $form['#update_callbacks'][$settings->batch_update_callback] = $settings;
+      $form['update']['#options'][$settings->batch_update_callback] = $settings->groupheader;
+    }
+  }
+
+  $form['actions']['#type'] = 'actions';
+  $form['actions']['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Update'),
+  );
+
+  return $form;
+}
+
+/**
+ * Form submit handler for path alias bulk update form.
+ *
+ * @see pathauto_batch_update_form()
+ * @see pathauto_bulk_update_batch_finished()
+ */
+function pathauto_bulk_update_form_submit($form, &$form_state) {
+  $batch = array(
+    'title' => t('Bulk updating URL aliases'),
+    'operations' => array(
+      array('pathauto_bulk_update_batch_start', array()),
+    ),
+    'finished' => 'pathauto_bulk_update_batch_finished',
+    'file' => drupal_get_path('module', 'pathauto') . '/pathauto.admin.inc',
+  );
+
+  foreach ($form_state['values']['update'] as $callback) {
+    if (!empty($callback)) {
+      $settings = $form['#update_callbacks'][$callback];
+      if (!empty($settings->batch_file)) {
+        $batch['operations'][] = array('pathauto_bulk_update_batch_process', array($callback, $settings));
+      }
+      else {
+        $batch['operations'][] = array($callback, array());
+      }
+    }
+  }
+
+  batch_set($batch);
+}
+
+/**
+ * Batch callback; count the current number of URL aliases for comparison later.
+ */
+function pathauto_bulk_update_batch_start(&$context) {
+  $context['results']['count_before'] = db_select('url_alias')->countQuery()->execute()->fetchField();
+}
+
+/**
+ * Common batch processing callback for all operations.
+ *
+ * Required to load our include the proper batch file.
+ */
+function pathauto_bulk_update_batch_process($callback, $settings, &$context) {
+  if (!empty($settings->batch_file)) {
+    require_once DRUPAL_ROOT . '/' . $settings->batch_file;
+  }
+  return $callback($context);
+}
+
+/**
+ * Batch finished callback.
+ */
+function pathauto_bulk_update_batch_finished($success, $results, $operations) {
+  if ($success) {
+    // Count the current number of URL aliases after the batch is completed
+    // and compare to the count before the batch started.
+    $results['count_after'] = db_select('url_alias')->countQuery()->execute()->fetchField();
+    $results['count_changed'] = max($results['count_after'] - $results['count_before'], 0);
+    if ($results['count_changed']) {
+      drupal_set_message(format_plural($results['count_changed'], 'Generated 1 URL alias.', 'Generated @count URL aliases.'));
+    }
+    else {
+      drupal_set_message('No new URL aliases to generate.');
+    }
+  }
+  else {
+    $error_operation = reset($operations);
+    drupal_set_message(t('An error occurred while processing @operation with arguments : @args', array('@operation' => $error_operation[0], '@args' => print_r($error_operation[0], TRUE))));
+  }
+}
+
+/**
  * Menu callback; select certain alias types to delete.
  */
 function pathauto_admin_delete() {
Index: pathauto.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.info,v
retrieving revision 1.11
diff -u -p -r1.11 pathauto.info
--- pathauto.info	8 Jun 2010 14:10:26 -0000	1.11
+++ pathauto.info	28 Jul 2010 19:11:22 -0000
@@ -7,11 +7,9 @@ core = 7.x
 files[] = pathauto.admin.inc
 files[] = pathauto.inc
 files[] = pathauto.module
-files[] = pathauto_node.inc
-files[] = pathauto_taxonomy.inc
-files[] = pathauto_user.inc
 files[] = pathauto.install
 files[] = pathauto.test
+files[] = pathauto.pathauto.inc
 files[] = pathauto.tokens.inc
 configure = admin/config/search/path/patterns
 recommends[] = path_redirect
Index: pathauto.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.install,v
retrieving revision 1.23
diff -u -p -r1.23 pathauto.install
--- pathauto.install	27 Jul 2010 04:34:21 -0000	1.23
+++ pathauto.install	28 Jul 2010 19:11:22 -0000
@@ -14,24 +14,18 @@
 function pathauto_install() {
   // Check to see if taxonomy module is enabled before we set those variables
   if (module_exists('taxonomy')) {
-    variable_set('pathauto_modulelist', array('node', 'user', 'taxonomy'));
     variable_set('pathauto_taxonomy_supportsfeeds', '0/feed');
-    variable_set('pathauto_taxonomy_pattern', 'category/[term:vocabulary]/[term:path]');
-    variable_set('pathauto_taxonomy_bulkupdate', FALSE);
+    variable_set('pathauto_taxonomy_pattern', '[term:vocabulary]/[term:path]');
     variable_set('pathauto_taxonomy_applytofeeds', FALSE);
     variable_set('pathauto_taxonomy_2_pattern', '');
     variable_set('pathauto_taxonomy_1_pattern', '');
   }
-  else {
-    // Node and user are required so we don't have to check
-    variable_set('pathauto_modulelist', array('node', 'user'));
-  }
+
   // Set the rest of the pathauto default variables
   variable_set('pathauto_indexaliases', FALSE);
   variable_set('pathauto_indexaliases_bulkupdate', FALSE);
   variable_set('pathauto_max_component_length', '100');
   variable_set('pathauto_max_length', '100');
-  variable_set('pathauto_node_bulkupdate', FALSE);
   variable_set('pathauto_node_forum_pattern', '');
   variable_set('pathauto_node_image_pattern', '');
   variable_set('pathauto_node_page_pattern', '');
@@ -40,7 +34,6 @@ function pathauto_install() {
   variable_set('pathauto_punctuation_quotes', 0);
   variable_set('pathauto_separator', '-');
   variable_set('pathauto_update_action', '2');
-  variable_set('pathauto_user_bulkupdate', FALSE);
   variable_set('pathauto_user_pattern', 'users/[user:name]');
   variable_set('pathauto_user_supportsfeeds', NULL);
   variable_set('pathauto_verbose', FALSE);
@@ -125,6 +118,19 @@ function pathauto_update_6200() {
 }
 
 /**
+ * Remove obsolete variable since batch API is now used.
+ */
+function pathauto_update_7000() {
+  variable_del('pathauto_max_bulk_update');
+  variable_del('pathauto_node_bulkupdate');
+  variable_del('pathauto_taxonomy_bulkupdate');
+  variable_del('pathauto_forum_bulkupdate');
+  variable_del('pathauto_user_bulkupdate');
+  variable_del('pathauto_blog_bulkupdate');
+  variable_del('pathauto_modulelist');
+}
+
+/**
  * Build a list of Drupal 6 tokens and their Drupal 7 token names.
  */
 function _pathauto_upgrade_token_list() {
Index: pathauto.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.module,v
retrieving revision 1.157
diff -u -p -r1.157 pathauto.module
--- pathauto.module	25 Jul 2010 03:36:12 -0000	1.157
+++ pathauto.module	28 Jul 2010 19:11:23 -0000
@@ -24,6 +24,36 @@
 define('PATHAUTO_IGNORE_WORDS', 'a, an, as, at, before, but, by, for, from, is, in, into, like, of, off, on, onto, per, since, than, the, this, that, to, up, via, with');
 
 /**
+ * Implements hook_hook_info().
+ */
+function pathauto_hook_info() {
+  $info['pathauto'] = array('group' => 'pathauto');
+  $info['path_alias_types'] = array('group' => 'pathauto');
+  return $info;
+}
+
+/**
+ * Implements hook_module_implements_alter().
+ *
+ * Adds pathauto support for core modules.
+ */
+function pathauto_module_implements_alter(&$implementations, $hook) {
+  $hooks = pathauto_hook_info();
+  if (isset($hooks[$hook])) {
+    $modules = array('node', 'taxonomy', 'user', 'forum', 'blog');
+    foreach ($modules as $module) {
+      if (module_exists($module)) {
+        $implementations[$module] = TRUE;
+      }
+    }
+    // Move pathauto.module to get included first since it is responsible for
+    // other modules.
+    unset($implementations['pathauto']);
+    $implementations = array_merge(array('pathauto' => 'pathauto'), $implementations);
+  }
+}
+
+/**
  * Implements hook_help().
  */
 function pathauto_help($path, $arg) {
@@ -79,13 +109,22 @@ function pathauto_menu() {
     'weight' => 20,
     'file' => 'pathauto.admin.inc',
   );
+  $items['admin/config/search/path/update_bulk'] = array(
+    'title' => 'Bulk update',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('pathauto_bulk_update_form'),
+    'access arguments' => array('administer url aliases'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 30,
+    'file' => 'pathauto.admin.inc',
+  );
   $items['admin/config/search/path/delete_bulk'] = array(
     'title' => 'Delete aliases',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('pathauto_admin_delete'),
     'access arguments' => array('administer url aliases'),
     'type' => MENU_LOCAL_TASK,
-    'weight' => 30,
+    'weight' => 40,
     'file' => 'pathauto.admin.inc',
   );
 
@@ -93,36 +132,6 @@ function pathauto_menu() {
 }
 
 /**
- * Include all Pathauto include files.
- */
-function _pathauto_include() {
-  module_load_include('inc', 'pathauto');
-  module_load_include('inc', 'pathauto', 'pathauto_node');
-  module_load_include('inc', 'pathauto', 'pathauto_taxonomy');
-  module_load_include('inc', 'pathauto', 'pathauto_user');
-}
-
-/**
- * Implements hook_path_alias_types().
- *
- * Used primarily by the bulk delete form.
- */
-function pathauto_path_alias_types() {
-  $objects['user/'] = t('Users');
-  $objects['node/'] = t('Content');
-  if (module_exists('blog')) {
-    $objects['blog/'] = t('User blogs');
-  }
-  if (module_exists('taxonomy')) {
-    $objects['taxonomy/term/'] = t('Taxonomy terms');
-  }
-  if (module_exists('forum')) {
-    $objects['forum/'] = t('Forums');
-  }
-  return $objects;
-}
-
-/**
  * Load an URL alias pattern by entity, bundle, and language.
  *
  * @param $entity
@@ -254,29 +263,17 @@ function pathauto_node_presave($node) {
  * Implements hook_node_insert().
  */
 function pathauto_node_insert($node) {
-  _pathauto_node_insert_update($node, 'insert');
+  if (!isset($node->path['pathauto_perform_alias']) || !empty($node->path['pathauto_perform_alias'])) {
+    pathauto_node_update_alias($node, 'insert');
+  }
 }
 
 /**
  * Implements hook_node_update().
  */
 function pathauto_node_update($node) {
-  _pathauto_node_insert_update($node, 'update');
-}
-
-/**
- * Internal helper for node insert/update duplicate functionality.
- */
-function _pathauto_node_insert_update($node, $op) {
-  // Only do work if there's a pattern.
-  $language = variable_get('language_content_type_' . $node->type, 0) ? $node->language : LANGUAGE_NONE;
-  if ($pattern = pathauto_pattern_load_by_entity('node', $node->type, $language)) {
-    _pathauto_include();
-    // Only create an alias if the checkbox was not provided or if the checkbox was provided and is checked
-    if (!isset($node->path['pathauto_perform_alias']) || $node->path['pathauto_perform_alias']) {
-      $uri = entity_uri('node', $node);
-      $node->path['alias'] = pathauto_create_alias('node', $op, $uri['path'], array('node' => $node), $node->type, $node->language);
-    }
+  if (!isset($node->path['pathauto_perform_alias']) || !empty($node->path['pathauto_perform_alias'])) {
+    pathauto_node_update_alias($node, 'update');
   }
 }
 
@@ -310,7 +307,7 @@ function pathauto_form_alter(&$form, &$f
           // If this is not a new node, compare it's current alias to the
           // alias that would be genereted by pathauto. If they are the same,
           // then keep the automatic alias enabled.
-          _pathauto_include();
+          module_load_include('inc', 'pathauto');
           $uri = entity_uri('node', $node);
           $path = path_load(array('source' => $uri['path']));
           $pathauto_alias = pathauto_create_alias('node', 'return', $uri['path'], array('node' => $node), $node->type, $node->language);
@@ -366,7 +363,7 @@ function pathauto_node_operations() {
   $operations['pathauto_update_alias'] = array(
     'label' => t('Update URL alias'),
     'callback' => 'pathauto_node_update_alias_multiple',
-    'callback arguments' => array('bulkupdate', TRUE),
+    'callback arguments' => array('bulkupdate', array('message' => TRUE)),
   );
   return $operations;
 }
@@ -378,11 +375,19 @@ function pathauto_node_operations() {
  *   A node object.
  * @param $op
  *   Operation being performed on the node ('insert', 'update' or 'bulkupdate').
+ * @param $options
+ *   An optional array of additional options.
  */
-function pathauto_node_update_alias(stdClass $node, $op) {
+function pathauto_node_update_alias(stdClass $node, $op, array $options = array()) {
+  // Skip processing if the term has no pattern.
+  $language = isset($node->language) ? $node->language : LANGUAGE_NONE;
+  if (!pathauto_pattern_load_by_entity('node', $node->type, $language)) {
+    return;
+  }
+
   module_load_include('inc', 'pathauto');
   $uri = entity_uri('node', $node);
-  pathauto_create_alias('node', $op, $uri['path'], array('node' => $node), $node->type, $node->language);
+  pathauto_create_alias('node', $op, $uri['path'], array('node' => $node), $node->type, $language);
 }
 
 /**
@@ -393,16 +398,18 @@ function pathauto_node_update_alias(stdC
  * @param $op
  *   Operation being performed on the nodes ('insert', 'update' or
  *   'bulkupdate').
- * @param $message
- *   A boolean if TRUE will display a message about how many nodes were
- *   updated.
+ * @param $options
+ *   An optional array of additional options.
  */
-function pathauto_node_update_alias_multiple(array $nids, $op, $message = FALSE) {
+function pathauto_node_update_alias_multiple(array $nids, $op, array $options = array()) {
+  $options += array('message' => FALSE);
+
   $nodes = node_load_multiple($nids);
   foreach ($nodes as $node) {
-    pathauto_node_update_alias($node, $op);
+    pathauto_node_update_alias($node, $op, $options);
   }
-  if ($message) {
+
+  if (!empty($options['message'])) {
     drupal_set_message(format_plural(count($nids), 'Updated URL alias for 1 node.', 'Updated URL aliases for @count nodes.'));
   }
 }
@@ -421,40 +428,79 @@ function pathauto_taxonomy_term_insert($
  * Implements hook_taxonomy_term_update().
  */
 function pathauto_taxonomy_term_update($term) {
-  _pathauto_taxonomy_term_insert_update($term, 'update');
+  // Clear the taxonomy static cache.
+  taxonomy_terms_static_reset();
+  // @todo Remove when http://drupal.org/node/826334 is fixed.
+  drupal_static_reset('taxonomy_get_parents_all');
+
+  pathauto_taxonomy_term_update_alias($term, 'update', array('alias children' => TRUE));
+}
+
+/**
+ * Implements hook_taxonomy_term_delete().
+ */
+function pathauto_taxonomy_term_delete($term) {
+  pathauto_entity_path_delete_all('taxonomy_term', $term, "taxonomy/term/{$term->tid}");
 }
 
 /**
- * Internal helper for taxonomy term insert/update duplicate functionality
+ * Update the URL aliases for an individual taxonomy term.
+ *
+ * @param $term
+ *   A taxonomy term object.
+ * @param $op
+ *   Operation being performed on the term ('insert', 'update' or 'bulkupdate').
+ * @param $options
+ *   An optional array of additional options.
  */
-function _pathauto_taxonomy_term_insert_update($term, $op) {
-  // Only do work if there's a pattern.
-  if ($pattern = pathauto_pattern_load_by_entity('taxonomy', $term->vid)) {
-    _pathauto_include();
+function pathauto_taxonomy_term_update_alias(stdClass $term, $op, array $options = array()) {
+  $options += array('alias children' => FALSE);
 
-    // Clear the taxonomy static cache.
-    if ($op == 'update') {
-      taxonomy_terms_static_reset();
-      // @todo Remove when http://drupal.org/node/826334 is fixed.
-      drupal_static_reset('taxonomy_get_parents_all');
-    }
+  $module = 'taxonomy';
+  if (module_exists('forum') && $term->vid == variable_get('forum_nav_vocabulary', '')) {
+    $module = 'forum';
+  }
 
-    if ($term->name) {
-      $count = _taxonomy_pathauto_alias($term, $op);
-    }
+  // Skip processing if the term has no pattern.
+  if (!pathauto_pattern_load_by_entity($module, $term->vid)) {
+    return;
+  }
+
+  module_load_include('inc', 'pathauto');
+  $uri = entity_uri('taxonomy_term', $term);
+  pathauto_create_alias($module, $op, $uri['path'], array('term' => $term), $term->vid);
 
-    // For all children generate new alias (important if [term:path] used)
+  if (!empty($options['alias children'])) {
+    // For all children generate new alias.
+    $options['alias children'] = FALSE;
     foreach (taxonomy_get_tree($term->vid, $term->tid) as $subterm) {
-      $count = _taxonomy_pathauto_alias($subterm, $op);
+      pathauto_taxonomy_term_update_alias($subterm, $op, $options);
     }
   }
 }
 
 /**
- * Implements hook_taxonomy_term_delete().
+ * Update the URL aliases for multiple taxonomy terms.
+ *
+ * @param $tids
+ *   An array of term IDs.
+ * @param $op
+ *   Operation being performed on the nodes ('insert', 'update' or
+ *   'bulkupdate').
+ * @param $options
+ *   An optional array of additional options.
  */
-function pathauto_taxonomy_term_delete($term) {
-  pathauto_entity_path_delete_all('taxonomy_term', $term, "taxonomy/term/{$term->tid}");
+function pathauto_taxonomy_term_update_alias_multiple(array $tids, $op, array $options = array()) {
+  $options += array('message' => FALSE);
+
+  $terms = taxonomy_term_load_multiple($tids);
+  foreach ($terms as $term) {
+    pathauto_taxonomy_term_update_alias($term, $op, $options);
+  }
+
+  if (!empty($options['message'])) {
+    drupal_set_message(format_plural(count($tids), 'Updated URL alias for 1 term.', 'Updated URL aliases for @count terms.'));
+  }
 }
 
 //==============================================================================
@@ -480,10 +526,10 @@ function pathauto_user_update(&$edit, $a
  * @todo Clean or remove this function in favor of pathauto_user_update_alias().
  */
 function _pathauto_user_insert_update(&$edit, $account, $category, $op) {
-  _pathauto_include();
   // Use the username to automatically create an alias
   $pathauto_user = (object) array_merge((array) $account, $edit);
   if ($pathauto_user->name) {
+    module_load_include('inc', 'pathauto');
     $uri = entity_uri('user', $pathauto_user);
     $alias = pathauto_create_alias('user', $op, $uri['path'], array('user' => $pathauto_user));
 
@@ -531,7 +577,7 @@ function pathauto_user_operations() {
   $operations['pathauto_update_alias'] = array(
     'label' => t('Update URL alias'),
     'callback' => 'pathauto_user_update_alias_multiple',
-    'callback arguments' => array('bulkupdate', TRUE),
+    'callback arguments' => array('bulkupdate', array('message' => TRUE)),
   );
   return $operations;
 }
@@ -544,20 +590,24 @@ function pathauto_user_operations() {
  * @param $op
  *   Operation being performed on the account ('insert', 'update' or
  *   'bulkupdate').
- *
- * @todo Remove support for any sub-path aliases.
+ * @param $options
+ *   An optional array of additional options.
  */
-function pathauto_user_update_alias(stdClass $account, $op) {
+function pathauto_user_update_alias(stdClass $account, $op, array $options = array()) {
+  $options += array('alias blog' => module_exists('blog'));
+
+  // Skip processing if the account has no pattern.
+  if (!pathauto_pattern_load_by_entity('user')) {
+    return;
+  }
+
   module_load_include('inc', 'pathauto');
-  pathauto_create_alias('user', $op, "user/{$account->uid}", array('user' => $account));
+  $uri = entity_uri('user', $account);
+  pathauto_create_alias('user', $op, $uri['path'], array('user' => $account));
 
-  if (module_exists('blog')) {
-    if (node_access('create', 'blog', $account)) {
-      pathauto_create_alias('blog', $op, "blog/{$account->uid}", array('user' => $account));
-    }
-    else {
-      pathauto_path_delete_all("blog/{$user->uid}");
-    }
+  // Because blogs are also associated with users, also generate the blog paths.
+  if (!empty($options['alias blog'])) {
+    pathauto_blog_update_alias($account, $op);
   }
 }
 
@@ -569,16 +619,44 @@ function pathauto_user_update_alias(stdC
  * @param $op
  *   Operation being performed on the accounts ('insert', 'update' or
  *   'bulkupdate').
- * @param $message
- *   A boolean if TRUE will display a message about how many accounts were
- *   updated.
+ * @param $options
+ *   An optional array of additional options.
  */
-function pathauto_user_update_alias_multiple(array $uids, $op, $message = FALSE) {
+function pathauto_user_update_alias_multiple(array $uids, $op, array $options = array()) {
+  $options += array('message' => FALSE);
+
   $accounts = user_load_multiple($uids);
   foreach ($accounts as $account) {
-    pathauto_user_update_alias($account, $op);
+    pathauto_user_update_alias($account, $op, $options);
   }
-  if ($message) {
+
+  if (!empty($options['message'])) {
     drupal_set_message(format_plural(count($uids), 'Updated URL alias for 1 user account.', 'Updated URL aliases for @count user accounts.'));
   }
 }
+
+/**
+ * Update the blog URL aliases for an individual user account.
+ *
+ * @param $account
+ *   A user account object.
+ * @param $op
+ *   Operation being performed on the blog ('insert', 'update' or
+ *   'bulkupdate').
+ * @param $options
+ *   An optional array of additional options.
+ */
+function pathauto_blog_update_alias(stdClass $account, $op, array $options = array()) {
+  // Skip processing if the blog has no pattern.
+  if (!pathauto_pattern_load_by_entity('blog')) {
+    return;
+  }
+
+  module_load_include('inc', 'pathauto');
+  if (node_access('create', 'blog', $account)) {
+    pathauto_create_alias('blog', $op, "blog/{$account->uid}", array('user' => $account));
+  }
+  else {
+    pathauto_path_delete_all("blog/{$user->uid}");
+  }
+}
Index: pathauto.pathauto.inc
===================================================================
RCS file: pathauto.pathauto.inc
diff -N pathauto.pathauto.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pathauto.pathauto.inc	28 Jul 2010 19:11:23 -0000
@@ -0,0 +1,401 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Pathauto integration for core modules.
+ *
+ * @ingroup pathauto
+ */
+
+/**
+ * Implements hook_path_alias_types().
+ *
+ * Used primarily by the bulk delete form.
+ */
+function pathauto_path_alias_types() {
+  $objects['user/'] = t('Users');
+  $objects['node/'] = t('Content');
+  if (module_exists('blog')) {
+    $objects['blog/'] = t('User blogs');
+  }
+  if (module_exists('taxonomy')) {
+    $objects['taxonomy/term/'] = t('Taxonomy terms');
+  }
+  if (module_exists('forum')) {
+    $objects['forum/'] = t('Forums');
+  }
+  return $objects;
+}
+
+/**
+ * Implements hook_pathauto().
+ *
+ * This function is empty so that the other core module implementations can be
+ * defined in this file. This is because in pathauto_module_implements_alter()
+ * we add pathauto to be included first. The module system then peforms a
+ * check on any subsequent run if this function still exists. If this does not
+ * exist, than this file will not get included and the core implementations
+ * will never get run.
+ *
+ * @see pathauto_module_implements_alter().
+ */
+function pathauto_pathauto() {
+  // Empty hook; see the above comment.
+}
+
+/**
+ * Implements hook_pathauto().
+ */
+function node_pathauto($op) {
+  switch ($op) {
+    case 'settings':
+      $settings = array();
+      $settings['module'] = 'node';
+      $settings['token_type'] = 'node';
+      $settings['groupheader'] = t('Node paths');
+      $settings['patterndescr'] = t('Default path pattern (applies to all node types with blank patterns below)');
+      $settings['patterndefault'] = t('content/[node:title]');
+      $settings['batch_update_callback'] = 'node_pathauto_bulk_update_batch_process';
+      $settings['batch_file'] = drupal_get_path('module', 'pathauto') . '/pathauto.pathauto.inc';
+      $settings['supportsfeeds'] = 'feed';
+
+      $languages = array();
+      if (module_exists('locale')) {
+        $languages = array(LANGUAGE_NONE => t('language neutral')) + locale_language_list('name');
+      }
+
+      foreach (node_type_get_names() as $node_type => $node_name) {
+        if (count($languages) && variable_get('language_content_type_' . $node_type, 0)) {
+          $settings['patternitems'][$node_type] = t('Default path pattern for @node_type (applies to all @node_type node types with blank patterns below)', array('@node_type' => $node_name));
+          foreach ($languages as $lang_code => $lang_name) {
+            $settings['patternitems'][$node_type . '_' . $lang_code] = t('Pattern for all @language @node_type paths', array('@node_type' => $node_name, '@language' => $lang_name));
+          }
+        }
+        else {
+          $settings['patternitems'][$node_type] = t('Pattern for all @node_type paths', array('@node_type' => $node_name));
+        }
+      }
+      return (object) $settings;
+    default:
+      break;
+  }
+}
+
+/**
+ * Batch processing callback; Generate aliases for nodes.
+ */
+function node_pathauto_bulk_update_batch_process(&$context) {
+  if (!isset($context['sandbox']['current'])) {
+    $context['sandbox']['count'] = 0;
+    $context['sandbox']['current'] = 0;
+  }
+
+  $query = db_select('node', 'n');
+  $concat = _pathauto_sql_concat("'node/'", 'n.nid');
+  $query->leftJoin('url_alias', 'ua', "$concat = ua.source");
+  $query->addField('n', 'nid');
+  $query->isNull('ua.source');
+  $query->condition('n.nid', $context['sandbox']['current'], '>');
+  $query->orderBy('n.nid');
+  $query->addTag('pathauto_bulk_update');
+  $query->addMetaData('entity', 'node');
+
+  // Get the total amount of items to process.
+  if (!isset($context['sandbox']['total'])) {
+    $context['sandbox']['total'] = $query->countQuery()->execute()->fetchField();
+
+    // If there are no nodes to update, the stop immediately.
+    if (!$context['sandbox']['total']) {
+      $context['finished'] = 1;
+      return;
+    }
+  }
+
+  $query->range(0, 25);
+  $nids = $query->execute()->fetchCol();
+
+  pathauto_node_update_alias_multiple($nids, 'bulkupdate');
+  $context['sandbox']['count'] += count($nids);
+  $context['sandbox']['current'] = max($nids);
+  $context['message'] = t('Updated alias for node @nid.', array('@nid' => end($nids)));
+
+  if ($context['sandbox']['count'] != $context['sandbox']['total']) {
+    $context['finished'] = $context['sandbox']['count'] / $context['sandbox']['total'];
+  }
+}
+
+/**
+ * Implements hook_pathauto().
+ */
+function taxonomy_pathauto($op) {
+  switch ($op) {
+    case 'settings':
+      $settings = array();
+      $settings['module'] = 'taxonomy';
+      $settings['token_type'] = 'term';
+      $settings['groupheader'] = t('Taxonomy term paths');
+      $settings['patterndescr'] = t('Default path pattern (applies to all vocabularies with blank patterns below)');
+      $settings['patterndefault'] = t('category/[term:vocabulary]/[term:path]');
+      $settings['supportsfeeds'] = '0/feed';
+      $settings['batch_update_callback'] = 'taxonomy_pathauto_bulk_update_batch_process';
+      $settings['batch_file'] = drupal_get_path('module', 'pathauto') . '/pathauto.pathauto.inc';
+
+      $vocabularies = taxonomy_get_vocabularies();
+      if (sizeof($vocabularies) > 0) {
+        $settings['patternitems'] = array();
+        $forum_vid = variable_get('forum_nav_vocabulary', '');
+        foreach ($vocabularies as $vocab) {
+          if ($vocab->vid != $forum_vid) {
+            $vocabname = $vocab->name;
+            $fieldlabel = t('Pattern for all %vocab-name paths', array('%vocab-name' => $vocabname));
+            $settings['patternitems'][$vocab->vid] = $fieldlabel;
+          }
+        }
+      }
+      return (object) $settings;
+    default:
+      break;
+  }
+}
+
+/**
+ * Batch processing callback; Generate aliases for taxonomy terms.
+ */
+function taxonomy_pathauto_bulk_update_batch_process(&$context) {
+  if (!isset($context['sandbox']['current'])) {
+    $context['sandbox']['count'] = 0;
+    $context['sandbox']['current'] = 0;
+  }
+
+  $query = db_select('taxonomy_term_data', 'td');
+  $concat = _pathauto_sql_concat("'taxonomy/term/'", 'td.tid');
+  $query->leftJoin('url_alias', 'ua', "$concat = ua.source");
+  $query->addField('td', 'tid');
+  $query->isNull('ua.source');
+  // Exclude the forums terms.
+  if ($forum_vid = variable_get('forum_nav_vocabulary', '')) {
+    $query->condition('td.vid', $forum_vid, '<>');
+  }
+  $query->orderBy('td.tid');
+  $query->addTag('pathauto_bulk_update');
+  $query->addMetaData('entity', 'taxonomy_term');
+
+  // Get the total amount of items to process.
+  if (!isset($context['sandbox']['total'])) {
+    $context['sandbox']['total'] = $query->countQuery()->execute()->fetchField();
+
+    // If there are no nodes to update, the stop immediately.
+    if (!$context['sandbox']['total']) {
+      $context['finished'] = 1;
+      return;
+    }
+  }
+
+  $query->range(0, 25);
+  $tids = $query->execute()->fetchCol();
+
+  pathauto_taxonomy_term_update_alias_multiple($tids, 'bulkupdate');
+  $context['sandbox']['count'] += count($tids);
+  $context['sandbox']['current'] = max($tids);
+  $context['message'] = t('Updated alias for term @tid.', array('@tid' => end($tids)));
+
+  if ($context['sandbox']['count'] != $context['sandbox']['total']) {
+    $context['finished'] = $context['sandbox']['count'] / $context['sandbox']['total'];
+  }
+}
+
+/**
+ * Implements hook_pathauto() for forum module.
+ */
+function forum_pathauto($op) {
+  switch ($op) {
+    case 'settings':
+      $settings = array();
+      $settings['module'] = 'forum';
+      $settings['token_type'] = 'term';
+      $settings['groupheader'] = t('Forum paths');
+      $settings['patterndescr'] = t('Pattern for forums and forum containers');
+      $settings['patterndefault'] = t('[term:vocabulary]/[term:path]');
+      $settings['supportsfeeds'] = '0/feed';
+      $settings['batch_update_callback'] = 'forum_pathauto_bulk_update_batch_process';
+      $settings['batch_file'] = drupal_get_path('module', 'pathauto') . '/pathauto.pathauto.inc';
+      return (object) $settings;
+    default:
+      break;
+  }
+}
+
+/**
+ * Batch processing callback; Generate aliases for forums.
+ */
+function forum_pathauto_bulk_update_batch_process(&$context) {
+  if (!isset($context['sandbox']['current'])) {
+    $context['sandbox']['count'] = 0;
+    $context['sandbox']['current'] = 0;
+  }
+
+  $query = db_select('taxonomy_term_data', 'td');
+  $concat = _pathauto_sql_concat("'forum/'", 'td.tid');
+  $query->leftJoin('url_alias', 'ua', "$concat = ua.source");
+  $query->addField('td', 'tid');
+  $query->isNull('ua.source');
+  $query->condition('vid', variable_get('forum_nav_vocabulary', ''));
+  $query->orderBy('td.tid');
+  $query->addTag('pathauto_bulk_update');
+  $query->addMetaData('entity', 'taxonomy_term');
+
+  // Get the total amount of items to process.
+  if (!isset($context['sandbox']['total'])) {
+    $context['sandbox']['total'] = $query->countQuery()->execute()->fetchField();
+
+    // If there are no nodes to update, the stop immediately.
+    if (!$context['sandbox']['total']) {
+      $context['finished'] = 1;
+      return;
+    }
+  }
+
+  $query->range(0, 25);
+  $tids = $query->execute()->fetchCol();
+
+  pathauto_taxonomy_term_update_alias_multiple($tids, 'bulkupdate');
+  $context['sandbox']['count'] += count($tids);
+  $context['sandbox']['current'] = max($tids);
+  $context['message'] = t('Updated alias for fourm @tid.', array('@tid' => end($tids)));
+
+  if ($context['sandbox']['count'] != $context['sandbox']['total']) {
+    $context['finished'] = $context['sandbox']['count'] / $context['sandbox']['total'];
+  }
+}
+
+/**
+ * Implements hook_pathauto().
+ */
+function user_pathauto($op) {
+  switch ($op) {
+    case 'settings':
+      $settings = array();
+      $settings['module'] = 'user';
+      $settings['token_type'] = 'user';
+      $settings['groupheader'] = t('User paths');
+      $settings['patterndescr'] = t('Pattern for user account page paths');
+      $settings['patterndefault'] = t('users/[user:name]');
+      $settings['batch_update_callback'] = 'user_pathauto_bulk_update_batch_process';
+      $settings['batch_file'] = drupal_get_path('module', 'pathauto') . '/pathauto.pathauto.inc';
+      return (object) $settings;
+    default:
+      break;
+  }
+}
+
+/**
+ * Batch processing callback; Generate aliases for users.
+ */
+function user_pathauto_bulk_update_batch_process(&$context) {
+  if (!isset($context['sandbox']['current'])) {
+    $context['sandbox']['count'] = 0;
+    $context['sandbox']['current'] = 0;
+  }
+
+  $query = db_select('users', 'u');
+  $concat = _pathauto_sql_concat("'user/'", 'u.uid');
+  $query->leftJoin('url_alias', 'ua', "$concat = ua.source");
+  $query->addField('u', 'uid');
+  $query->isNull('ua.source');
+  $query->condition('u.uid', $context['sandbox']['current'], '>');
+  $query->orderBy('u.uid');
+  $query->addTag('pathauto_bulk_update');
+  $query->addMetaData('entity', 'user');
+
+  // Get the total amount of items to process.
+  if (!isset($context['sandbox']['total'])) {
+    $context['sandbox']['total'] = $query->countQuery()->execute()->fetchField();
+
+    // If there are no nodes to update, the stop immediately.
+    if (!$context['sandbox']['total']) {
+      $context['finished'] = 1;
+      return;
+    }
+  }
+
+  $query->range(0, 25);
+  $uids = $query->execute()->fetchCol();
+
+  pathauto_user_update_alias_multiple($uids, 'bulkupdate', array('alias blog' => FALSE));
+  $context['sandbox']['count'] += count($uids);
+  $context['sandbox']['current'] = max($uids);
+  $context['message'] = t('Updated alias for user @uid.', array('@uid' => end($uids)));
+
+  if ($context['sandbox']['count'] != $context['sandbox']['total']) {
+    $context['finished'] = $context['sandbox']['count'] / $context['sandbox']['total'];
+  }
+}
+
+/**
+ * Implements hook_pathauto().
+ */
+function blog_pathauto($op) {
+  switch ($op) {
+    case 'settings':
+      $settings = array();
+      $settings['module'] = 'blog';
+      $settings['token_type'] = 'user';
+      $settings['groupheader'] = t('Blog paths');
+      $settings['patterndescr'] = t('Pattern for blog page paths');
+      $settings['patterndefault'] = t('blogs/[user:name]');
+      $settings['supportsfeeds'] = 'feed';
+      $settings['batch_update_callback'] = 'blog_pathauto_bulk_update_batch_process';
+      $settings['batch_file'] = drupal_get_path('module', 'pathauto') . '/pathauto.pathauto.inc';
+      return (object) $settings;
+    default:
+      break;
+  }
+}
+
+/**
+ * Batch processing callback; Generate aliases for blogs.
+ */
+function blog_pathauto_bulk_update_batch_process(&$context) {
+  if (!isset($context['sandbox']['current'])) {
+    $context['sandbox']['count'] = 0;
+    $context['sandbox']['current'] = 0;
+  }
+
+  $query = db_select('users', 'u');
+  $concat = _pathauto_sql_concat("'blog/'", 'u.uid');
+  $query->leftJoin('url_alias', 'ua', "$concat = ua.source");
+  $query->addField('u', 'uid');
+  $query->isNull('ua.source');
+  $query->condition('u.uid', $context['sandbox']['current'], '>');
+  $query->orderBy('u.uid');
+  $query->addTag('pathauto_bulk_update');
+  $query->addMetaData('entity', 'user');
+
+  // Get the total amount of items to process.
+  if (!isset($context['sandbox']['total'])) {
+    $context['sandbox']['total'] = $query->countQuery()->execute()->fetchField();
+
+    // If there are no nodes to update, the stop immediately.
+    if (!$context['sandbox']['total']) {
+      $context['finished'] = 1;
+      return;
+    }
+  }
+
+  $query->range(0, 25);
+  $uids = $query->execute()->fetchCol();
+
+  $accounts = user_load_multiple($uids);
+  foreach ($accounts as $account) {
+    pathauto_blog_update_alias($account, 'bulkupdate');
+  }
+
+  $context['sandbox']['count'] += count($uids);
+  $context['sandbox']['current'] = max($uids);
+  $context['message'] = t('Updated alias for blog user @uid.', array('@uid' => end($uids)));
+
+  if ($context['sandbox']['count'] != $context['sandbox']['total']) {
+    $context['finished'] = $context['sandbox']['count'] / $context['sandbox']['total'];
+  }
+}
Index: pathauto.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.test,v
retrieving revision 1.25
diff -u -p -r1.25 pathauto.test
--- pathauto.test	26 Jul 2010 23:24:45 -0000	1.25
+++ pathauto.test	28 Jul 2010 19:11:23 -0000
@@ -49,11 +49,21 @@ class PathautoTestHelper extends DrupalW
     $this->assertAlias($uri['path'], $expected_alias, $language);
   }
 
-  function assertNoEntityAlias($entity_type, $entity, $expected_alias, $language = LANGUAGE_NONE) {
+  function assertEntityAliasExists($entity_type, $entity) {
+    $uri = entity_uri($entity_type, $entity);
+    $this->assertAliasExists(array('source' => $uri['path']));
+  }
+
+  function assertNoEntityAlias($entity_type, $entity, $language = LANGUAGE_NONE) {
     $uri = entity_uri($entity_type, $entity);
     $this->assertEntityAlias($entity_type, $entity, $uri['path'], $language);
   }
 
+  function assertNoEntityAliasExists($entity_type, $entity) {
+    $uri = entity_uri($entity_type, $entity);
+    $this->assertNoAliasExists(array('source' => $uri['path']));
+  }
+
   function assertAlias($source, $expected_alias, $language = '') {
     drupal_clear_path_cache($source);
     $alias = drupal_get_path_alias($source, $language);
@@ -69,6 +79,11 @@ class PathautoTestHelper extends DrupalW
     $alias = path_load($conditions);
     $this->assertFalse($alias, t('Alias with conditions @conditions not found.', array('@conditions' => var_export($conditions, TRUE))));
   }
+
+  function deleteAllAliases() {
+    db_delete('url_alias')->execute();
+    drupal_clear_path_cache();
+  }
 }
 
 /**
@@ -409,3 +424,53 @@ class PathautoLocaleTestCase extends Pat
     $this->assertAliasExists(array('pid' => $english_alias['pid'], 'alias' => 'content/english-node-0'));
   }
 }
+
+/**
+ * Bulk update functionality tests.
+ */
+class PathautoBulkUpdateTestCase extends PathautoFunctionalTestHelper {
+  private $nodes;
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Pathauto bulk updating',
+      'description' => 'Tests bulk updating of URL aliases.',
+      'group' => 'Pathauto',
+    );
+  }
+
+  function testBulkUpdate() {
+    // Create some nodes.
+    $this->nodes = array();
+    for ($i = 1; $i <= 5; $i++) {
+      $node = $this->drupalCreateNode();
+      $this->nodes[$node->nid] = $node;
+    }
+
+    // Clear out all aliases.
+    $this->deleteAllAliases();
+
+    // Bulk create aliases.
+    $edit = array(
+      'update[node_pathauto_bulk_update_batch_process]' => TRUE,
+      'update[user_pathauto_bulk_update_batch_process]' => TRUE,
+    );
+    $this->drupalPost('admin/config/search/path/update_bulk', $edit, t('Update'));
+    $this->assertText('Generated 7 URL aliases.'); // 5 nodes + 2 users
+
+    // Check that aliases have actually been created.
+    foreach ($this->nodes as $node) {
+      $this->assertEntityAliasExists('node', $node);
+    }
+    $this->assertEntityAliasExists('user', $this->admin_user);
+
+    // Add a new node.
+    $new_node = $this->drupalCreateNode(array('path' => array('alias' => '', 'pathauto_perform_alias' => FALSE)));
+
+    // Run the update again which should only run against the new node.
+    $this->drupalPost('admin/config/search/path/update_bulk', $edit, t('Update'));
+    $this->assertText('Generated 1 URL alias.'); // 1 node + 0 users
+
+    $this->assertEntityAliasExists('node', $new_node);
+  }
+}
Index: pathauto_node.inc
===================================================================
RCS file: pathauto_node.inc
diff -N pathauto_node.inc
--- pathauto_node.inc	25 Jul 2010 03:36:12 -0000	1.54
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,116 +0,0 @@
-<?php
-// $Id: pathauto_node.inc,v 1.54 2010/07/25 03:36:12 davereid Exp $
-
-/**
- * @file
- * Hook implementations for node module integration.
- *
- * @ingroup pathauto
- */
-
-/**
- * Implements hook_pathauto().
- */
-function node_pathauto($op) {
-  switch ($op) {
-    case 'settings':
-      $settings = array();
-      $settings['module'] = 'node';
-      $settings['token_type'] = 'node';
-      $settings['groupheader'] = t('Node paths');
-      $settings['patterndescr'] = t('Default path pattern (applies to all node types with blank patterns below)');
-      $settings['patterndefault'] = t('content/[node:title]');
-      $settings['bulkname'] = t('Bulk generate aliases for nodes that are not aliased');
-      $settings['bulkdescr'] = t('Generate aliases for all existing nodes which do not already have aliases.');
-      $settings['supportsfeeds'] = 'feed';
-
-      if (module_exists('locale')) {
-        $languages = array('' => t('Language neutral')) + locale_language_list('name');
-      }
-      else {
-        $languages = array();
-      }
-      foreach (node_type_get_names() as $node_type => $node_name) {
-        if (variable_get('language_content_type_' . $node_type, 0) && count($languages)) {
-          $settings['patternitems'][$node_type] = t('Default path pattern for @node_type (applies to all @node_type node types with blank patterns below)', array('@node_type' => $node_name));
-          foreach ($languages as $lang_code => $lang_name) {
-            if (!empty($lang_code)) {
-              $settings['patternitems'][$node_type . '_' . $lang_code] = t('Pattern for all @node_type paths in @language', array('@node_type' => $node_name, '@language' => $lang_name));
-            }
-            else {
-              $settings['patternitems'][$node_type . '_' . $lang_code] = t('Pattern for all language neutral @node_type paths', array('@node_type' => $node_name));
-            }
-          }
-        }
-        else {
-          $settings['patternitems'][$node_type] = t('Pattern for all @node_type paths', array('@node_type' => $node_name));
-        }
-      }
-      return (object) $settings;
-    default:
-      break;
-  }
-}
-
-/**
- * Generate aliases for all nodes without aliases.
- */
-function node_pathauto_bulkupdate() {
-  // From all node types, only attempt to update those with patterns
-  $pattern_types = array();
-
-  // If there's a default pattern we assume all types might be updated.
-  if (trim(variable_get('pathauto_node_pattern', ''))) {
-    $pattern_types = array_keys(node_type_get_types());
-  }
-  else {
-    // Check first for a node specific pattern...
-    $languages = array();
-    if (module_exists('locale')) {
-      $languages = array('' => t('Language neutral')) + locale_language_list('name');
-    }
-    foreach (array_keys(node_type_get_types()) as $type) {
-      if (trim(variable_get('pathauto_node_' . $type . '_pattern', ''))) {
-        $pattern_types[$type] = $type;
-        continue;
-      }
-      // ...then for a node-language pattern.
-      if (variable_get('language_content_type_' . $type, 0) && $languages) {
-        foreach ($languages as $lang_code => $lang_name) {
-          if (trim(variable_get('pathauto_node_' . $type . '_' . $lang_code . '_pattern', ''))) {
-            $pattern_types[$type] = $type;
-            continue 2;
-          }
-        }
-      }
-    }
-  }
-
-  $count = 0;
-  if (count($pattern_types)) {
-    // @TODO We could rewrite this section to use node_load_multiple
-    $concat = _pathauto_sql_concat("'node/'", 'n.nid');
-    $query = "SELECT n.nid, n.vid, n.type, n.title, n.uid, n.created, n.language, ua.source, ua.alias FROM {node} n LEFT JOIN {url_alias} ua ON $concat = ua.source WHERE ua.source IS NULL AND n.type IN (:pattern_types)";
-    $result = db_query_range($query, 0, variable_get('pathauto_max_bulk_update', 50), array(':pattern_types' => $pattern_types));
-
-    foreach ($result as $node_ref) {
-      $node = node_load($node_ref->nid, NULL, TRUE);
-      $node->source = $node_ref->source;
-      $node->alias = $node_ref->alias;
-      if (module_exists('taxonomy')) {
-        // Must populate the terms for the node here for the category
-        // placeholders to work
-        // @TODO Find the Drupal 7 alternative for this if necessary
-        //$node->taxonomy = array_keys(taxonomy_node_get_terms($node));
-      }
-      $uri = entity_uri('node', $node);
-      if (pathauto_create_alias('node', 'bulkupdate', $uri['path'], array('node' => $node), $node->type, $node->language)) {
-        $count++;
-      }
-    }
-  }
-
-  drupal_set_message(format_plural($count,
-    'Bulk generation of nodes completed, one alias generated.',
-    'Bulk generation of nodes completed, @count aliases generated.'));
-}
Index: pathauto_taxonomy.inc
===================================================================
RCS file: pathauto_taxonomy.inc
diff -N pathauto_taxonomy.inc
--- pathauto_taxonomy.inc	25 Jul 2010 03:36:12 -0000	1.50
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,171 +0,0 @@
-<?php
-// $Id: pathauto_taxonomy.inc,v 1.50 2010/07/25 03:36:12 davereid Exp $
-
-/**
- * @file
- * Hook implementations for taxonomy module integration.
- *
- * @ingroup pathauto
- */
-
-/**
- * Implements hook_pathauto().
- */
-function taxonomy_pathauto($op) {
-  switch ($op) {
-    case 'settings':
-      $settings = array();
-      $settings['module'] = 'taxonomy';
-      $settings['token_type'] = 'term';
-      $settings['groupheader'] = t('Taxonomy term paths');
-      $settings['patterndescr'] = t('Default path pattern (applies to all vocabularies with blank patterns below)');
-      $settings['patterndefault'] = t('category/[term:vocabulary]/[term:path]');
-      $settings['supportsfeeds'] = '0/feed';
-      $settings['bulkname'] = t('Bulk generate aliases for terms that are not aliased');
-      $settings['bulkdescr'] = t('Generate aliases for all existing terms which do not already have aliases.');
-
-      $vocabularies = taxonomy_get_vocabularies();
-      if (sizeof($vocabularies) > 0) {
-        $settings['patternitems'] = array();
-        $forum_vid = variable_get('forum_nav_vocabulary', '');
-        foreach ($vocabularies as $vocab) {
-          if ($vocab->vid != $forum_vid) {
-            $vocabname = $vocab->name;
-            $fieldlabel = t('Pattern for all %vocab-name paths', array('%vocab-name' => $vocabname));
-            $settings['patternitems'][$vocab->vid] = $fieldlabel;
-          }
-        }
-      }
-      return (object) $settings;
-    default:
-      break;
-  }
-}
-
-/**
- * Generate aliases for all categories without aliases.
- */
-function taxonomy_pathauto_bulkupdate() {
-  // Initialize db_or().
-  $pattern_or = db_or();
-
-  // From all vocabularies, only attempt to update those with patterns.
-  foreach (taxonomy_get_vocabularies() as $vid => $info) {
-    // TODO - If there's a default we shouldn't do this crazy where statement because all vocabularies get aliases.
-    // TODO - Special casing to exclude the forum vid (and the images vid and...?).
-    if (pathauto_pattern_load_by_entity('taxonomy', $vid)) {
-      $pattern_or->condition('vid', $vid);
-    }
-  }
-
-  // Set up the query object.
-  $query = db_select('taxonomy_term_data', 'td');
-  $concat = _pathauto_sql_concat("'taxonomy/term/'", 'td.tid');
-  $query->leftJoin('url_alias', 'ua', "$concat = ua.source");
-  $query->fields('td', array('tid', 'vid', 'name'));
-  $query->fields('ua', array('source', 'alias'));
-  $query->isNull('source');
-
-  // Exclude the forums.
-  if ($forum_vid = variable_get('forum_nav_vocabulary', '')) {
-    $query->condition('vid', $forum_vid, '<>');
-  }
-
-  // Add $pattern_or condition to query.
-  $query->condition($pattern_or);
-
-  // Add range to query.
-  $query->range(0, variable_get('pathauto_max_bulk_update', 50));
-
-  // Execute query.
-  $result = $query->execute();
-
-  $count = 0;
-  $placeholders = array();
-  foreach ($result as $term) {
-    $count += _taxonomy_pathauto_alias($term, 'bulkupdate');
-  }
-
-  drupal_set_message(format_plural($count,
-    'Bulk generation of terms completed, one alias generated.',
-    'Bulk generation of terms completed, @count aliases generated.'));
-}
-
-/**
- * Create aliases for taxonomy objects.
- *
- * @param $category
- *   A taxonomy object.
- *
- * @todo Get rid of this function since we should only provide the $term object.
- */
-function _taxonomy_pathauto_alias($term, $op) {
-  $count = 0;
-  $term = taxonomy_term_load($term->tid);
-  $uri = entity_uri('taxonomy_term', $term);
-  $forum_vid = variable_get('forum_nav_vocabulary', '');
-
-  // If we're in a forum vocabulary, also create a forum container, forum, or forum topic alias.
-  if (module_exists('forum') && $forum_vid == (int) $term->vid) {
-    if (pathauto_create_alias('forum', $op, $uri['path'], array('term' => $term, 'vocabulary' => $vocabulary), $term->vid)) {
-      $count++;
-    }
-  }
-  else {
-    if (pathauto_create_alias('taxonomy', $op, $uri['path'], array('term' => $term, 'vocabulary' => $vocabulary), $term->vid)) {
-      $count++;
-    }
-  }
-  return $count;
-}
-
-/**
- * Implement hook_pathauto() for forum module.
- */
-function forum_pathauto($op) {
-  switch ($op) {
-    case 'settings':
-      $settings = array();
-      $settings['module'] = 'forum';
-      $settings['token_type'] = 'term';
-      $settings['groupheader'] = t('Forum paths');
-      $settings['patterndescr'] = t('Pattern for forums and forum containers');
-      $settings['patterndefault'] = t('[term:vocabulary]/[term:path]');
-      $settings['supportsfeeds'] = '0/feed';
-      $settings['bulkname'] = t('Bulk generate aliases for forum paths that are not aliased');
-      $settings['bulkdescr'] = t('Generate aliases for all existing forums and forum containers which do not already have aliases.');
-      return (object) $settings;
-    default:
-      break;
-  }
-}
-
-/**
- * Generate aliases for all forums and forum containers without aliases.
- */
-function forum_pathauto_bulkupdate() {
-  // Set up the query object and limit it to the forum vocabulary.
-  $query = db_select('taxonomy_term_data', 'td');
-  $concat = _pathauto_sql_concat("'forum/'", 'td.tid');
-  $query->leftJoin('url_alias', 'ua', "$concat = source");
-  $query->condition('vid', variable_get('forum_nav_vocabulary', ''));
-  $query->fields('td', array('tid', 'vid', 'name'));
-  $query->fields('ua', array('source', 'alias'));
-  $query->isNull('source');
-
-  // Add range to query.
-  $query->range(0, variable_get('pathauto_max_bulk_update', 50));
-
-  // Execute query.
-  $result = $query->execute();
-
-  $count = 0;
-  $placeholders = array();
-  foreach ($result as $term) {
-    $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.'));
-}
Index: pathauto_user.inc
===================================================================
RCS file: pathauto_user.inc
diff -N pathauto_user.inc
--- pathauto_user.inc	25 Jul 2010 03:36:12 -0000	1.38
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,93 +0,0 @@
-<?php
-// $Id: pathauto_user.inc,v 1.38 2010/07/25 03:36:12 davereid Exp $
-
-/**
- * @file
- * Hook implementations for user module integration.
- *
- * @ingroup pathauto
- */
-
-/**
- * Implements hook_pathauto().
- */
-function user_pathauto($op) {
-  switch ($op) {
-    case 'settings':
-      $settings = array();
-      $settings['module'] = 'user';
-      $settings['token_type'] = 'user';
-      $settings['groupheader'] = t('User paths');
-      $settings['patterndescr'] = t('Pattern for user account page paths');
-      $settings['patterndefault'] = t('users/[user:name]');
-      $settings['bulkname'] = t('Bulk generate aliases for users that are not aliased');
-      $settings['bulkdescr'] = t('Generate aliases for all existing user account pages which do not already have aliases.');
-      return (object) $settings;
-    default:
-      break;
-  }
-}
-
-/**
- * Implements hook_pathauto().
- */
-function blog_pathauto($op) {
-  switch ($op) {
-    case 'settings':
-      $settings = array();
-      $settings['module'] = 'blog';
-      $settings['token_type'] = 'user';
-      $settings['groupheader'] = t('Blog paths');
-      $settings['patterndescr'] = t('Pattern for blog page paths');
-      $settings['patterndefault'] = t('blogs/[user:name]');
-      $settings['supportsfeeds'] = 'feed';
-      $settings['bulkname'] = t('Bulk generate aliases for blogs that are not aliased');
-      $settings['bulkdescr'] = t('Generate aliases for all existing blog pages which do not already have aliases.');
-      return (object) $settings;
-    default:
-      break;
-  }
-}
-
-/**
- * Bulk generate aliases for all users without aliases.
- */
-function user_pathauto_bulkupdate() {
-  $concat = _pathauto_sql_concat("'user/'", 'uid');
-  $query = "SELECT uid, name, source, alias FROM {users} LEFT JOIN {url_alias} ON $concat = source WHERE uid > 0 AND source IS NULL";
-  $result = db_query_range($query, 0, variable_get('pathauto_max_bulk_update', 50));
-
-  $count = 0;
-  $placeholders = array();
-  foreach ($result as $user) {
-    $uri = entity_uri('user', $user);
-    if (pathauto_create_alias('user', 'bulkupdate', $uri['path'], array('user' => $user))) {
-      $count++;
-    }
-  }
-
-  drupal_set_message(format_plural($count,
-    'Bulk generation of users completed, one alias generated.',
-    'Bulk generation of users completed, @count aliases generated.'));
-}
-
-/**
- * Bulk generate aliases for all blogs without aliases.
- */
-function blog_pathauto_bulkupdate() {
-  $concat = _pathauto_sql_concat("'blog/'", 'uid');
-  $query = "SELECT uid, name, source, alias FROM {users} LEFT JOIN {url_alias} ON $concat = source WHERE uid > 0 AND source IS NULL";
-  $result = db_query_range($query, 0, variable_get('pathauto_max_bulk_update', 50));
-
-  $count = 0;
-  foreach ($result as $user) {
-    $source = 'blog/' . $user->uid;
-    if (pathauto_create_alias('blog', 'bulkupdate', $source, array('user' => $user))) {
-      $count++;
-    }
-  }
-
-  drupal_set_message(format_plural($count,
-    'Bulk generation of user blogs completed, one alias generated.',
-    'Bulk generation of user blogs completed, @count aliases generated.'));
-}
