Index: trunk/phase3/includes/specials/SpecialContributions.php |
— | — | @@ -34,17 +34,18 @@ |
35 | 35 | } |
36 | 36 | |
37 | 37 | function getQueryInfo() { |
38 | | - list( $index, $userCond ) = $this->getUserCond(); |
| 38 | + list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond(); |
39 | 39 | $conds = array_merge( array('page_id=rev_page'), $userCond, $this->getNamespaceCond() ); |
40 | 40 | $queryInfo = array( |
41 | | - 'tables' => array( 'page', 'revision' ), |
| 41 | + 'tables' => $tables, |
42 | 42 | 'fields' => array( |
43 | 43 | 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'rev_id', 'rev_page', |
44 | 44 | 'rev_text_id', 'rev_timestamp', 'rev_comment', 'rev_minor_edit', 'rev_user', |
45 | 45 | 'rev_user_text', 'rev_parent_id', 'rev_deleted' |
46 | 46 | ), |
47 | 47 | 'conds' => $conds, |
48 | | - 'options' => array( 'USE INDEX' => array('revision' => $index) ) |
| 48 | + 'options' => array( 'USE INDEX' => array('revision' => $index) ), |
| 49 | + 'join_conds' => $join_cond |
49 | 50 | ); |
50 | 51 | wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) ); |
51 | 52 | return $queryInfo; |
— | — | @@ -52,16 +53,21 @@ |
53 | 54 | |
54 | 55 | function getUserCond() { |
55 | 56 | $condition = array(); |
56 | | - |
| 57 | + $join_conds = array(); |
57 | 58 | if ( $this->target == 'newbies' ) { |
| 59 | + $tables = array( 'user_groups', 'page', 'revision' ); |
58 | 60 | $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ ); |
59 | 61 | $condition[] = 'rev_user >' . (int)($max - $max / 100); |
| 62 | + $condition[] = 'ug_group IS NULL'; |
60 | 63 | $index = 'user_timestamp'; |
| 64 | + # FIXME: other groups may have 'bot' rights |
| 65 | + $join_conds['user_groups'] = array( 'LEFT JOIN', "ug_user = rev_user AND ug_group = 'bot'" ); |
61 | 66 | } else { |
| 67 | + $tables = array( 'page', 'revision' ); |
62 | 68 | $condition['rev_user_text'] = $this->target; |
63 | 69 | $index = 'usertext_timestamp'; |
64 | 70 | } |
65 | | - return array( $index, $condition ); |
| 71 | + return array( $tables, $index, $condition, $join_conds ); |
66 | 72 | } |
67 | 73 | |
68 | 74 | function getNamespaceCond() { |