r34831 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34830‎ | r34831 | r34832 >
Date:21:45, 14 May 2008
Author:brion
Status:old
Tags:
Comment:
Rather than breaking the site during upgrades (and potential following downgrades if something breaks) for an arbitrary field name change, let's just not change the field name.
Revert lu_wiki and ln_wiki back to *_dbname
Modified paths:
  • /trunk/extensions/CentralAuth/CentralAuthUser.php (modified) (history)
  • /trunk/extensions/CentralAuth/CentralAuthUserArray.php (modified) (history)
  • /trunk/extensions/CentralAuth/SpecialGlobalUsers.php (modified) (history)
  • /trunk/extensions/CentralAuth/central-auth.sql (modified) (history)
  • /trunk/extensions/CentralAuth/db_patches/patch-lu_wiki.sql (deleted) (history)

Diff [purge]

Index: trunk/extensions/CentralAuth/central-auth.sql
@@ -28,11 +28,11 @@
2929 -- only existing databases not yet migrated have to be loaded.
3030 --
3131 CREATE TABLE localnames (
32 - ln_wiki varchar(255) binary not null,
 32+ ln_dbname varchar(255) binary not null,
3333 ln_name varchar(255) binary not null,
3434
35 - primary key (ln_wiki, ln_name),
36 - key (ln_name, ln_wiki)
 35+ primary key (ln_dbname, ln_name),
 36+ key (ln_name, ln_dbname)
3737 ) /*$wgDBTableOptions*/;
3838
3939 --
@@ -96,7 +96,7 @@
9797 -- All local DBs will be swept on an opt-in check event.
9898 --
9999 CREATE TABLE localuser (
100 - lu_wiki varchar(255) binary not null,
 100+ lu_dbname varchar(255) binary not null,
101101 lu_name varchar(255) binary not null,
102102
103103 -- Migration status/logging information, to help diagnose issues
@@ -110,8 +110,8 @@
111111 'new',
112112 'login'),
113113
114 - primary key (lu_wiki, lu_name),
115 - key (lu_name, lu_wiki)
 114+ primary key (lu_dbname, lu_name),
 115+ key (lu_name, lu_dbname)
