r27024 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r27023‎ | r27024 | r27025 >
Date:19:39, 29 October 2007
Author:gmaxwell
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/SpecialNewpages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialNewpages.php
@@ -30,7 +30,8 @@
3131 }
3232
3333 function makeUserWhere( &$dbo ) {
34 - if ($this->hideliu) {
 34+ global $wgGroupPermissions;
 35+ if ($wgGroupPermissions['*']['createpage'] == true && $this->hideliu) {
3536 return ' AND rc_user = 0';
3637 } else {
3738 $title = Title::makeTitleSafe( NS_USER, $this->username );
@@ -144,7 +145,7 @@
145146 * @return string
146147 */
147148 function getPageHeader() {
148 - global $wgScript, $wgContLang;
 149+ global $wgScript, $wgContLang, $wgGroupPermissions;
149150 $align = $wgContLang->isRTL() ? 'left' : 'right';
150151 $self = SpecialPage::getTitleFor( $this->getName() );
151152 $form = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
@@ -165,10 +166,14 @@
166167 <td>" .
167168 Xml::input( 'username', 30, $this->username, array( 'id' => 'mw-np-username' ) ) .
168169 "</td>
169 - </tr><tr>
 170+ </tr>";
 171+ if ($wgGroupPermissions['*']['createpage'] == true) {
 172+ $form = $form . "<tr><td></td>
170173 <td colspan=\"2\">" . Xml::checkLabel( wfMsgHtml( 'rcshowhideliu', wfMsg( 'hide' ) ),
171174 'hideliu', 'hideliu', $this->hideliu, array( 'id' => 'mw-np-hideliu' ) ) . "
172 - </td></tr>
 175+ </td></tr>";
 176+ }
 177+ $form = $form . "
173178 <tr> <td></td>
174179 <td>" .
175180 Xml::submitButton( wfMsg( 'allpagessubmit' ) ) .

Status & tagging log