Index: trunk/extensions/FlaggedRevs/specialpages/RatingHistory_body.php |
— | — | @@ -560,16 +560,18 @@ |
561 | 561 | __METHOD__, |
562 | 562 | array( 'ORDER BY' => 'rev_timestamp DESC' ) |
563 | 563 | ); |
| 564 | + // Fetch the list of users and how many votes they reviews |
564 | 565 | $res = $dbr->select( array( 'revision', 'reader_feedback', 'user' ), |
565 | | - array( 'rfb_user', 'rfb_ip', 'user_name', 'COUNT(*) as n' ), |
| 566 | + # COALESCE() gets the user_name for users, and the IP for anons |
| 567 | + array( 'rfb_user', 'COALESCE(user_name,rfb_ip) AS name', 'COUNT(rfb_rev_id) AS n' ), |
566 | 568 | array( 'rev_page' => $this->page->getArticleId(), |
567 | 569 | "rev_id = rfb_rev_id", |
568 | 570 | "rfb_timestamp >= $cutoff", |
569 | 571 | // Trigger INDEX usage |
570 | 572 | "rev_timestamp >= ".$dbr->addQuotes($firstRevTS) ), |
571 | 573 | __METHOD__, |
572 | | - array( 'GROUP BY' => 'rfb_user, rfb_ip', 'USE INDEX' => array('revision' => 'page_timestamp') ), |
573 | | - array( 'user' => array( 'LEFT JOIN', 'user_id = rfb_user') ) |
| 574 | + array( 'GROUP BY' => 'name', 'USE INDEX' => array('revision' => 'page_timestamp') ), |
| 575 | + array( 'user' => array( 'LEFT JOIN', 'rfb_user > 0 AND user_id = rfb_user') ) |
574 | 576 | ); |
575 | 577 | // Output multi-column list |
576 | 578 | $total = $res->numRows(); |
— | — | @@ -577,7 +579,8 @@ |
578 | 580 | $count = 0; |
579 | 581 | $html = "<table class='fr_reader_feedback_users'><tr>"; |
580 | 582 | while( $row = $res->fetchObject() ) { |
581 | | - $title = Title::makeTitleSafe( NS_USER, $row->rfb_user ? $row->user_name : $row->rfb_ip ); |
| 583 | + $title = Title::makeTitleSafe( NS_USER, $row->name ); |
| 584 | + if( is_null($title) ) continue; // bad IP? |
582 | 585 | $html .= '<td>'.$this->skin->makeLinkObj( $title, $title->getText() )." [{$row->n}]</td>"; |
583 | 586 | $count++; |
584 | 587 | if( $total > $count && ($count % $columns) == 0 ) { |