Index: trunk/phase3/includes/revisiondelete/RevisionDelete.php |
— | — | @@ -25,14 +25,17 @@ |
26 | 26 | */ |
27 | 27 | public function doQuery( $db ) { |
28 | 28 | $ids = array_map( 'intval', $this->ids ); |
29 | | - $live = $db->select( array('revision','page'), '*', |
| 29 | + $live = $db->select( |
| 30 | + array( 'revision', 'page', 'user' ), |
| 31 | + array_merge( Revision::selectFields(), Revision::selectUserFields() ), |
30 | 32 | array( |
31 | 33 | 'rev_page' => $this->title->getArticleID(), |
32 | 34 | 'rev_id' => $ids, |
33 | | - 'rev_page = page_id' |
34 | 35 | ), |
35 | 36 | __METHOD__, |
36 | | - array( 'ORDER BY' => 'rev_id DESC' ) |
| 37 | + array( 'ORDER BY' => 'rev_id DESC' ), |
| 38 | + array( 'page' => array( 'INNER JOIN', 'rev_page = page_id' ), |
| 39 | + 'user' => array( 'LEFT JOIN', 'user_id = rev_user' ) ) |
37 | 40 | ); |
38 | 41 | |
39 | 42 | if ( $live->numRows() >= count( $ids ) ) { |
— | — | @@ -128,7 +131,7 @@ |
129 | 132 | } |
130 | 133 | |
131 | 134 | public function getAuthorNameField() { |
132 | | - return 'rev_user_text'; |
| 135 | + return 'rev_user_name'; // see Revision::selectUserFields() |
133 | 136 | } |
134 | 137 | |
135 | 138 | public function canView() { |
Index: trunk/phase3/includes/HistoryPage.php |
— | — | @@ -342,13 +342,15 @@ |
343 | 343 | |
344 | 344 | function getQueryInfo() { |
345 | 345 | $queryInfo = array( |
346 | | - 'tables' => array( 'revision' ), |
347 | | - 'fields' => Revision::selectFields(), |
| 346 | + 'tables' => array( 'revision', 'user' ), |
| 347 | + 'fields' => array_merge( Revision::selectFields(), Revision::selectUserFields() ), |
348 | 348 | 'conds' => array_merge( |
349 | 349 | array( 'rev_page' => $this->title->getArticleID() ), |
350 | 350 | $this->conds ), |
351 | 351 | 'options' => array( 'USE INDEX' => array( 'revision' => 'page_timestamp' ) ), |
352 | | - 'join_conds' => array( 'tag_summary' => array( 'LEFT JOIN', 'ts_rev_id=rev_id' ) ), |
| 352 | + 'join_conds' => array( |
| 353 | + 'user' => array( 'LEFT JOIN', 'rev_user != 0 AND user_id = rev_user' ), |
| 354 | + 'tag_summary' => array( 'LEFT JOIN', 'ts_rev_id=rev_id' ) ), |
353 | 355 | ); |
354 | 356 | ChangeTags::modifyDisplayQuery( |
355 | 357 | $queryInfo['tables'], |
Index: trunk/phase3/includes/specials/SpecialContributions.php |
— | — | @@ -470,16 +470,20 @@ |
471 | 471 | $conds[] = $this->mDb->bitAnd('rev_deleted',Revision::SUPPRESSED_USER) . |
472 | 472 | ' != ' . Revision::SUPPRESSED_USER; |
473 | 473 | } |
474 | | - $join_cond['page'] = array( 'INNER JOIN', 'page_id=rev_page' ); |
475 | 474 | |
| 475 | + # Don't include orphaned revisions |
| 476 | + $join_cond['page'] = array( 'INNER JOIN', 'page_id = rev_page' ); |
| 477 | + # Get the current user name for accounts |
| 478 | + $join_cond['user'] = array( 'LEFT JOIN', 'rev_user != 0 AND user_id = rev_user' ); |
| 479 | + |
476 | 480 | $queryInfo = array( |
477 | 481 | 'tables' => $tables, |
478 | | - 'fields' => array( |
| 482 | + 'fields' => array_merge( Revision::selectUserFields(), array( |
479 | 483 | 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect', |
480 | | - 'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment', |
| 484 | + 'page_len', 'rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment', |
481 | 485 | 'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted', |
482 | | - 'rev_len', 'rev_parent_id' |
483 | | - ), |
| 486 | + 'rev_len' |
| 487 | + ) ), |
484 | 488 | 'conds' => $conds, |
485 | 489 | 'options' => array( 'USE INDEX' => array('revision' => $index) ), |
486 | 490 | 'join_conds' => $join_cond |
— | — | @@ -501,8 +505,9 @@ |
502 | 506 | function getUserCond() { |
503 | 507 | $condition = array(); |
504 | 508 | $join_conds = array(); |
| 509 | + $tables = array( 'revision', 'page', 'user' ); |
505 | 510 | if( $this->target == 'newbies' ) { |
506 | | - $tables = array( 'user_groups', 'page', 'revision' ); |
| 511 | + $tables[] = 'user_groups'; |
507 | 512 | $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ ); |
508 | 513 | $condition[] = 'rev_user >' . (int)($max - $max / 100); |
509 | 514 | $condition[] = 'ug_group IS NULL'; |
— | — | @@ -510,9 +515,13 @@ |
511 | 516 | # @todo FIXME: Other groups may have 'bot' rights |
512 | 517 | $join_conds['user_groups'] = array( 'LEFT JOIN', "ug_user = rev_user AND ug_group = 'bot'" ); |
513 | 518 | } else { |
514 | | - $tables = array( 'page', 'revision' ); |
515 | | - $condition['rev_user_text'] = $this->target; |
516 | | - $index = 'usertext_timestamp'; |
| 519 | + if ( IP::isIPAddress( $this->target ) ) { |
| 520 | + $condition['rev_user_text'] = $this->target; |
| 521 | + $index = 'usertext_timestamp'; |
| 522 | + } else { |
| 523 | + $condition['rev_user'] = User::idFromName( $this->target ); |
| 524 | + $index = 'user_timestamp'; |
| 525 | + } |
517 | 526 | } |
518 | 527 | if( $this->deletedOnly ) { |
519 | 528 | $condition[] = "rev_deleted != '0'"; |
— | — | @@ -661,9 +670,12 @@ |
662 | 671 | $d = '<span class="history-deleted">' . $d . '</span>'; |
663 | 672 | } |
664 | 673 | |
| 674 | + # Show user names for /newbies as there may be different users. |
| 675 | + # Note that we already excluded rows with hidden user names. |
665 | 676 | if( $this->target == 'newbies' ) { |
666 | | - $userlink = ' . . ' . Linker::userLink( $row->rev_user, $row->rev_user_text ); |
667 | | - $userlink .= ' ' . wfMsg( 'parentheses', Linker::userTalkLink( $row->rev_user, $row->rev_user_text ) ) . ' '; |
| 677 | + $userlink = ' . . ' . Linker::userLink( $rev->getUser(), $rev->getUserText() ); |
| 678 | + $userlink .= ' ' . wfMsg( 'parentheses', |
| 679 | + Linker::userTalkLink( $rev->getUser(), $rev->getUserText() ) ) . ' '; |
668 | 680 | } else { |
669 | 681 | $userlink = ''; |
670 | 682 | } |
Index: trunk/phase3/includes/specials/SpecialMergeHistory.php |
— | — | @@ -479,16 +479,14 @@ |
480 | 480 | function getQueryInfo() { |
481 | 481 | $conds = $this->mConds; |
482 | 482 | $conds['rev_page'] = $this->articleID; |
483 | | - $conds[] = 'page_id = rev_page'; |
484 | 483 | $conds[] = "rev_timestamp < {$this->maxTimestamp}"; |
485 | 484 | return array( |
486 | | - 'tables' => array( 'revision', 'page' ), |
487 | | - 'fields' => array( |
488 | | - 'rev_minor_edit', 'rev_timestamp', 'rev_user', 'rev_user_text', |
489 | | - 'rev_comment', 'rev_id', 'rev_page', 'rev_parent_id', |
490 | | - 'rev_text_id', 'rev_len', 'rev_deleted' |
491 | | - ), |
492 | | - 'conds' => $conds |
| 485 | + 'tables' => array( 'revision', 'page', 'user' ), |
| 486 | + 'fields' => array_merge( Revision::selectFields(), Revision::selectUserFields() ), |
| 487 | + 'conds' => $conds, |
| 488 | + 'join_conds' => array( |
| 489 | + 'page' => array( 'INNER JOIN', 'rev_page = page_id' ), |
| 490 | + 'user' => array( 'LEFT JOIN', 'user_id = rev_user' ) ) |
493 | 491 | ); |
494 | 492 | } |
495 | 493 | |
Index: trunk/phase3/includes/RevisionList.php |
— | — | @@ -250,19 +250,18 @@ |
251 | 251 | * @return mixed |
252 | 252 | */ |
253 | 253 | public function doQuery( $db ) { |
254 | | - $conds = array( |
255 | | - 'rev_page' => $this->title->getArticleID(), |
256 | | - 'rev_page = page_id' |
257 | | - ); |
| 254 | + $conds = array( 'rev_page' => $this->title->getArticleID() ); |
258 | 255 | if ( $this->ids !== null ) { |
259 | 256 | $conds['rev_id'] = array_map( 'intval', $this->ids ); |
260 | 257 | } |
261 | 258 | return $db->select( |
262 | | - array( 'revision', 'page' ), |
263 | | - '*', |
| 259 | + array( 'revision', 'page', 'user' ), |
| 260 | + array_merge( Revision::selectFields(), Revision::selectUserFields() ), |
264 | 261 | $conds, |
265 | 262 | __METHOD__, |
266 | | - array( 'ORDER BY' => 'rev_id DESC' ) |
| 263 | + array( 'ORDER BY' => 'rev_id DESC' ), |
| 264 | + array( 'page' => array( 'INNER JOIN', 'rev_page = page_id' ), |
| 265 | + 'user' => array( 'LEFT JOIN', 'user_id = rev_user' ) ) |
267 | 266 | ); |
268 | 267 | } |
269 | 268 | |
— | — | @@ -296,7 +295,7 @@ |
297 | 296 | } |
298 | 297 | |
299 | 298 | public function getAuthorNameField() { |
300 | | - return 'rev_user_text'; |
| 299 | + return 'rev_user_name'; // see Revision::selectUserFields() |
301 | 300 | } |
302 | 301 | |
303 | 302 | public function canView() { |