? patches
? pathauto.temp.inc
? pathauto.tokens.inc
? subpathauto
Index: pathauto.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.inc,v
retrieving revision 1.93
diff -u -p -r1.93 pathauto.inc
--- pathauto.inc	11 Nov 2010 17:39:05 -0000	1.93
+++ pathauto.inc	20 Dec 2010 17:28:33 -0000
@@ -73,7 +73,7 @@ define('PATHAUTO_PUNCTUATION_DO_NOTHING'
  *   TRUE if an alias exists, FALSE if not.
  */
 function _pathauto_alias_exists($alias, $source, $language = LANGUAGE_NONE) {
-  $pid = db_query_range("SELECT pid, alias FROM {url_alias} WHERE source <> :source AND alias = :alias AND language IN (:language, :language_none) ORDER BY language DESC, pid DESC", 0, 1, array(
+  $pid = db_query_range("SELECT pid FROM {url_alias} WHERE source <> :source AND alias = :alias AND language IN (:language, :language_none) ORDER BY language DESC, pid DESC", 0, 1, array(
     ':source' => $source,
     ':alias' => $alias,
     ':language' => $language,
@@ -398,7 +398,7 @@ function pathauto_create_alias($module, 
   $feedappend = trim(variable_get('pathauto_' . $module . '_applytofeeds', ''));
   if (drupal_strlen($feedappend)) {
     // For forums and taxonomies, the source doesn't always form the base of the RSS feed (i.e. image galleries)
-    if (($module == 'taxonomy' || $module == 'forum') && !empty($data['term'])) {
+    if (($module == 'taxonomy_term' || $module == 'forum') && !empty($data['term'])) {
       $source = 'taxonomy/term/' . $data['term']->tid;
     }
 
Index: pathauto.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.install,v
retrieving revision 1.26
diff -u -p -r1.26 pathauto.install
--- pathauto.install	7 Aug 2010 21:27:00 -0000	1.26
+++ pathauto.install	20 Dec 2010 17:28:33 -0000
@@ -138,7 +138,7 @@ function pathauto_update_7002() {
         // Skip the forum vocabulary.
         continue;
       }
-      if ($pattern = variable_get('pathauto_taxonomy_' . $vid . '_pattern')) {
+      if ($pattern = variable_get('pathauto_taxonomy_' . $vid . '_pattern', '')) {
         variable_set('pathauto_taxonomy_' . $vocabulary->machine_name . '_pattern', $pattern);
       }
       variable_del('pathauto_taxonomy_' . $vid . '_pattern');
@@ -147,6 +147,19 @@ function pathauto_update_7002() {
 }
 
 /**
+ * Rename 'taxonomy' variables to use the entity type 'taxonomy_term'.
+ */
+function pathauto_update_7003() {
+  $variables = db_query("SELECT name FROM {variable} WHERE name LIKE :pattern AND name NOT LIKE :pattern2", array(':pattern' => db_like("pathauto_taxonomy_") . '%', ':pattern2' => db_like("pathauto_taxonomy_term_") . '%'))->fetchCol();
+  foreach ($variables as $variable) {
+    $value = variable_get($variable);
+    variable_del($variable);
+    $variable = strtr($variable, array('pathauto_taxonomy_' => 'pathauto_taxonomy_term_'));
+    variable_set($variable, $value);
+  }
+}
+
+/**
  * 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.165
diff -u -p -r1.165 pathauto.module
--- pathauto.module	11 Oct 2010 01:04:03 -0000	1.165
+++ pathauto.module	20 Dec 2010 17:28:34 -0000
@@ -239,6 +239,33 @@ function pathauto_entity_path_delete_all
   }
 }
 
+/**
+ * Implements hook_field_attach_rename_bundle().
+ *
+ * Respond to machine name changes for pattern variables.
+ */
+function pathauto_field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) {
+  $variables = db_query("SELECT name FROM {variable} WHERE name LIKE :pattern", array(':pattern' => db_like("pathauto_{$entity_type}_{$bundle_old}_") . '%'))->fetchCol();
+  foreach ($variables as $variable) {
+    $value = variable_get($variable, '');
+    variable_del($variable);
+    $variable = strtr($variable, array("{$entity_type}_{$bundle_old}" => "{$entity_type}_{$bundle_new}"));
+    variable_set($variable, $value);
+  }
+}
+
+/**
+ * Implements hook_field_attach_delete_bundle().
+ *
+ * Respond to sub-types being deleted, their patterns can be removed.
+ */
+function pathauto_field_attach_delete_bundle($entity_type, $bundle, $instances) {
+  $variables = db_query("SELECT name FROM {variable} WHERE name LIKE :pattern", array(':pattern' => db_like("pathauto_{$entity_type}_{$bundle}_") . '%'))->fetchCol();
+  foreach ($variables as $variable) {
+    variable_del($variable);
+  }
+}
+
 //==============================================================================
 // Some node related functions.
 
@@ -451,7 +478,7 @@ function pathauto_taxonomy_term_delete($
 function pathauto_taxonomy_term_update_alias(stdClass $term, $op, array $options = array()) {
   $options += array('alias children' => FALSE);
 
-  $module = 'taxonomy';
+  $module = 'taxonomy_term';
   if ($term->vid == variable_get('forum_nav_vocabulary', '')) {
     if (module_exists('forum')) {
       $module = 'forum';
Index: pathauto.pathauto.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.pathauto.inc,v
retrieving revision 1.4
diff -u -p -r1.4 pathauto.pathauto.inc
--- pathauto.pathauto.inc	7 Aug 2010 21:27:00 -0000	1.4
+++ pathauto.pathauto.inc	20 Dec 2010 17:28:34 -0000
@@ -132,7 +132,7 @@ function taxonomy_pathauto($op) {
   switch ($op) {
     case 'settings':
       $settings = array();
-      $settings['module'] = 'taxonomy';
+      $settings['module'] = 'taxonomy_term';
       $settings['token_type'] = 'term';
       $settings['groupheader'] = t('Taxonomy term paths');
       $settings['patterndescr'] = t('Default path pattern (applies to all vocabularies with blank patterns below)');
Index: pathauto.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.test,v
retrieving revision 1.33
diff -u -p -r1.33 pathauto.test
--- pathauto.test	14 Dec 2010 20:17:15 -0000	1.33
+++ pathauto.test	20 Dec 2010 17:28:34 -0000
@@ -104,6 +104,11 @@ class PathautoTestHelper extends DrupalW
     taxonomy_term_save($term);
     return $term;
   }
+
+  function assertEntityPattern($entity_type, $bundle, $language = LANGUAGE_NONE, $expected) {
+    $pattern = pathauto_pattern_load_by_entity($entity_type, $bundle, $language);
+    $this->assertIdentical($expected, $pattern);
+  }
 }
 
 /**
@@ -283,7 +288,7 @@ class PathautoUnitTestCase extends Patha
    * Test the handling of path vs non-path tokens in pathauto_clean_token_values().
    */
   function testPathTokens() {
-    variable_set('pathauto_taxonomy_pattern', '[term:parent:path]/[term:name]');
+    variable_set('pathauto_taxonomy_term_pattern', '[term:parent:path]/[term:name]');
     $vocab = $this->addVocabulary();
 
     $term1 = $this->addTerm($vocab, array('name' => 'Parent term'));
@@ -296,6 +301,26 @@ class PathautoUnitTestCase extends Patha
     pathauto_taxonomy_term_update($term2);
     $this->assertEntityAlias('taxonomy_term', $term2, 'My Crazy/Alias/child-term');
   }
+
+  function testEntityBundleRenamingDeleting() {
+    // Create a vocabulary and test that it's pattern variable works.
+    $vocab = $this->addVocabulary(array('machine_name' => 'old_name'));
+    variable_set('pathauto_taxonomy_term_pattern', 'base');
+    variable_set("pathauto_taxonomy_term_old_name_pattern", 'bundle');
+    $this->assertEntityPattern('taxonomy_term', 'old_name', LANGUAGE_NONE, 'bundle');
+
+    // Rename the vocabulary's machine name, which should cause its pattern
+    // variable to also be renamed.
+    $vocab->machine_name = 'new_name';
+    taxonomy_vocabulary_save($vocab);
+    $this->assertEntityPattern('taxonomy_term', 'new_name', LANGUAGE_NONE, 'bundle');
+    $this->assertEntityPattern('taxonomy_term', 'old_name', LANGUAGE_NONE, 'base');
+
+    // Delete the vocabulary, which should cause its pattern variable to also
+    // be deleted.
+    taxonomy_vocabulary_delete($vocab->vid);
+    $this->assertEntityPattern('taxonomy_term', 'new_name', LANGUAGE_NONE, 'base');
+  }
 }
 
 /**
