Index: uuid.admin.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/uuid/uuid.admin.inc,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 uuid.admin.inc
--- uuid.admin.inc	11 Jun 2009 18:07:13 -0000	1.1.2.2
+++ uuid.admin.inc	16 Sep 2009 12:33:54 -0000
@@ -32,6 +32,28 @@
     '#description' => t('Should UUIDs be created automatically for every existing, and new user?'),
     '#required' => FALSE,
   );
+  
+  $form['taxonomy'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Taxonomy UUID Settings'),
+  );
+  
+  if ($options = array_map(create_function('$voc', 'return $voc->name;'), taxonomy_get_vocabularies())) {
+    $form['taxonomy']['uuid_automatic_for_taxonomy'] = array(
+      '#type' => 'checkboxes',
+      '#title' => t('Automatic UUIDs for taxonomy'),
+      '#default_value' => variable_get('uuid_automatic_for_taxonomy', array()),
+      '#options' => $options,
+      '#description' => t('Selected vocabularies to have UUIDs automatically generated.'),
+      '#required' => FALSE,
+    );
+  }
+  else {
+    $form['taxonomy']['uuid_automatic_for_taxonomy'] = array(
+      '#type' => 'item',
+      '#value' => t('There is currently no vocabulary defined.'),
+    );
+  }
 
   // TODO: Is this "sync" button really necessary?  Handle this better.
   $form['settings'] = array(
@@ -64,6 +86,15 @@
     db_query("INSERT INTO {uuid_node} SELECT n.nid, UUID() FROM {node} AS n WHERE n.type = '%s' AND NOT EXISTS (SELECT nid FROM {uuid_node} WHERE nid = n.nid)", $type);
     db_query("INSERT INTO {uuid_node_revisions} SELECT nr.vid, UUID() FROM {node_revisions} AS nr INNER JOIN {node} n ON nr.nid = n.nid WHERE n.type = '%s' AND NOT EXISTS (SELECT vid FROM {uuid_node_revisions} WHERE vid = nr.vid)", $type);
   }
+  
+  $vids = variable_get('uuid_automatic_for_taxonomy', array());
+  if ($vids) {
+    $placehoders = implode(', ', array_fill(0, count($vids), '%d'));
+    // Vocabularies
+    db_query("INSERT INTO {uuid_vocabulary} SELECT v.vid, UUID() FROM {vocabulary} AS v WHERE v.vid IN ($placehoders) AND NOT EXISTS (SELECT vid FROM {uuid_vocabulary} WHERE vid = v.vid)", $vids);
+    // Terms
+    db_query("INSERT INTO {uuid_term_data} SELECT td.tid, UUID() FROM {term_data} AS td WHERE td.vid IN ($placehoders) AND NOT EXISTS (SELECT tid FROM {uuid_term_data} WHERE tid = td.tid)", $vids);
+  }
 
   drupal_set_message(t("UUID tables have been updated."));
 }
Index: uuid.install
===================================================================
RCS file: /cvs/drupal/contributions/modules/uuid/uuid.install,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 uuid.install
--- uuid.install	1 Sep 2009 02:00:38 -0000	1.1.2.3
+++ uuid.install	16 Sep 2009 12:15:25 -0000
@@ -67,7 +67,20 @@
 function uuid_uninstall() {
   variable_del('uuid_automatic_for_nodes');
   variable_del('uuid_automatic_for_users');
-
+  variable_del('uuid_automatic_for_taxonomy');
+  
   // Remove tables.
   drupal_uninstall_schema('uuid');
 }
+
+/**
+ * Implementation of hook_update().
+ */
+function uuid_update_6001() {
+  $ret = array();
+  
+  db_create_table($ret, 'uuid_vocabulary', uuid_table_schema('vocabulary', 'vid'));
+  db_create_table($ret, 'uuid_term_data', uuid_table_schema('term_data', 'tid'));
+  
+  return $ret;
+}
Index: uuid.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/uuid/uuid.module,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 uuid.module
--- uuid.module	16 Sep 2009 05:07:59 -0000	1.1.2.5
+++ uuid.module	16 Sep 2009 12:04:41 -0000
@@ -163,6 +163,35 @@
 }
 
 /**
+ * Implementation of hook_taxonomy().
+ */
+function uuid_taxonomy($op, $type, $array = NULL) {
+  $types = array(
+    'term' => array(
+      'table' => 'uuid_term_data',
+      'field' => 'tid',
+    ),
+    'vocabulary' => array(
+      'table' => 'uuid_vocabulary',
+      'field' => 'vid',
+    ),
+  );
+  
+  if (array_key_exists($type, $types) && in_array($array['vid'], variable_get('uuid_automatic_for_taxonomy', array()))) {
+    $field = $types[$type]['field'];
+    switch ($op) {
+      case 'insert':
+        db_query("INSERT INTO {" . $types[$type]['table'] . "} ($field, uuid) VALUES (%d, UUID())",
+          $array[$types[$type]['field']]);
+        break;
+      case 'delete':
+        db_query("DELETE FROM {". $types[$type]['table'] ."} WHERE $field = %d", $array[$types[$type]['field']]);
+        break;
+    }
+  }
+}
+
+/**
  * Determines if a UUID is valid.
  */
 function uuid_is_valid($uuid) {

