Index: trunk/extensions/ProofreadPage/ProofreadPage.i18n.php |
— | — | @@ -68,6 +68,8 @@ |
69 | 69 | <td ><span id=pr_index style=\"visibility:hidden;\">$7</span></td> |
70 | 70 | </tr></table>", |
71 | 71 | 'proofreadpage_pages' => "{{PLURAL:$1|page|pages}}", |
| 72 | + 'proofreadpage_specialpage_text' => "", |
| 73 | + 'proofreadpage_specialpage_legend' => "Search index pages", |
72 | 74 | ); |
73 | 75 | |
74 | 76 | /** Message documentation (Message documentation) |
Index: trunk/extensions/ProofreadPage/SpecialProofreadPages.php |
— | — | @@ -17,10 +17,29 @@ |
18 | 18 | } |
19 | 19 | |
20 | 20 | function execute( $parameters ) { |
| 21 | + global $wgOut, $wgRequest, $wgDisableTextSearch; |
| 22 | + |
21 | 23 | $this->setHeaders(); |
22 | 24 | list( $limit, $offset ) = wfCheckLimits(); |
| 25 | + $wgOut->addWikiText( wfMsgForContentNoTrans( 'proofreadpage_specialpage_text' ) ); |
23 | 26 | |
24 | | - $cnl = new ProofreadPagesQuery(); |
| 27 | + if( $wgDisableTextSearch ) { |
| 28 | + $search = false; |
| 29 | + } else { |
| 30 | + $search = $wgRequest->getText( 'key' ); |
| 31 | + $wgOut->addHTML( |
| 32 | + Xml::openElement( 'form', array( 'id' => 'specialmimesearch', 'method' => 'get', 'action' => SpecialPage::getTitleFor( 'IndexPages' )->getLocalUrl() ) ) . |
| 33 | + Xml::openElement( 'fieldset' ) . |
| 34 | + Xml::hidden( 'title', SpecialPage::getTitleFor( 'IndexPages' )->getPrefixedText() ) . |
| 35 | + Xml::element( 'legend', null, wfMsg( 'proofreadpage_specialpage_legend' ) ) . |
| 36 | + Xml::input( 'key', 20, $search ) . ' ' . |
| 37 | + Xml::submitButton( wfMsg( 'ilsubmit' ) ) . |
| 38 | + Xml::closeElement( 'fieldset' ) . |
| 39 | + Xml::closeElement( 'form' ) |
| 40 | + ); |
| 41 | + } |
| 42 | + |
| 43 | + $cnl = new ProofreadPagesQuery( $search ); |
25 | 44 | $cnl->doQuery( $offset, $limit ); |
26 | 45 | } |
27 | 46 | } |
— | — | @@ -29,6 +48,10 @@ |
30 | 49 | |
31 | 50 | class ProofreadPagesQuery extends QueryPage { |
32 | 51 | |
| 52 | + function ProofreadPagesQuery( $search ) { |
| 53 | + $this->search = $search; |
| 54 | + } |
| 55 | + |
33 | 56 | function getName() { |
34 | 57 | return 'IndexPages'; |
35 | 58 | } |
— | — | @@ -45,18 +68,20 @@ |
46 | 69 | $dbr = wfGetDB( DB_SLAVE ); |
47 | 70 | $page = $dbr->tableName( 'page' ); |
48 | 71 | $pr_index = $dbr->tableName( 'pr_index' ); |
| 72 | + $searchindex = $dbr->tableName( 'searchindex' ); |
49 | 73 | |
50 | | - return |
51 | | - "SELECT pr_page_id as title, |
52 | | - page_title as title, |
53 | | - pr_count, |
54 | | - pr_q0, |
55 | | - pr_q1, |
56 | | - pr_q2, |
57 | | - pr_q3, |
58 | | - pr_q4 |
59 | | - FROM $pr_index |
60 | | - LEFT JOIN $page ON page_id = pr_page_id"; |
| 74 | + if($this->search) { |
| 75 | + $query = "SELECT page_title as title, |
| 76 | + pr_count,pr_q0,pr_q1,pr_q2,pr_q3,pr_q4 |
| 77 | + FROM $pr_index LEFT JOIN $page ON page_id = pr_page_id |
| 78 | + LEFT JOIN $searchindex ON si_page = pr_page_id |
| 79 | + WHERE match (si_text) against ('". $dbr->strencode( $this->search ) ."')"; |
| 80 | + } else { |
| 81 | + $query = "SELECT page_title as title, |
| 82 | + pr_count,pr_q0,pr_q1,pr_q2,pr_q3,pr_q4 |
| 83 | + FROM $pr_index LEFT JOIN $page ON page_id = pr_page_id"; |
| 84 | + } |
| 85 | + return $query; |
61 | 86 | } |
62 | 87 | |
63 | 88 | function getOrder() { |