From: Rob Church Date: Tue, 5 Jun 2007 00:50:46 +0000 (+0000) Subject: * (bug 9898) Allow viewing all namespaces in Special:Newpages X-Git-Tag: 1.31.0-rc.0~52681 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=8ec0a2350ebc1da62606e311f7c87db5e5959cf7;p=lhc%2Fweb%2Fwiklou.git * (bug 9898) Allow viewing all namespaces in Special:Newpages * Removed some bizarre behaviour in Xml::namespaceSelector() that stopped non-numeric indexes working for the "all namespace" option --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a4f08c252e..3d16fe0140 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -54,6 +54,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 7691) Show relevant lines from the deletion log when viewing a non-existent article or re-creating a previously-deleted article * Added variables 'wgRestrictionEdit' and 'wgRestrictionMove' for JS to header +* (bug 9898) Allow viewing all namespaces in Special:Newpages == Bugfixes since 1.10 == diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index 48037a7347..f329a7d9fe 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -36,12 +36,19 @@ class NewPagesPage extends QueryPage { } } + private function makeNamespaceWhere() { + return $this->namespace !== 'all' + ? ' AND rc_namespace = ' . intval( $this->namespace ) + : ''; + } + function getSQL() { global $wgUser, $wgUseRCPatrol; $usepatrol = ( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0; $dbr = wfGetDB( DB_SLAVE ); list( $recentchanges, $page ) = $dbr->tableNamesN( 'recentchanges', 'page' ); + $nsfilter = $this->makeNamespaceWhere(); $uwhere = $this->makeUserWhere( $dbr ); # FIXME: text will break with compression @@ -62,7 +69,8 @@ class NewPagesPage extends QueryPage { page_latest as rev_id FROM $recentchanges,$page WHERE rc_cur_id=page_id AND rc_new=1 - AND rc_namespace=" . $this->namespace . " AND page_is_redirect=0 + {$nsfilter} + AND page_is_redirect = 0 {$uwhere}"; } @@ -134,7 +142,7 @@ class NewPagesPage extends QueryPage { $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) ); # Namespace selector $form .= ''; - $form .= ''; + $form .= ''; # Username filter $form .= ''; $form .= ''; @@ -186,7 +194,7 @@ function wfSpecialNewpages($par, $specialPage) { } } } else { - if( $ns = $wgRequest->getInt( 'namespace', 0 ) ) + if( $ns = $wgRequest->getText( 'namespace', NS_MAIN ) ) $namespace = $ns; if( $un = $wgRequest->getText( 'username' ) ) $username = $un; diff --git a/includes/Xml.php b/includes/Xml.php index 146232ac67..b7a035ab26 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -100,15 +100,8 @@ class Xml { */ public static function namespaceSelector($selected = '', $allnamespaces = null, $includehidden=false) { global $wgContLang; - if( $selected !== '' ) { - if( is_null( $selected ) ) { - // No namespace selected; let exact match work without hitting Main - $selected = ''; - } else { - // Let input be numeric strings without breaking the empty match. - $selected = intval( $selected ); - } - } + if( is_null( $selected ) ) + $selected = ''; $s = "\n
' . Xml::label( wfMsg( 'namespace' ), 'namespace' ) . '' . Xml::namespaceSelector( $this->namespace ) . '
' . Xml::namespaceSelector( $this->namespace, 'all' ) . '
' . Xml::label( wfMsg( 'newpages-username' ), 'mw-np-username' ) . '' . Xml::input( 'username', 30, $this->username, array( 'id' => 'mw-np-username' ) ) . '