Index: branches/querypage-work2/extensions/ApprovedRevs/SpecialApprovedRevs.php |
— | — | @@ -135,10 +135,58 @@ |
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
| 139 | + function getQueryInfo() { |
| 140 | + if ( $this->mMode == 'notlatest' ) { |
| 141 | + return array( |
| 142 | + 'tables' => array( 'ar' => 'approved_revs', 'p' => 'page' ), |
| 143 | + 'fields' => array( |
| 144 | + 'p.page_id AS id', |
| 145 | + 'ar.rev_id AS rev_id', |
| 146 | + 'p.page_latest AS latest_id', |
| 147 | + ), |
| 148 | + 'join_conds' => array( |
| 149 | + 'page AS p' => array( |
| 150 | + 'JOIN', 'ar.page_id=p.page_id' |
| 151 | + ) |
| 152 | + ), |
| 153 | + 'conds' => array( 'p.page_latest != ar.rev_id') |
| 154 | + ); |
| 155 | + } elseif ( $this->mMode == 'unapproved' ) { |
| 156 | + return array( |
| 157 | + 'tables' => array( 'ar' => 'approve_revs', 'p' => 'page' ), |
| 158 | + 'fields' => array( 'p.page_id AS id' ), |
| 159 | + 'join_conds' => array( |
| 160 | + 'page AS p' => array( |
| 161 | + 'RIGHT OUTER JOIN', 'ar.page_id=p.page_id' |
| 162 | + ) |
| 163 | + ), |
| 164 | + 'conds' => array( "ar.page_id IS NULL" ) |
| 165 | + ); |
| 166 | + } else { // all approved pages |
| 167 | + return array( |
| 168 | + 'tables' => array( 'ar' => 'approved_revs', 'p' => 'page' ), |
| 169 | + 'fields' => array( |
| 170 | + 'p.page_id AS id', |
| 171 | + 'ar.rev_id AS rev_id', |
| 172 | + 'p.page_latest AS latest_id', |
| 173 | + ), |
| 174 | + 'join_conds' => array( |
| 175 | + 'page AS p' => array( |
| 176 | + 'JOIN', 'ar.page_id=p.page_id' |
| 177 | + ) |
| 178 | + ), |
| 179 | + ); |
| 180 | + } |
| 181 | + } |
| 182 | + |
139 | 183 | function getOrder() { |
140 | 184 | return ' ORDER BY p.page_namespace, p.page_title ASC'; |
141 | 185 | } |
142 | 186 | |
| 187 | + function getOrderFields() { |
| 188 | + return array( 'p.page_namespace', 'p.page_title' ); |
| 189 | + } |
| 190 | + |
143 | 191 | function formatResult( $skin, $result ) { |
144 | 192 | $title = Title::newFromId( $result->id ); |
145 | 193 | $pageLink = $skin->makeLinkObj( $title ); |