From d98cd83286c0d946667e6df58f9314cdbac34c4e Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Fri, 20 Dec 2002 13:47:58 +0000 Subject: [PATCH] More fixes git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3216 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/install/update_to_204.php | 45 +++------------------------------ phpBB/install/upgrade.php | 17 ++++++------- 3 files changed, 12 insertions(+), 51 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index cec7907677..f0483d3191 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -161,6 +161,7 @@ p,ul,td {font-size:10pt;}
  • Fixed rendering issue with quote button under Mozilla - Daz
  • Grammatical errors in remaining core lang files fixed - Cluster
  • Fixed bbcode quote breaking when username contained ] before [
  • +
  • Fixed duplicate group_id error during upgrade of users from phpBB 1.x
  • diff --git a/phpBB/install/update_to_204.php b/phpBB/install/update_to_204.php index 82d440d504..22dae9825f 100644 --- a/phpBB/install/update_to_204.php +++ b/phpBB/install/update_to_204.php @@ -284,25 +284,6 @@ switch ($row['config_value']) END OF DROP FORUM -- don't remove anything after this point! -------------------------------------------------------------- */ - /* --------------------------------------------------------------------- - DROP GROUP TABLE -- if this may cause you problems you can safely - comment it out, remember to manually add the IDENTITY setting on - the group_id column - --------------------------------------------------------------------- */ - $sql[] = "CREATE TABLE Tmp_" . GROUPS_TABLE . " - (group_id int IDENTITY (1, 1) NOT NULL, group_type smallint NULL, group_name varchar(50) NOT NULL, group_description varchar(255) NOT NULL, group_moderator int NULL, group_single_user smallint NOT NULL) ON [PRIMARY]"; - $sql[] = "INSERT INTO Tmp_" . GROUPS_TABLE . " (group_type, group_name, group_description, group_moderator, group_single_user) - SELECT group_type, group_name, group_description, group_moderator, group_single_user FROM " . GROUPS_TABLE . " TABLOCKX"; - $sql[] = "DROP TABLE " . GROUPS_TABLE; - $sql[] = "EXECUTE sp_rename N'Tmp_" . GROUPS_TABLE . "', N'" . GROUPS_TABLE . "', 'OBJECT'"; - $sql[] = "ALTER TABLE " . GROUPS_TABLE . " ADD - CONSTRAINT [PK_" . $table_prefix . "groups] PRIMARY KEY CLUSTERED (group_id) ON [PRIMARY]"; - $sql[] = "CREATE INDEX [IX_" . $table_prefix . "groups] - ON " . GROUPS_TABLE . " (group_single_user) ON [PRIMARY]"; - /* -------------------------------------------------------------- - END OF DROP GROUP -- don't remove anything after this point! - -------------------------------------------------------------- */ - $sql[] = "DROP INDEX " . RANKS_TABLE . ".IX_" . $table_prefix . "ranks"; $sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP COLUMN rank_max"; @@ -385,38 +366,18 @@ switch ($row['config_value']) case 'mysql4': $sql[] = "ALTER TABLE " . USERS_TABLE . " MODIFY COLUMN user_id mediumint(8) NOT NULL, - MODIFY COLUMN user_timezone decimal(4,2) DEFAULT '0' NOT NULL"; + MODIFY COLUMN user_timezone decimal(5,2) DEFAULT '0' NOT NULL"; break; case 'postgresql': $sql[] = "ALTER TABLE " . USERS_TABLE . " RENAME COLUMN user_timezone TO user_timezone_old"; $sql[] = "ALTER TABLE " . USERS_TABLE . " - ADD COLUMN user_timezone decimal(4)"; + ADD COLUMN user_timezone decimal(5)"; break; case 'mssql': case 'mssql-odbc': $sql[] = "ALTER TABLE " . USERS_TABLE . " - ALTER COLUMN [user_timezone] [decimal] (4,2) NOT NULL"; - /* --------------------------------------------------------------------- - DROP GROUP TABLE -- if this may cause you problems you can safely - comment it out, remember to manually add the IDENTITY setting on - the group_id column - --------------------------------------------------------------------- */ - $sql[] = "CREATE TABLE Tmp_" . GROUPS_TABLE . " - (group_id int IDENTITY (1, 1) NOT NULL, group_type smallint NULL, group_name varchar(50) NOT NULL, group_description varchar(255) NOT NULL, group_moderator int NULL, group_single_user smallint NOT NULL) ON [PRIMARY]"; - $sql[] = "SET IDENTITY_INSERT " . GROUPS_TABLE . " ON"; - $sql[] = "INSERT INTO Tmp_" . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user) - SELECT group_id, group_type, group_name, group_description, group_moderator, group_single_user FROM " . GROUPS_TABLE . " TABLOCKX"; - $sql[] = "SET IDENTITY_INSERT " . GROUPS_TABLE . " OFF"; - $sql[] = "DROP TABLE " . GROUPS_TABLE; - $sql[] = "EXECUTE sp_rename N'Tmp_" . GROUPS_TABLE . "', N'" . GROUPS_TABLE . "', 'OBJECT'"; - $sql[] = "ALTER TABLE " . GROUPS_TABLE . " ADD - CONSTRAINT [PK_" . $table_prefix . "groups] PRIMARY KEY CLUSTERED (group_id) ON [PRIMARY]"; - $sql[] = "CREATE INDEX [IX_" . $table_prefix . "groups] - ON " . GROUPS_TABLE . " (group_single_user) ON [PRIMARY]"; - /* -------------------------------------------------------------- - END OF DROP GROUP -- don't remove anything after this point! - -------------------------------------------------------------- */ + ALTER COLUMN [user_timezone] [decimal] (5,2) NOT NULL"; break; } diff --git a/phpBB/install/upgrade.php b/phpBB/install/upgrade.php index b73e5567b6..128287aca0 100644 --- a/phpBB/install/upgrade.php +++ b/phpBB/install/upgrade.php @@ -764,12 +764,12 @@ if ( !empty($next) ) $sql = "SELECT COUNT(*) AS total, MAX(user_id) AS maxid FROM " . USERS_TABLE; - $result = query($sql, "Couldn't get max post_id."); + $result = query($sql, "Couldn't get max user_id."); - $maxid = $db->sql_fetchrow($result); + $row = $db->sql_fetchrow($result); - $totalposts = $maxid['total']; - $maxid = $maxid['maxid']; + $totalposts = $row['total']; + $maxid = $row['maxid']; $sql = "ALTER TABLE " . USERS_TABLE . " ADD user_sig_bbcode_uid CHAR(10), @@ -811,13 +811,14 @@ if ( !empty($next) ) $per_pct = ceil( $db->sql_numrows($result) / 40 ); $inc = 0; - $group_id = 1; while( $row = $db->sql_fetchrow($result) ) { - $sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_description, group_single_user) - VALUES ($group_id, '" . addslashes($row['username']) . "', 'Personal User', 1)"; + $sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user) + VALUES ('" . addslashes($row['username']) . "', 'Personal User', 1)"; query($sql, "Wasn't able to insert user ".$row['user_id']." into table ".GROUPS_TABLE); + $group_id = $db->sql_nextid(); + $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) VALUES ($group_id, " . $row['user_id'] . ", 0)"; query($sql, "Wasn't able to insert user ".$row['user_id']." into table ".USER_GROUP_TABLE); @@ -828,8 +829,6 @@ if ( !empty($next) ) continue; } - $group_id++; - // // Nathan's bbcode2 conversion //