r57115 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57114‎ | r57115 | r57116 >
Date:16:19, 30 September 2009
Author:thomasv
Status:reverted (Comments)
Tags:
Comment:
search capability
Modified paths:
  • /trunk/extensions/ProofreadPage/ProofreadPage.i18n.php (modified) (history)
  • /trunk/extensions/ProofreadPage/SpecialProofreadPages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/ProofreadPage.i18n.php
@@ -68,6 +68,8 @@
6969 <td ><span id=pr_index style=\"visibility:hidden;\">$7</span></td>
7070 </tr></table>",
7171 'proofreadpage_pages' => "{{PLURAL:$1|page|pages}}",
 72+ 'proofreadpage_specialpage_text' => "",
 73+ 'proofreadpage_specialpage_legend' => "Search index pages",
7274 );
7375
7476 /** Message documentation (Message documentation)
Index: trunk/extensions/ProofreadPage/SpecialProofreadPages.php
@@ -17,10 +17,29 @@
1818 }
1919
2020 function execute( $parameters ) {
 21+ global $wgOut, $wgRequest, $wgDisableTextSearch;
 22+
2123 $this->setHeaders();
2224 list( $limit, $offset ) = wfCheckLimits();
 25+ $wgOut->addWikiText( wfMsgForContentNoTrans( 'proofreadpage_specialpage_text' ) );
2326
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 );
2544 $cnl->doQuery( $offset, $limit );
2645 }
2746 }
@@ -29,6 +48,10 @@
3049
3150 class ProofreadPagesQuery extends QueryPage {
3251
 52+ function ProofreadPagesQuery( $search ) {
 53+ $this->search = $search;
 54+ }
 55+
3356 function getName() {
3457 return 'IndexPages';
3558 }
@@ -45,18 +68,20 @@
4669 $dbr = wfGetDB( DB_SLAVE );
4770 $page = $dbr->tableName( 'page' );
4871 $pr_index = $dbr->tableName( 'pr_index' );
 72+ $searchindex = $dbr->tableName( 'searchindex' );
4973
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;
6186 }
6287
6388 function getOrder() {

Follow-up revisions

RevisionCommit summaryAuthorDate
r57123Follow-up r57115: Ignore new message for translatewiki...raymond17:54, 30 September 2009
r57173Revert r57115, r57123 "search capability"...brion23:16, 30 September 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   23:17, 30 September 2009

This is tied to the MySQL search backend's raw database tables, and would be completely useless on production Wikimedia sites or other sites using alternate search or database backends.

Status & tagging log