r88480 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88479‎ | r88480 | r88481 >
Date:19:31, 20 May 2011
Author:reedy
Status:ok
Tags:
Comment:
Add spacing, fix bracing

Update some skin calls to wgUser to getSkin() on SpecialPage
Modified paths:
  • /trunk/phase3/includes/specials/SpecialWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialWatchlist.php
@@ -48,7 +48,7 @@
4949 global $wgFeedClasses;
5050 $apiParams = array( 'action' => 'feedwatchlist', 'allrev' => 'allrev',
5151 'wlowner' => $wgUser->getName(), 'wltoken' => $wlToken );
52 - $feedTemplate = wfScript('api').'?';
 52+ $feedTemplate = wfScript('api') . '?';
5353
5454 foreach( $wgFeedClasses as $format => $class ) {
5555 $theseParams = $apiParams + array( 'feedformat' => $format );
@@ -56,7 +56,7 @@
5757 $wgOut->addFeedLink( $format, $url );
5858 }
5959
60 - $skin = $wgUser->getSkin();
 60+ $skin = $this->getSkin();
6161 $wgOut->setRobotPolicy( 'noindex,nofollow' );
6262
6363 # Anons don't get a watchlist
@@ -74,11 +74,11 @@
7575
7676 $wgOut->setPageTitle( wfMsg( 'watchlist' ) );
7777
78 - $sub = wfMsgExt(
 78+ $sub = wfMsgExt(
7979 'watchlistfor2',
8080 array( 'parseinline', 'replaceafter' ),
8181 $wgUser->getName(),
82 - SpecialEditWatchlist::buildTools( $wgUser->getSkin() )
 82+ SpecialEditWatchlist::buildTools( $skin )
8383 );
8484 $wgOut->setSubtitle( $sub );
8585
@@ -144,10 +144,11 @@
145145 $invert = $wgRequest->getIntOrNull( 'invert' );
146146 if( !is_null( $nameSpace ) ) {
147147 $nameSpace = intval( $nameSpace );
148 - if( $invert && $nameSpace !== 'all' )
 148+ if( $invert && $nameSpace !== 'all' ) {
149149 $nameSpaceClause = "rc_namespace != $nameSpace";
150 - else
 150+ } else {
151151 $nameSpaceClause = "rc_namespace = $nameSpace";
 152+ }
152153 } else {
153154 $nameSpace = '';
154155 $nameSpaceClause = '';
@@ -160,11 +161,11 @@
161162 array( 'wl_user' => $uid ), __METHOD__ );
162163 // Adjust for page X, talk:page X, which are both stored separately,
163164 // but treated together
164 - $nitems = floor($watchlistCount / 2);
 165+ $nitems = floor( $watchlistCount / 2 );
165166
166 - if( is_null($days) || !is_numeric($days) ) {
 167+ if( is_null( $days ) || !is_numeric( $days ) ) {
167168 $big = 1000; /* The magical big */
168 - if($nitems > $big) {
 169+ if( $nitems > $big ) {
169170 # Set default cutoff shorter
170171 $days = $defaults['days'] = (12.0 / 24.0); # 12 hours...
171172 } else {
@@ -230,19 +231,21 @@
231232 }
232233
233234 # Toggle watchlist content (all recent edits or just the latest)
234 - if( $wgUser->getOption( 'extendwatchlist' )) {
 235+ if( $wgUser->getOption( 'extendwatchlist' ) ) {
235236 $limitWatchlist = intval( $wgUser->getOption( 'wllimit' ) );
236237 $usePage = false;
237238 } else {
238 - # Top log Ids for a page are not stored
 239+ # Top log Ids for a page are not stored
239240 $conds[] = 'rc_this_oldid=page_latest OR rc_type=' . RC_LOG;
240241 $limitWatchlist = 0;
241242 $usePage = true;
242243 }
243244
244245 # Show a message about slave lag, if applicable
245 - if( ( $lag = $dbr->getLag() ) > 0 )
 246+ $lag = $dbr->getLag();
 247+ if( $lag > 0 ) {
246248 $wgOut->showLagWarning( $lag );
 249+ }
247250
248251 # Create output form
249252 $form = Xml::fieldset( wfMsg( 'watchlist-options' ), false, array( 'id' => 'mw-watchlist-options' ) );
@@ -281,8 +284,9 @@
282285 if ( $usePage || $rollbacker ) {
283286 $tables[] = 'page';
284287 $join_conds['page'] = array('LEFT JOIN','rc_cur_id=page_id');
285 - if ($rollbacker)
 288+ if ($rollbacker) {
286289 $fields[] = 'page_latest';
 290+ }
287291 }
288292
289293 ChangeTags::modifyDisplayQuery( $tables, $fields, $conds, $join_conds, $options, '' );
@@ -335,16 +339,21 @@
336340 $form .= Xml::checkLabel( wfMsg('invert'), 'invert', 'nsinvert', $invert ) . ' ';
337341 $form .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . '</p>';
338342 $form .= Html::hidden( 'days', $days );
339 - if( $hideMinor )
 343+ if( $hideMinor ) {
340344 $form .= Html::hidden( 'hideMinor', 1 );
341 - if( $hideBots )
 345+ }
 346+ if( $hideBots ) {
342347 $form .= Html::hidden( 'hideBots', 1 );
343 - if( $hideAnons )
 348+ }
 349+ if( $hideAnons ) {
344350 $form .= Html::hidden( 'hideAnons', 1 );
345 - if( $hideLiu )
 351+ }
 352+ if( $hideLiu ) {
346353 $form .= Html::hidden( 'hideLiu', 1 );
347 - if( $hideOwn )
 354+ }
 355+ if( $hideOwn ) {
348356 $form .= Html::hidden( 'hideOwn', 1 );
 357+ }
349358 $form .= Xml::closeElement( 'form' );
350359 $form .= Xml::closeElement( 'fieldset' );
351360 $wgOut->addHTML( $form );
@@ -420,7 +429,6 @@
421430 return wfMsgHtml( $message, $skin->linkKnown( $title, $label, array(), $options ) );
422431 }
423432
424 -
425433 public static function hoursLink( $h, $page, $options = array() ) {
426434 global $wgUser, $wgLang, $wgContLang;
427435
@@ -428,14 +436,12 @@
429437 $title = Title::newFromText( $wgContLang->specialPage( $page ) );
430438 $options['days'] = ($h / 24.0);
431439
432 - $s = $sk->linkKnown(
 440+ return $sk->linkKnown(
433441 $title,
434442 $wgLang->formatNum( $h ),
435443 array(),
436444 $options
437445 );
438 -
439 - return $s;
440446 }
441447
442448 public static function daysLink( $d, $page, $options = array() ) {
@@ -446,14 +452,12 @@
447453 $options['days'] = $d;
448454 $message = ($d ? $wgLang->formatNum( $d ) : wfMsgHtml( 'watchlistall2' ) );
449455
450 - $s = $sk->linkKnown(
 456+ return $sk->linkKnown(
451457 $title,
452458 $message,
453459 array(),
454460 $options
455461 );
456 -
457 - return $s;
458462 }
459463
460464 /**
@@ -496,8 +500,9 @@
497501 $count = $row->count;
498502
499503 # Halve to remove talk pages if needed
500 - if( !$talk )
 504+ if( !$talk ) {
501505 $count = floor( $count / 2 );
 506+ }
502507
503508 return( $count );
504509 }

Status & tagging log