Index: branches/querypage-work2/extensions/ProofreadPage/SpecialProofreadPages.php |
— | — | @@ -5,7 +5,8 @@ |
6 | 6 | */ |
7 | 7 | |
8 | 8 | class ProofreadPages extends QueryPage { |
9 | | - |
| 9 | + protected $index_namespace, $searchTerm; |
| 10 | + |
10 | 11 | public function __construct( $name = 'IndexPages' ) { |
11 | 12 | parent::__construct( $name ); |
12 | 13 | $this->index_namespace = wfMsgForContent( 'proofreadpage_index_namespace' ); |
— | — | @@ -18,25 +19,25 @@ |
19 | 20 | list( $limit, $offset ) = wfCheckLimits(); |
20 | 21 | $wgOut->addWikiText( wfMsgForContentNoTrans( 'proofreadpage_specialpage_text' ) ); |
21 | 22 | $searchList = array(); |
22 | | - $searchTerm = $wgRequest->getText( 'key' ); |
| 23 | + $this->searchTerm = $wgRequest->getText( 'key' ); |
23 | 24 | if( !$wgDisableTextSearch ) { |
24 | 25 | $wgOut->addHTML( |
25 | 26 | Xml::openElement( 'form' ) . |
26 | 27 | Xml::openElement( 'fieldset' ) . |
27 | 28 | Xml::element( 'legend', null, wfMsg( 'proofreadpage_specialpage_legend' ) ) . |
28 | | - Xml::input( 'key', 20, $searchTerm ) . ' ' . |
| 29 | + Xml::input( 'key', 20, $this->searchTerm ) . ' ' . |
29 | 30 | Xml::submitButton( wfMsg( 'ilsubmit' ) ) . |
30 | 31 | Xml::closeElement( 'fieldset' ) . |
31 | 32 | Xml::closeElement( 'form' ) |
32 | 33 | ); |
33 | | - if( $searchTerm ) { |
| 34 | + if( $this->searchTerm ) { |
34 | 35 | $index_namespace = $this->index_namespace; |
35 | 36 | $index_ns_index = MWNamespace::getCanonicalIndex( strtolower( $index_namespace ) ); |
36 | 37 | $searchEngine = SearchEngine::create(); |
37 | 38 | $searchEngine->setLimitOffset( $limit, $offset ); |
38 | 39 | $searchEngine->setNamespaces( array( $index_ns_index ) ); |
39 | 40 | $searchEngine->showRedirects = false; |
40 | | - $textMatches = $searchEngine->searchText( $searchTerm ); |
| 41 | + $textMatches = $searchEngine->searchText( $this->searchTerm ); |
41 | 42 | $escIndex = preg_quote( $index_namespace, '/' ); |
42 | 43 | while( $result = $textMatches->next() ) { |
43 | 44 | if ( preg_match( "/^$escIndex:(.*)$/", $result->getTitle(), $m ) ) { |
— | — | @@ -74,7 +75,7 @@ |
75 | 76 | } |
76 | 77 | return array( |
77 | 78 | 'tables' => array( 'pr_index', 'page' ), |
78 | | - 'fields' => array( 'page_title AS title', 'pr_count', |
| 79 | + 'fields' => array( 'page_title AS title', '2*pr_q4+pr_q3 AS value', 'pr_count', |
79 | 80 | 'pr_q0', 'pr_q1', 'pr_q2' ,'pr_q3', 'pr_q4' ), |
80 | 81 | 'conds' => $conds, |
81 | 82 | 'options' => array(), |
— | — | @@ -82,11 +83,6 @@ |
83 | 84 | ); |
84 | 85 | } |
85 | 86 | |
86 | | - function getOrder() { |
87 | | - return ' ORDER BY 2*pr_q4+pr_q3 ' . |
88 | | - ( $this->sortDescending() ? 'DESC' : '' ); // FIXME: This causes a filesort |
89 | | - } |
90 | | - |
91 | 87 | function sortDescending() { |
92 | 88 | return true; |
93 | 89 | } |