Index: contributions/modules/realname/realname.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/realname/Attic/realname.admin.inc,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 realname.admin.inc
--- contributions/modules/realname/realname.admin.inc	21 Apr 2009 23:18:39 -0000	1.1.2.6
+++ contributions/modules/realname/realname.admin.inc	2 Jul 2009 08:58:42 -0000
@@ -446,9 +446,54 @@ function realname_rebuild_confirm_submit
     'title' => t('Rebuilding realnames'),
     'operations' => array(
       array('_realname_rebuild_realnames', array()),
-      ),
-    'finished' => '_realname_rebuild_batch_finished'
+    ),
+    'file' => drupal_get_path('module', 'realname') . '/realname.admin.inc',
+    'finished' => '_realname_rebuild_batch_finished',
   );
   batch_set($batch);
 }
 
+/**
+ * Batchable function used to rebuild realnames
+ */
+function _realname_rebuild_realnames(&$context) {
+  if (empty($context['sandbox'])) {
+    // Initiate multistep processing.
+    $context['sandbox']['progress'] = 0;
+    $context['sandbox']['current_user'] = 0;
+    $context['sandbox']['max'] = db_result(db_query('SELECT COUNT(DISTINCT uid) FROM {users}'));
+  }
+
+  // Process the next 20 users.
+  $limit = 20;
+  $result = db_query_range("SELECT u.uid, u.name, u.mail FROM {users} u WHERE uid > %d ORDER BY uid ASC", $context['sandbox']['current_user'], 0, $limit);
+  while ($row = db_fetch_object($result)) {
+    $realname->uid = $row->uid;
+    $realname->realname = _realname_make_name($row);
+    // Try to update, if fail - try to insert.
+    if (db_result(db_query('SELECT COUNT(uid) FROM {realname} WHERE uid=%d', $realname->uid))) {
+      drupal_write_record('realname', $realname, 'uid');
+    }
+    else {
+      drupal_write_record('realname', $realname);
+    }
+    $context['sandbox']['progress']++;
+    $context['sandbox']['current_user'] = $row->uid;
+  }
+
+  // Multistep processing : report progress.
+  if ($context['sandbox']['progress'] != ($context['sandbox']['max']) - 1) {
+    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
+  }
+}
+
+function _realname_rebuild_batch_finished($success, $results, $operations) {
+  if ($success) {
+    drupal_set_message(t('The realnames have been rebuilt.'));
+    variable_set('realname_recalculate', FALSE);
+    drupal_goto('admin/user/realname');
+  }
+  else {
+    drupal_set_message(t('The realnames have not been properly rebuilt.'), 'error');
+  }
+}
Index: contributions/modules/realname/realname.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/realname/realname.module,v
retrieving revision 1.4.4.54
diff -u -p -r1.4.4.54 realname.module
--- contributions/modules/realname/realname.module	12 May 2009 23:29:57 -0000	1.4.4.54
+++ contributions/modules/realname/realname.module	2 Jul 2009 08:58:42 -0000
@@ -803,46 +803,3 @@ function realname_ajax_autocomplete_user
 
   drupal_json($matches);
 }
-
-/**
- * Batchable function used to rebuild realnames
- * Batch API does not for some reason pick'em up in realname.admin.inc
- */
-function _realname_rebuild_realnames(&$context) {
-  if (empty($context['sandbox'])) {
-    // Initiate multistep processing.
-    $context['sandbox']['progress'] = 0;
-    $context['sandbox']['current_user'] = 0;
-    $context['sandbox']['max'] = db_result(db_query('SELECT COUNT(DISTINCT uid) FROM {users}'));
-  }
-
-  // Process the next 20 users.
-  $limit = 20;
-  $result = db_query_range("SELECT u.uid, u.name, u.mail FROM {users} u WHERE uid >= %d ORDER BY uid ASC", $context['sandbox']['current_user'], 0, $limit);
-  while ($row = db_fetch_object($result)) {
-    $realname->uid = $row->uid;
-    $realname->realname = _realname_make_name($row);
-    // Try to update, if fail - try to insert.
-    if (!drupal_write_record('realname', $realname,  'uid')) {
-      drupal_write_record('realname', $realname);
-    }
-    $context['sandbox']['progress']++;
-    $context['sandbox']['current_user'] = $row->uid;
-  }
-
-  // Multistep processing : report progress.
-  if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
-  }
-}
-
-function _realname_rebuild_batch_finished($success, $results, $operations) {
-  if ($success) {
-    drupal_set_message(t('The realnames have been rebuilt.'));
-    variable_set('realname_recalculate', FALSE);
-    drupal_goto('admin/user/realname');
-  }
-  else {
-    drupal_set_message(t('The realanmes have not been properly rebuilt.'), 'error');
-  }
-}
