From 6a9e38321a1a55be2e98f1f0c8143a623b90acfc Mon Sep 17 00:00:00 2001 From: Greg Maxwell Date: Mon, 29 Oct 2007 19:39:33 +0000 Subject: [PATCH] Adjust "hide logged-in users" function in Special:Newpages to only display if the createpage permission is enabled by default. This avoids displaying a useless option on wikis with anonymous page creation disabled, and avoids a slow attempt to scan all of recent changes to fill a query limit that can't be met. --- includes/SpecialNewpages.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index d5305f5f0f..ab9271531f 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -30,7 +30,8 @@ class NewPagesPage extends QueryPage { } function makeUserWhere( &$dbo ) { - if ($this->hideliu) { + global $wgGroupPermissions; + if ($wgGroupPermissions['*']['createpage'] == true && $this->hideliu) { return ' AND rc_user = 0'; } else { $title = Title::makeTitleSafe( NS_USER, $this->username ); @@ -144,7 +145,7 @@ class NewPagesPage extends QueryPage { * @return string */ function getPageHeader() { - global $wgScript, $wgContLang; + global $wgScript, $wgContLang, $wgGroupPermissions; $align = $wgContLang->isRTL() ? 'left' : 'right'; $self = SpecialPage::getTitleFor( $this->getName() ); $form = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) . @@ -165,10 +166,14 @@ class NewPagesPage extends QueryPage { " . Xml::input( 'username', 30, $this->username, array( 'id' => 'mw-np-username' ) ) . " - + "; + if ($wgGroupPermissions['*']['createpage'] == true) { + $form = $form . " " . Xml::checkLabel( wfMsgHtml( 'rcshowhideliu', wfMsg( 'hide' ) ), 'hideliu', 'hideliu', $this->hideliu, array( 'id' => 'mw-np-hideliu' ) ) . " - + "; + } + $form = $form . " " . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . -- 2.20.1