Index: privatemsg.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.install,v
retrieving revision 1.5.2.4.2.11.2.9
diff -u -r1.5.2.4.2.11.2.9 privatemsg.install
--- privatemsg.install	8 Jun 2009 15:10:08 -0000	1.5.2.4.2.11.2.9
+++ privatemsg.install	12 Jun 2009 20:19:53 -0000
@@ -112,34 +112,6 @@
   drupal_uninstall_schema('privatemsg');
 }
 
-function privatemsg_update_6001() {
-  $ret = array();
-
-  if (!db_column_exists('pm_index', 'is_new')) {
-
-    if (db_column_exists('pm_index', 'new')) {
-      $old_column = 'new';
-    }
-    elseif (db_column_exists('pm_index', 'new_flag')) {
-      $old_column = 'new_flag';
-    }
-    else {
-      return $ret;
-    }
-
-    db_drop_index($ret, 'pm_index', $old_column);
-    db_change_field($ret, 'pm_index', $old_column, 'is_new', array(
-          'description'   => 'Whether the user has read this message',
-          'type'          => 'int',
-          'default'       => 1,
-          'not null'      => TRUE,
-          'unsigned'      => TRUE));
-    db_add_index($ret, 'pm_index', 'is_new', array('mid', 'uid', 'is_new'));
-  }
-
-  return $ret;
-}
-
 function privatemsg_update_6000() {
   // Give update unlimited time to complete.
   set_time_limit(0);
@@ -311,8 +283,8 @@
   if (db_table_exists('privatemsg_folder')) {
     $data = db_query("SELECT * FROM {privatemsg_folder}");
     while ($result = db_fetch_array($data)) {
-      if (db_result(db_query("SELECT COUNT(*) FROM {pm_tags} WHERE tag = '%s'", $result->name)) == 0) {
-        db_query("INSERT INTO {pm_tags} (tag) VALUES ('%s')", $result->name);
+      if (db_result(db_query("SELECT COUNT(*) FROM {pm_tags} WHERE tag = '%s'", $result['name'])) == 0) {
+        db_query("INSERT INTO {pm_tags} (tag) VALUES ('%s')", $result['name']);
       }
     }
   }
@@ -371,9 +343,9 @@
   // Step 3b: Fix and import the tagging data.
   $data = db_query("SELECT thread_id, folder, uid FROM {temp_pm_index} WHERE folder <> %d", 0);
   while ($result = db_fetch_array($data)) {
-    $tag_id = db_result(db_query('SELECT pmt.tag_id FROM {pm_tags} pmt INNER JOIN {privatemsg_folder} pmf ON pmt.tag = pmf.name WHERE pmf.fid = %d', $result->folder));
-    if (db_result(db_query("SELECT COUNT(*) FROM {pm_tags_index} WHERE uid = %d AND (thread_id = %d AND tag_id = %d)", $result->uid, $result->thread_id, $tag_id)) == 0) {
-      db_query("INSERT INTO {pm_tags_index} (uid, tag_id, thread_id) VALUES (%d, %d, %d)", $result->uid, $tag_id, $result->thread_id);
+    $tag_id = db_result(db_query('SELECT pmt.tag_id FROM {pm_tags} pmt INNER JOIN {privatemsg_folder} pmf ON pmt.tag = pmf.name WHERE pmf.fid = %d', $result['folder']));
+    if (db_result(db_query("SELECT COUNT(*) FROM {pm_tags_index} WHERE uid = %d AND (thread_id = %d AND tag_id = %d)", $result['uid'], $result['thread_id'], $tag_id)) == 0) {
+      db_query("INSERT INTO {pm_tags_index} (uid, tag_id, thread_id) VALUES (%d, %d, %d)", $result['uid'], $tag_id, $result['thread_id']);
     }
   }
 
@@ -393,6 +365,34 @@
   return $ret;
 }
 
+function privatemsg_update_6001() {
+  $ret = array();
+
+  if (!db_column_exists('pm_index', 'is_new')) {
+
+    if (db_column_exists('pm_index', 'new')) {
+      $old_column = 'new';
+    }
+    elseif (db_column_exists('pm_index', 'new_flag')) {
+      $old_column = 'new_flag';
+    }
+    else {
+      return $ret;
+    }
+
+    db_drop_index($ret, 'pm_index', $old_column);
+    db_change_field($ret, 'pm_index', $old_column, 'is_new', array(
+          'description'   => 'Whether the user has read this message',
+          'type'          => 'int',
+          'default'       => 1,
+          'not null'      => TRUE,
+          'unsigned'      => TRUE));
+    db_add_index($ret, 'pm_index', 'is_new', array('mid', 'uid', 'is_new'));
+  }
+
+  return $ret;
+}
+
 function privatemsg_update_6002() {
   $ret = array();
   // update_sql does not support parameters, we need to use db_query

