From 57517f0146a9a7009baeae56737d2676020def1e Mon Sep 17 00:00:00 2001 From: skeeter Date: Fri, 27 Oct 2000 00:16:33 +0000 Subject: [PATCH] fixes for upgrading to 0.9.3pre3 --- setup/upgradetables_mysql.inc.php | 11 ++++++----- setup/upgradetables_pgsql.inc.php | 13 +++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/setup/upgradetables_mysql.inc.php b/setup/upgradetables_mysql.inc.php index 833a9a72fa..d1564a35a3 100644 --- a/setup/upgradetables_mysql.inc.php +++ b/setup/upgradetables_mysql.inc.php @@ -248,9 +248,9 @@ $owner[count($owner)] = $db->f($field); } for($i=0;$iquery("select account_id From accounts where account_lid='".$owner[$i]."'"); - $account_id[$i] = $db->f("account_id"); - $db->query("update $table set $field=".$account_id[$i]." where $field='".$owner[$i]."'"); + $db->query("select account_id from accounts where account_lid='".$owner[$i]."'"); + $db->next_record(); + $db->query("update $table set $field=".$db->f("account_id")." where $field='".$owner[$i]."'"); } } $db->query("alter table $table change $field $field int(11) NOT NULL"); @@ -267,7 +267,8 @@ update_owner("todo","todo_owner"); update_owner("webcal_entry","cal_create_by"); update_owner("webcal_entry_user","cal_login"); - } + $currentver = "0.9.3pre2"; + } if ($currentver == "0.9.3pre2") { $db->query("select owner, newsgroup from users_newsgroups"); if($db->num_rows()) { @@ -287,7 +288,7 @@ echo " \n"; echo " Upgrade from 0.9.2 to 0.9.3pre3 is completed.\n"; echo " \n"; - $currentver = "0.9.3pre2"; + $currentver = "0.9.3pre3"; } } diff --git a/setup/upgradetables_pgsql.inc.php b/setup/upgradetables_pgsql.inc.php index c0aa4c58c3..1f8695e5a6 100644 --- a/setup/upgradetables_pgsql.inc.php +++ b/setup/upgradetables_pgsql.inc.php @@ -228,7 +228,7 @@ $currentver = "0.9.2"; } } - + function update_owner($table,$field){ global $db; $db->query("select distinct($field) from $table"); @@ -237,9 +237,9 @@ $owner[count($owner)] = $db->f($field); } for($i=0;$iquery("select account_id From accounts where account_lid='".$owner[$i]."'"); - $account_id[$i] = $db->f("account_id"); - $db->query("update $table set $field=".$account_id[$i]." where $field='".$owner[$i]."'"); + $db->query("select account_id from accounts where account_lid='".$owner[$i]."'"); + $db->next_record(); + $db->query("update $table set $field=".$db->f("account_id")." where $field='".$owner[$i]."'"); } } $db->query("alter table $table change $field $field int(11) NOT NULL"); @@ -256,7 +256,8 @@ update_owner("todo","todo_owner"); update_owner("webcal_entry","cal_create_by"); update_owner("webcal_entry_user","cal_login"); - } + $currentver = "0.9.3pre2"; + } if ($currentver == "0.9.3pre2") { $db->query("select owner, newsgroup from users_newsgroups"); if($db->num_rows()) { @@ -276,7 +277,7 @@ echo " \n"; echo " Upgrade from 0.9.2 to 0.9.3pre3 is completed.\n"; echo " \n"; - $currentver = "0.9.3pre2"; + $currentver = "0.9.3pre3"; } }