r86048 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86047‎ | r86048 | r86049 >
Date:13:27, 14 April 2011
Author:happy-melon
Status:resolved (Comments)
Tags:
Comment:
Recommit r84805, but without removing UsersPager, which is actually a Good Thing to use for this class of queries. Yay for the end of global-function-based special pages in core. About fifteen left in extensions now...
Modified paths:
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialListusers.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/AutoLoader.php
@@ -690,6 +690,7 @@
691691 'SpecialImport' => 'includes/specials/SpecialImport.php',
692692 'SpecialListFiles' => 'includes/specials/SpecialListfiles.php',
693693 'SpecialListGroupRights' => 'includes/specials/SpecialListgrouprights.php',
 694+ 'SpecialListUsers' => 'includes/specials/SpecialListusers.php',
694695 'SpecialLockdb' => 'includes/specials/SpecialLockdb.php',
695696 'SpecialLog' => 'includes/specials/SpecialLog.php',
696697 'SpecialMergeHistory' => 'includes/specials/SpecialMergeHistory.php',
Index: trunk/phase3/includes/specials/SpecialListusers.php
@@ -272,25 +272,42 @@
273273 }
274274
275275 /**
276 - * constructor
277 - * $par string (optional) A group to list users from
 276+ * @ingroup SpecialPage
278277 */
279 -function wfSpecialListusers( $par = null ) {
280 - global $wgOut;
 278+class SpecialListUsers extends SpecialPage {
281279
282 - $up = new UsersPager($par);
 280+ /**
 281+ * Constructor
 282+ */
 283+ public function __construct() {
 284+ parent::__construct( 'Listusers' );
 285+ }
283286
284 - # getBody() first to check, if empty
285 - $usersbody = $up->getBody();
286 - $s = Xml::openElement( 'div', array('class' => 'mw-spcontent') );
287 - $s .= $up->getPageHeader();
288 - if( $usersbody ) {
289 - $s .= $up->getNavigationBar();
290 - $s .= '<ul>' . $usersbody . '</ul>';
291 - $s .= $up->getNavigationBar() ;
292 - } else {
293 - $s .= '<p>' . wfMsgHTML('listusers-noresult') . '</p>';
294 - };
295 - $s .= Xml::closeElement( 'div' );
296 - $wgOut->addHTML( $s );
 287+ /**
 288+ * Show the special page
 289+ *
 290+ * @param $par string (optional) A group to list users from
 291+ */
 292+ public function execute( $par ) {
 293+ global $wgOut;
 294+
 295+ $this->setHeaders();
 296+ $this->outputHeader();
 297+
 298+ $up = new UsersPager( $par );
 299+
 300+ # getBody() first to check, if empty
 301+ $usersbody = $up->getBody();
 302+
 303+ $s = $up->getPageHeader();
 304+ if( $usersbody ) {
 305+ $s .= $up->getNavigationBar();
 306+ $s .= Html::rawElement( 'ul', array(), $usersbody );
 307+ $s .= $up->getNavigationBar();
 308+ } else {
 309+ $s .= wfMessage( 'listusers-noresult' )->parseBlock();
 310+ }
 311+
 312+ $wgOut->addHTML( $s );
 313+ }
297314 }
Index: trunk/phase3/includes/SpecialPage.php
@@ -134,7 +134,7 @@
135135 'Preferences' => 'SpecialPreferences',
136136 'Contributions' => 'SpecialContributions',
137137 'Listgrouprights' => 'SpecialListGroupRights',
138 - 'Listusers' => array( 'SpecialPage', 'Listusers' ),
 138+ 'Listusers' => 'SpecialListUsers' ,
139139 'Listadmins' => array( 'SpecialRedirectToSpecial', 'Listadmins', 'Listusers', 'sysop' ),
140140 'Listbots' => array( 'SpecialRedirectToSpecial', 'Listbots', 'Listusers', 'bot' ),
141141 'Activeusers' => 'SpecialActiveUsers',

Follow-up revisions

RevisionCommit summaryAuthorDate
r86509Follow-up r86048: fix fatal, and deprecated Skin static method call.happy-melon17:34, 20 April 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r84805Convert SpecialListusers to subclass SpecialPage. Only two left now!happy-melon16:40, 26 March 2011

Comments

#Comment by Aaron Schulz (talk | contribs)   17:32, 20 April 2011

Fatal error: Call to undefined method Message::parseBlock() in D:\www\MW_trunk\phase3\includes\specials\SpecialListusers.php on line 308

Status & tagging log