Browse Source

! A few more bugfixes related to updating PM labels...

Signed-off-by: Michael Eshom <[email protected]>
Michael Eshom 11 years ago
parent
commit
830f9e44b5
3 changed files with 23 additions and 5 deletions
  1. 8 2
      other/upgrade_2-1_mysql.sql
  2. 8 2
      other/upgrade_2-1_postgresql.sql
  3. 7 1
      other/upgrade_2-1_sqlite.sql

+ 8 - 2
other/upgrade_2-1_mysql.sql

@@ -605,7 +605,7 @@ CREATE TABLE IF NOT EXISTS {$db_prefix}pm_labeled_messages (
   id_label int(10) unsigned NOT NULL default '0',
   id_pm int(10) unsigned NOT NULL default '0',
   PRIMARY KEY (id_label, id_pm)
-);
+) ENGINE=MyISAM;
 ---#
 
 ---# Adding "in_inbox" column to pm_recipients
@@ -650,6 +650,9 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
 		if (!empty($inserts))
 		{
 			$smcFunc['db_insert']('', '{db_prefix}pm_labels', array('id_member' => 'int', 'name' => 'string-30'), $inserts, array());
+			
+			// Clear this out for our next query below
+			$inserts = array();
 		}
 
 		// This is the easy part - update the inbox stuff
@@ -711,7 +714,10 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
 		$smcFunc['db_free_result']($get_pm_labels);
 
 		// Insert the new data
-		$smcFunc['db_insert']('', '{db_prefix}pm_labeled_messages', array('id_pm' => 'int', 'id_label' => 'int'), $inserts, array());
+		if (!empty($inserts))
+		{
+			$smcFunc['db_insert']('', '{db_prefix}pm_labeled_messages', array('id_pm' => 'int', 'id_label' => 'int'), $inserts, array());
+		}
 
 		// Final step of this ridiculously massive process
 		$get_pm_rules = $smcFunc['db_query']('', '

+ 8 - 2
other/upgrade_2-1_postgresql.sql

@@ -721,7 +721,7 @@ ADD COLUMN in_inbox smallint NOT NULL default '1';
 			{
 				// Keep track of the index of this label - we'll need that in a bit...
 				$label_info[$row['id_member']][$label] = $index;
-				$inserts[] = "($row[id_member], $label)";
+				$inserts[] = array($row['id_member'], $label);
 			}
 		}
 		
@@ -730,6 +730,9 @@ ADD COLUMN in_inbox smallint NOT NULL default '1';
 		if (!empty($inserts))
 		{
 			$smcFunc['db_insert']('', '{db_prefix}pm_labels', array('id_member' => 'int', 'name' => 'string-30'), $inserts, array());
+
+			// Clear this out for our next query below
+			$inserts = array();
 		}
 
 		// This is the easy part - update the inbox stuff
@@ -791,7 +794,10 @@ ADD COLUMN in_inbox smallint NOT NULL default '1';
 		$smcFunc['db_free_result']($get_pm_labels);
 
 		// Insert the new data
-		$smcFunc['db_insert']('', '{db_prefix}pm_labeled_messages', array('id_pm' => 'int', 'id_label' => 'int'), $inserts, array());
+		if (!empty($inserts))
+		{
+			$smcFunc['db_insert']('', '{db_prefix}pm_labeled_messages', array('id_pm' => 'int', 'id_label' => 'int'), $inserts, array());
+		}
 
 		// Final step of this ridiculously massive process
 		$get_pm_rules = $smcFunc['db_query']('', '

+ 7 - 1
other/upgrade_2-1_sqlite.sql

@@ -707,6 +707,9 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
 		if (!empty($inserts))
 		{
 			$smcFunc['db_insert']('', '{db_prefix}pm_labels', array('id_member' => 'int', 'name' => 'int'), $inserts, array());
+
+			// Clear this out for our next query below
+			$inserts = array();
 		}
 
 		// This is the easy part - update the inbox stuff
@@ -768,7 +771,10 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
 		$smcFunc['db_free_result']($get_pm_labels);
 
 		// Insert the new data
-		$smcFunc['db_insert']('', '{db_prefix}pm_labeled_messages', array('id_pm', 'id_label'), $inserts, array());
+		if (!empty($inserts))
+		{
+			$smcFunc['db_insert']('', '{db_prefix}pm_labeled_messages', array('id_pm', 'id_label'), $inserts, array());
+		}
 
 		// Final step of this ridiculously massive process
 		$get_pm_rules = $smcFunc['db_query']('', '