r29926 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r29925‎ | r29926 | r29927 >
Date:17:15, 18 January 2008
Author:vasilievvv
Status:old
Tags:
Comment:
* (bug 10049) Prefix index search and namespaces in Special:Withoutinterwiki
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialWithoutinterwiki.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialWithoutinterwiki.php
@@ -8,13 +8,41 @@
99 * @author Rob Church <robchur@gmail.com>
1010 */
1111 class WithoutInterwikiPage extends PageQueryPage {
 12+ private $prefix = '';
1213
1314 function getName() {
1415 return 'Withoutinterwiki';
1516 }
1617
1718 function getPageHeader() {
18 - return '<p>' . wfMsgExt( 'withoutinterwiki-header', array( 'parseinline' ) ) . '</p>';
 19+ global $wgScript, $wgContLang;
 20+ $prefix = $this->prefix;
 21+ $t = SpecialPage::getTitleFor( $this->getName() );
 22+ $align = $wgContLang->isRtl() ? 'left' : 'right';
 23+
 24+ $s = '<p>' . wfMsgExt( 'withoutinterwiki-header', array( 'parseinline' ) ) . '</p>';
 25+ $s .= Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) );
 26+ $s .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
 27+ $s .= Xml::hidden( 'title', $t->getPrefixedText() );
 28+ $s .= Xml::openElement( 'table', array( 'id' => 'nsselect', 'class' => 'withoutinterwiki' ) );
 29+ $s .= "<tr>
 30+ <td align='$align'>" .
 31+ Xml::label( wfMsg( 'allpagesprefix' ), 'wiprefix' ) .
 32+ "</td>
 33+ <td>" .
 34+ Xml::input( 'prefix', 20, htmlspecialchars ( $prefix ), array( 'id' => 'wiprefix' ) ) .
 35+ "</td>
 36+ </tr>
 37+ <tr>
 38+ <td align='$align'></td>
 39+ <td>" .
 40+ Xml::submitButton( wfMsgHtml( 'withoutinterwiki-submit' ) ) .
 41+ "</td>
 42+ </tr>";
 43+ $s .= Xml::closeElement( 'table' );
 44+ $s .= Xml::closeElement( 'form' );
 45+ $s .= Xml::closeElement( 'div' );
 46+ return $s;
1947 }
2048
2149 function sortDescending() {
@@ -32,6 +60,7 @@
3361 function getSQL() {
3462 $dbr = wfGetDB( DB_SLAVE );
3563 list( $page, $langlinks ) = $dbr->tableNamesN( 'page', 'langlinks' );
 64+ $prefix = $this->prefix ? "AND page_title LIKE '" . $dbr->escapeLike( $this->prefix ) . "%'" : '';
3665 return
3766 "SELECT 'Withoutinterwiki' AS type,
3867 page_namespace AS namespace,
@@ -42,14 +71,22 @@
4372 ON ll_from = page_id
4473 WHERE ll_title IS NULL
4574 AND page_namespace=" . NS_MAIN . "
46 - AND page_is_redirect = 0";
 75+ AND page_is_redirect = 0
 76+ {$prefix}";
4777 }
4878
 79+ function setPrefix( $prefix = '' ) {
 80+ $this->prefix = $prefix;
 81+ }
 82+
4983 }
5084
5185 function wfSpecialWithoutinterwiki() {
 86+ global $wgRequest;
5287 list( $limit, $offset ) = wfCheckLimits();
 88+ $prefix = $wgRequest->getVal( 'prefix' );
5389 $wip = new WithoutInterwikiPage();
 90+ $wip->setPrefix( $prefix );
5491 $wip->doQuery( $offset, $limit );
5592 }
5693
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1649,6 +1649,7 @@
16501650 'withoutinterwiki' => 'Pages without language links',
16511651 'withoutinterwiki-header' => 'The following pages do not link to other language versions:',
16521652 'withoutinterwiki-summary' => '', # only translate this message to other languages if you have to change it
 1653+'withoutinterwiki-submit' => 'Show',
16531654
16541655 'fewestrevisions' => 'Pages with the fewest revisions',
16551656 'fewestrevisions-summary' => '', # only translate this message to other languages if you have to change it
Index: trunk/phase3/RELEASE-NOTES
@@ -133,8 +133,8 @@
134134 * Add DBA caching to installer
135135 * (bug 18585) Added a bunch of parameters to the revertpage message
136136 * Support redirects in image namespace
 137+* (bug 10049) Prefix index search and namespaces in Special:Withoutinterwiki
137138
138 -
139139 === Bug fixes in 1.12 ===
140140
141141 * Subpages are now indexed for searching properly when using PostgreSQL

Status & tagging log