From fcba7b15b9d9e672c6a5c4c4bdb283a600c1a2ed Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 12 Jun 2004 01:30:00 +0000 Subject: [PATCH] Revert postgresql changes pending further testing and fixes; this breaks currently running wikis using memcached (such as Wikipedia) --- includes/User.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/includes/User.php b/includes/User.php index 572060b885..686963c9fd 100644 --- a/includes/User.php +++ b/includes/User.php @@ -12,7 +12,6 @@ class User { /* private */ var $mTouched; /* private */ var $mCookiePassword; /* private */ var $mRealName; - /* private */ var $mUserTable; function User() { @@ -44,14 +43,12 @@ class User { /* static */ function idFromName( $name ) { - global $wgIsPg; $nt = Title::newFromText( $name ); if( is_null( $nt ) ) { # Illegal name return null; } - $usertable=$wgIsPg?'"user"':'user'; - $sql = "SELECT user_id FROM $usertable WHERE user_name='" . + $sql = "SELECT user_id FROM user WHERE user_name='" . wfStrencode( $nt->getText() ) . "'"; $res = wfQuery( $sql, DB_READ, "User::idFromName" ); @@ -85,7 +82,7 @@ class User { function loadDefaults() { - global $wgLang, $wgIP, $wgIsPg; + global $wgLang, $wgIP; global $wgNamespacesToBeSearchedDefault; $this->mId = $this->mNewtalk = 0; @@ -105,9 +102,6 @@ class User { $this->mBlockedby = -1; # Unset $this->mTouched = '0'; # Allow any pages to be cached $this->cookiePassword = ""; - - /* avoid reserved keyword usage for PostgreSQL */ - $this->mUserTable=$wgIsPg?'"user"':'user'; } /* private */ function getBlockedStatus() @@ -266,7 +260,7 @@ class User { $sql = "SELECT user_name,user_password,user_newpassword,user_email," . "user_real_name,user_options,user_rights,user_touched " . - " FROM {$this->mUserTable} WHERE user_id=" . $this->mId; + " FROM user WHERE user_id=" . $this->mId; $res = wfQuery( $sql, DB_READ, "User::loadFromDatabase" ); if ( wfNumRows( $res ) > 0 ) { @@ -567,6 +561,7 @@ class User { function saveSettings() { global $wgMemc, $wgDBname; + if ( ! $this->mNewtalk ) { if( $this->mId ) { $sql="DELETE FROM user_newtalk WHERE user_id={$this->mId}"; @@ -579,7 +574,7 @@ class User { } if ( 0 == $this->mId ) { return; } - $sql = "UPDATE {$this->mUserTable} SET " . + $sql = "UPDATE user SET " . "user_name= '" . wfStrencode( $this->mName ) . "', " . "user_password= '" . wfStrencode( $this->mPassword ) . "', " . "user_newpassword= '" . wfStrencode( $this->mNewpassword ) . "', " . @@ -601,7 +596,7 @@ class User { $s = trim( $this->mName ); if ( 0 == strcmp( "", $s ) ) return 0; - $sql = "SELECT user_id FROM {$this->mUserTable} WHERE user_name='" . + $sql = "SELECT user_id FROM user WHERE user_name='" . wfStrencode( $s ) . "'"; $res = wfQuery( $sql, DB_READ, "User::idForName" ); if ( 0 == wfNumRows( $res ) ) { return 0; } @@ -616,7 +611,7 @@ class User { function addToDatabase() { - $sql = "INSERT INTO {$this->mUserTable} (user_name,user_password,user_newpassword," . + $sql = "INSERT INTO user (user_name,user_password,user_newpassword," . "user_email, user_real_name, user_rights, user_options) " . " VALUES ('" . wfStrencode( $this->mName ) . "', '" . wfStrencode( $this->mPassword ) . "', '" . -- 2.20.1