Index: trunk/phase3/maintenance/archives/patch-external_user.sql |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | CREATE TABLE /*_*/external_user ( |
3 | 3 | -- Foreign key to user_id |
4 | | - eu_wiki_id int unsigned NOT NULL PRIMARY KEY, |
| 4 | + eu_local_id int unsigned NOT NULL PRIMARY KEY, |
5 | 5 | |
6 | 6 | -- Some opaque identifier provided by the external database |
7 | 7 | eu_external_id varchar(255) binary NOT NULL |
Index: trunk/phase3/maintenance/archives/patch-eu_local_id.sql |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +ALTER TABLE /*_*/external_user |
| 3 | +CHANGE COLUMN eu_wiki_id |
| 4 | +eu_local_id int unsigned NOT NULL; |
Property changes on: trunk/phase3/maintenance/archives/patch-eu_local_id.sql |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 5 | + native |
Index: trunk/phase3/maintenance/postgres/tables.sql |
— | — | @@ -201,7 +201,7 @@ |
202 | 202 | CREATE INDEX externallinks_index ON externallinks (el_index); |
203 | 203 | |
204 | 204 | CREATE TABLE external_user ( |
205 | | - eu_wiki_id INTEGER NOT NULL PRIMARY KEY, |
| 205 | + eu_local_id INTEGER NOT NULL PRIMARY KEY, |
206 | 206 | eu_external_id TEXT |
207 | 207 | ); |
208 | 208 | |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -165,6 +165,9 @@ |
166 | 166 | array( 'add_index', 'log_search', 'ls_field_val', 'patch-log_search-rename-index.sql' ), |
167 | 167 | array( 'add_index', 'change_tag', 'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ), |
168 | 168 | array( 'add_field', 'redirect', 'rd_interwiki', 'patch-rd_interwiki.sql' ), |
| 169 | + // A field changed name mid-release cycle, so fix it for anyone using |
| 170 | + // trunk |
| 171 | + array( 'rename_eu_wiki_id' ), |
169 | 172 | ), |
170 | 173 | |
171 | 174 | 'sqlite' => array( |
— | — | @@ -1328,6 +1331,17 @@ |
1329 | 1332 | wfOut( "Done populating log_search table.\n" ); |
1330 | 1333 | } |
1331 | 1334 | |
| 1335 | +function rename_eu_wiki_id() { |
| 1336 | + global $wgDatabase; |
| 1337 | + wfOut( "Renaming eu_wiki_id -> eu_local_id... " ); |
| 1338 | + if ( $wgDatabase->fieldExists( 'external_user', 'eu_local_id' ) ) { |
| 1339 | + wfOut( "already done.\n" ); |
| 1340 | + return; |
| 1341 | + } |
| 1342 | + $wgDatabase->sourceFile( archive( 'patch-eu_local_id.sql' ) ); |
| 1343 | + wfOut( "ok\n" ); |
| 1344 | +} |
| 1345 | + |
1332 | 1346 | /*********************************************************************** |
1333 | 1347 | * Start PG stuff |
1334 | 1348 | * TODO: merge with above |
Index: trunk/phase3/maintenance/ibm_db2/tables.sql |
— | — | @@ -248,16 +248,16 @@ |
249 | 249 | -- |
250 | 250 | CREATE TABLE external_user ( |
251 | 251 | -- Foreign key to user_id |
252 | | - eu_wiki_id BIGINT NOT NULL PRIMARY KEY, |
| 252 | + eu_local_id BIGINT NOT NULL PRIMARY KEY, |
253 | 253 | |
254 | 254 | -- Some opaque identifier provided by the external database |
255 | 255 | eu_external_id VARCHAR(255) NOT NULL |
256 | 256 | ); |
257 | 257 | CREATE UNIQUE INDEX eu_external_id_idx |
258 | 258 | ON external_user (eu_external_id) |
259 | | - INCLUDE (eu_wiki_id); |
260 | | -CREATE UNIQUE INDEX eu_wiki_id_idx |
261 | | - ON external_user (eu_wiki_id) |
| 259 | + INCLUDE (eu_local_id); |
| 260 | +CREATE UNIQUE INDEX eu_local_id_idx |
| 261 | + ON external_user (eu_local_id) |
262 | 262 | INCLUDE (eu_external_id); |
263 | 263 | |
264 | 264 | |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -580,7 +580,7 @@ |
581 | 581 | -- |
582 | 582 | CREATE TABLE /*_*/external_user ( |
583 | 583 | -- Foreign key to user_id |
584 | | - eu_wiki_id int unsigned NOT NULL PRIMARY KEY, |
| 584 | + eu_local_id int unsigned NOT NULL PRIMARY KEY, |
585 | 585 | |
586 | 586 | -- Some opaque identifier provided by the external database |
587 | 587 | eu_external_id varchar(255) binary NOT NULL |
Index: trunk/phase3/includes/ExternalUser.php |
— | — | @@ -105,7 +105,7 @@ |
106 | 106 | |
107 | 107 | $dbr = wfGetDB( DB_SLAVE ); |
108 | 108 | $id = $dbr->selectField( 'external_user', 'eu_external_id', |
109 | | - array( 'eu_wiki_id' => $user->getId() ), __METHOD__ ); |
| 109 | + array( 'eu_local_id' => $user->getId() ), __METHOD__ ); |
110 | 110 | if ( $id === false ) { |
111 | 111 | return false; |
112 | 112 | } |
— | — | @@ -242,7 +242,7 @@ |
243 | 243 | * @param $pref string |
244 | 244 | * @return mixed String or false |
245 | 245 | */ |
246 | | - public static function prefMessage( $pref ) { |
| 246 | + public static function getPrefMessage( $pref ) { |
247 | 247 | return false; |
248 | 248 | } |
249 | 249 | |
— | — | @@ -277,11 +277,11 @@ |
278 | 278 | * |
279 | 279 | * @param $id int user_id |
280 | 280 | */ |
281 | | - public final function link( $id ) { |
| 281 | + public final function linkToLocal( $id ) { |
282 | 282 | $dbw = wfGetDB( DB_MASTER ); |
283 | 283 | $dbw->replace( 'external_user', |
284 | | - array( 'eu_wiki_id', 'eu_external_id' ), |
285 | | - array( 'eu_wiki_id' => $id, |
| 284 | + array( 'eu_local_id', 'eu_external_id' ), |
| 285 | + array( 'eu_local_id' => $id, |
286 | 286 | 'eu_external_id' => $this->getId() ), |
287 | 287 | __METHOD__ ); |
288 | 288 | } |
— | — | @@ -299,8 +299,8 @@ |
300 | 300 | array( 'eu_external_id' => $this->getId() ) |
301 | 301 | ); |
302 | 302 | return $row |
303 | | - ? User::newFromId( $row->eu_wiki_id ) |
| 303 | + ? User::newFromId( $row->eu_local_id ) |
304 | 304 | : null; |
305 | 305 | } |
306 | 306 | |
307 | | -} |
\ No newline at end of file |
| 307 | +} |
Index: trunk/phase3/includes/specials/SpecialUserlogin.php |
— | — | @@ -371,7 +371,7 @@ |
372 | 372 | $wgAuth->initUser( $u, $autocreate ); |
373 | 373 | |
374 | 374 | if ( $this->mExtUser ) { |
375 | | - $this->mExtUser->link( $u->getId() ); |
| 375 | + $this->mExtUser->linkToLocal( $u->getId() ); |
376 | 376 | $email = $this->mExtUser->getPref( 'emailaddress' ); |
377 | 377 | if ( $email && !$this->mEmail ) { |
378 | 378 | $u->setEmail( $email ); |