116116 ) /*$wgDBTableOptions*/;
117117
118118
Index: trunk/extensions/CentralAuth/db_patches/patch-lu_wiki.sql
@@ -1,2 +0,0 @@
2 -ALTER TABLE localnames CHANGE ln_dbname ln_wiki varchar(255) binary not null;
3 -ALTER TABLE localuser CHANGE lu_dbname lu_wiki varchar(255) binary not null;
Index: trunk/extensions/CentralAuth/CentralAuthUserArray.php
@@ -30,7 +30,7 @@
3131 array(
3232 'gu_name' => $names,
3333 'lu_name=gu_name',
34 - 'lu_wiki' => wfWikiID()
 34+ 'lu_dbname' => wfWikiID()
3535 ), __METHOD__ );
3636 $this->globalData = array();
3737 foreach ( $caRes as $row ) {
Index: trunk/extensions/CentralAuth/CentralAuthUser.php
@@ -144,10 +144,10 @@
145145 $localuser = $dbr->tableName( 'localuser' );
146146
147147 $sql =
148 - "SELECT gu_id, lu_wiki, gu_salt, gu_password,gu_auth_token, " .
 148+ "SELECT gu_id, lu_dbname, gu_salt, gu_password,gu_auth_token, " .
149149 "gu_locked,gu_hidden,gu_registration,gu_email,gu_email_authenticated " .
150150 "FROM $globaluser " .
151 - "LEFT OUTER JOIN $localuser ON gu_name=lu_name AND lu_wiki=? " .
 151+ "LEFT OUTER JOIN $localuser ON gu_name=lu_name AND lu_dbname=? " .
152152 "WHERE gu_name=?";
153153 $result = $dbr->safeQuery( $sql, wfWikiID(), $this->mName );
154154 $row = $dbr->fetchObject( $result );
@@ -197,7 +197,7 @@
198198 protected function loadFromRow( $row, $fromMaster = false ) {
199199 if( $row ) {
200200 $this->mGlobalId = intval( $row->gu_id );
201 - $this->mIsAttached = ($row->lu_wiki !== null);
 201+ $this->mIsAttached = ($row->lu_dbname !== null);
202202 $this->mSalt = $row->gu_salt;
203203 $this->mPassword = $row->gu_password;
204204 $this->mAuthToken = $row->gu_auth_token;
@@ -427,7 +427,7 @@
428428 $tuples = array();
429429 foreach( $users as $name ) {
430430 $tuples[] = array(
431 - 'ln_wiki' => $wiki,
 431+ 'ln_dbname' => $wiki,
432432 'ln_name' => $name );
433433 }
434434 $dbw->insert(
@@ -809,7 +809,7 @@
810810 $dbcw->delete( 'localuser',
811811 array(
812812 'lu_name' => $this->mName,
813 - 'lu_wiki' => $wikiName ),
 813+ 'lu_dbname' => $wikiName ),
814814 __METHOD__ );
815815 if ( !$dbcw->affectedRows() ) {
816816 $wiki = WikiMap::getWiki( $wikiName );
@@ -909,7 +909,7 @@
910910 $dbw = self::getCentralDB();
911911 $dbw->insert( 'localuser',
912912 array(
913 - 'lu_wiki' => $wikiID,
 913+ 'lu_dbname' => $wikiID,
914914 'lu_name' => $this->mName ,
915915 'lu_attached_timestamp' => $dbw->timestamp(),
916916 'lu_attached_method' => $method ),
@@ -1051,17 +1051,17 @@
10521052 $dbw = self::getCentralDB();
10531053
10541054 $sql = "
1055 - SELECT ln_wiki
 1055+ SELECT ln_dbname
10561056 FROM localnames
10571057 LEFT OUTER JOIN localuser
1058 - ON ln_wiki=lu_wiki AND ln_name=lu_name
 1058+ ON ln_dbname=lu_dbname AND ln_name=lu_name
10591059 WHERE ln_name=? AND lu_name IS NULL
10601060 ";
10611061 $result = $dbw->safeQuery( $sql, $this->mName );
10621062
10631063 $dbs = array();
10641064 while( $row = $dbw->fetchObject( $result ) ) {
1065 - $dbs[] = $row->ln_wiki;
 1065+ $dbs[] = $row->ln_dbname;
10661066 }
10671067 $dbw->freeResult( $result );
10681068
@@ -1074,7 +1074,7 @@
10751075 $this->lazyImportLocalNames();
10761076 $dbw->insert( 'localnames',
10771077 array(
1078 - 'ln_wiki' => $wikiID,
 1078+ 'ln_dbname' => $wikiID,
10791079 'ln_name' => $this->mName ),
10801080 __METHOD__,
10811081 array( 'IGNORE' ) );
@@ -1087,7 +1087,7 @@
10881088 $this->lazyImportLocalNames();
10891089 $dbw->delete( 'localnames',
10901090 array(
1091 - 'ln_wiki' => $wikiID,
 1091+ 'ln_dbname' => $wikiID,
10921092 'ln_name' => $this->mName ),
10931093 __METHOD__ );
10941094 $dbw->commit();
@@ -1129,7 +1129,7 @@
11301130 __METHOD__ );
11311131 if( $id ) {
11321132 $rows[] = array(
1133 - 'ln_wiki' => $wikiID,
 1133+ 'ln_dbname' => $wikiID,
11341134 'ln_name' => $this->mName );
11351135 }
11361136 $lb->reuseConnection( $dbr );
@@ -1177,13 +1177,13 @@
11781178 $dbw = self::getCentralDB();
11791179
11801180 $result = $dbw->select( 'localuser',
1181 - array( 'lu_wiki' ),
 1181+ array( 'lu_dbname' ),
11821182 array( 'lu_name' => $this->mName ),
11831183 __METHOD__ );
11841184
11851185 $wikis = array();
11861186 while( $row = $result->fetchObject() ) {
1187 - $wikis[] = $row->lu_wiki;
 1187+ $wikis[] = $row->lu_dbname;
11881188 }
11891189 $dbw->freeResult( $result );
11901190
@@ -1217,7 +1217,7 @@
12181218 $result = $dbw->select(
12191219 'localuser',
12201220 array(
1221 - 'lu_wiki',
 1221+ 'lu_dbname',
12221222 'lu_attached_timestamp',
12231223 'lu_attached_method' ),
12241224 array(
@@ -1226,8 +1226,8 @@
12271227
12281228 $wikis = array();
12291229 while( $row = $dbw->fetchObject( $result ) ) {
1230 - $wikis[$row->lu_wiki] = array(
1231 - 'wiki' => $row->lu_wiki,
 1230+ $wikis[$row->lu_dbname] = array(
 1231+ 'wiki' => $row->lu_dbname,
12321232 'attachedTimestamp' => wfTimestampOrNull( TS_MW,
12331233 $row->lu_attached_timestamp ),
12341234 'attachedMethod' => $row->lu_attached_method,
Index: trunk/extensions/CentralAuth/SpecialGlobalUsers.php
@@ -76,7 +76,7 @@
7777 $conds[] = 'gu_name >= ' . $this->mDb->addQuotes( $this->mUsername );
7878
7979 return array(
80 - 'tables' => " (globaluser LEFT JOIN localuser ON gu_name = lu_name AND lu_wiki = '{$localwiki}') LEFT JOIN global_user_groups ON gu_id = gug_user ",
 80+ 'tables' => " (globaluser LEFT JOIN localuser ON gu_name = lu_name AND lu_dbname = '{$localwiki}') LEFT JOIN global_user_groups ON gu_id = gug_user ",
8181 'fields' => array( 'gu_id', 'gu_name', 'gu_locked', 'lu_attached_method', 'COUNT(gug_group) AS gug_numgroups', 'MAX(gug_group) AS gug_singlegroup' ),
8282 'conds' => $conds,
8383 'options' => array( 'GROUP BY' => 'gu_name' ),

Status & tagging log