? AutmaticNodetitles-BatchUpdateNodetitlesD6.patch
Index: auto_nodetitle.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/auto_nodetitle/Attic/auto_nodetitle.module,v
retrieving revision 1.20.2.3
diff -u -p -r1.20.2.3 auto_nodetitle.module
--- auto_nodetitle.module	30 Dec 2008 20:28:26 -0000	1.20.2.3
+++ auto_nodetitle.module	3 Feb 2009 02:27:22 -0000
@@ -86,6 +86,36 @@ function auto_nodetitle_set_title(&$node
 }
 
 /**
+ * Implementation of hook_node_operations().
+ */
+function auto_nodetitle_node_operations() {
+  $operations = array(
+    'nodetitle_update' => array(
+      'label' => t('Update automatic nodetitles'),
+      'callback' => 'auto_nodetitle_operations_update',
+    ),
+  );
+  return $operations;
+}
+
+/**
+ * Callback function for updating node titles.
+ */
+function auto_nodetitle_operations_update($nodes) {
+  foreach ($nodes as $nid) {
+    $node = node_load($nid);
+    if ($node->nid) {
+      $previous_title = $node->title;
+      auto_nodetitle_set_title($node);
+      // Only save if the title has actually changed.
+      if ($node->title != $previous_title) {
+        node_save($node);
+      }
+    }
+  }
+}
+
+/**
   * Helper function to generate the title according to the PHP code.
   * Right now its only a wrapper, but if this is to be expanded, here is the place to be.
   * @return a title string
