r88495 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88494‎ | r88495 | r88496 >
Date:22:03, 20 May 2011
Author:reedy
Status:resolved
Tags:
Comment:
Whitespace

Documentation

Other related stuffs
Modified paths:
  • /trunk/phase3/includes/ChangesList.php (modified) (history)
  • /trunk/phase3/includes/api/ApiImport.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUndelete.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialWatchlist.php (modified) (history)
  • /trunk/phase3/maintenance/generateSitemap.php (modified) (history)
  • /trunk/phase3/maintenance/language/languages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/generateSitemap.php
@@ -133,7 +133,6 @@
134134 */
135135 public function __construct() {
136136 parent::__construct();
137 - global $wgDBname;
138137 $this->mDescription = "Creates a sitemap for the site";
139138 $this->addOption( 'fspath', 'The file system path to save to, e.g. /tmp/sitemap; defaults to current directory', false, true );
140139 $this->addOption( 'urlpath', 'The URL path corresponding to --fspath, prepended to filenames in the index; defaults to an empty string', false, true );
Index: trunk/phase3/maintenance/language/languages.inc
@@ -88,7 +88,7 @@
8989 /**
9090 * Load the language file.
9191 *
92 - * @param $code The language code.
 92+ * @param $code string The language code.
9393 */
9494 protected function loadFile( $code ) {
9595 if ( isset( $this->mRawMessages[$code] ) &&
Index: trunk/phase3/includes/api/ApiImport.php
@@ -176,6 +176,14 @@
177177 class ApiImportReporter extends ImportReporter {
178178 private $mResultArr = array();
179179
 180+ /**
 181+ * @param $title Title
 182+ * @param $origTitle Title
 183+ * @param $revisionCount int
 184+ * @param $successCount int
 185+ * @param $pageInfo
 186+ * @return void
 187+ */
180188 function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {
181189 // Add a result entry
182190 $r = array();
Index: trunk/phase3/includes/ChangesList.php
@@ -37,7 +37,10 @@
3838 * @var Skin
3939 */
4040 public $skin;
 41+
4142 protected $watchlist = false;
 43+
 44+ protected $message = array();
4245
4346 /**
4447 * Changeslist contructor
@@ -53,7 +56,7 @@
5457 * Some users might want to use an enhanced list format, for instance
5558 *
5659 * @param $user User to fetch the list class for
57 - * @return ChangesList derivative
 60+ * @return ChangesList|EnhancedChangesList|OldChangesList derivative
5861 */
5962 public static function newFromUser( $user ) {
6063 global $wgRequest;
@@ -111,7 +114,7 @@
112115 * unpatrolled edit. By default in English it will contain "N", "m", "b",
113116 * "!" respectively, plus it will have an appropriate title and class.
114117 *
115 - * @param $key String: 'newpage', 'unpatrolled', 'minor', or 'bot'
 118+ * @param $flag String: 'newpage', 'unpatrolled', 'minor', or 'bot'
116119 * @return String: Raw HTML
117120 */
118121 public static function flag( $flag ) {
@@ -160,7 +163,7 @@
161164 * Show formatted char difference
162165 * @param $old Integer: bytes
163166 * @param $new Integer: bytes
164 - * @returns String
 167+ * @return String
165168 */
166169 public static function showCharacterDifference( $old, $new ) {
167170 global $wgRCChangedSizeThreshold, $wgLang, $wgMiserMode;
@@ -638,6 +641,9 @@
639642 * Format a line for enhanced recentchange (aka with javascript and block of lines).
640643 *
641644 * @param $baseRC RecentChange
 645+ * @param $watched bool
 646+ *
 647+ * @return string
642648 */
643649 public function recentChangesLine( &$baseRC, $watched = false ) {
644650 global $wgLang, $wgUser;
@@ -1201,6 +1207,8 @@
12021208 /**
12031209 * If enhanced RC is in use, this function takes the previously cached
12041210 * RC lines, arranges them, and outputs the HTML
 1211+ *
 1212+ * @return string
12051213 */
12061214 protected function recentChangesBlock() {
12071215 if( count ( $this->rc_cache ) == 0 ) {
Index: trunk/phase3/includes/specials/SpecialUndelete.php
@@ -80,6 +80,11 @@
8181 return self::listPages( $dbr, $conds );
8282 }
8383
 84+ /**
 85+ * @param $dbr DatabaseBase
 86+ * @param $condition
 87+ * @return bool|ResultWrapper
 88+ */
8489 protected static function listPages( $dbr, $condition ) {
8590 return $dbr->resultObject(
8691 $dbr->select(
@@ -981,7 +986,7 @@
982987 $targetQuery = array( 'oldid' => $rev->getId() );
983988 }
984989 // Add show/hide deletion links if available
985 - $del .= $this->revDeleteLink( $rev );
 990+ $del = $this->revDeleteLink( $rev );
986991 return
987992 '<div id="mw-diff-' . $prefix . 'title1"><strong>' .
988993 $sk->link(
Index: trunk/phase3/includes/specials/SpecialWatchlist.php
@@ -39,7 +39,7 @@
4040
4141 // Add feed links
4242 $wlToken = $wgUser->getOption( 'watchlisttoken' );
43 - if (!$wlToken) {
 43+ if ( !$wlToken ) {
4444 $wlToken = sha1( mt_rand() . microtime( true ) );
4545 $wgUser->setOption( 'watchlisttoken', $wlToken );
4646 $wgUser->saveSettings();
@@ -82,7 +82,8 @@
8383 );
8484 $wgOut->setSubtitle( $sub );
8585
86 - if( ( $mode = SpecialEditWatchlist::getMode( $wgRequest, $par ) ) !== false ) {
 86+ $mode = SpecialEditWatchlist::getMode( $wgRequest, $par );
 87+ if( $mode !== false ) {
8788 # TODO: localise?
8889 switch( $mode ){
8990 case SpecialEditWatchlist::EDIT_CLEAR:
@@ -100,7 +101,7 @@
101102 }
102103
103104 $uid = $wgUser->getId();
104 - if( ($wgEnotifWatchlist || $wgShowUpdatedMarker) && $wgRequest->getVal( 'reset' ) &&
 105+ if( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $wgRequest->getVal( 'reset' ) &&
105106 $wgRequest->wasPosted() )
106107 {
107108 $wgUser->clearAllNotifications( $uid );
@@ -172,7 +173,7 @@
173174 $days = $defaults['days']; # default cutoff for shortlisters
174175 }
175176 } else {
176 - $days = floatval($days);
 177+ $days = floatval( $days );
177178 }
178179
179180 // Dump everything here
@@ -284,7 +285,7 @@
285286 if ( $usePage || $rollbacker ) {
286287 $tables[] = 'page';
287288 $join_conds['page'] = array('LEFT JOIN','rc_cur_id=page_id');
288 - if ($rollbacker) {
 289+ if ( $rollbacker ) {
289290 $fields[] = 'page_latest';
290291 }
291292 }
@@ -309,7 +310,7 @@
310311 } elseif( $days > 0 ) {
311312 $wlInfo = wfMsgExt( 'wlnote', 'parseinline',
312313 $wgLang->formatNum( $numRows ),
313 - $wgLang->formatNum( round($days*24) )
 314+ $wgLang->formatNum( round( $days * 24 ) )
314315 ) . '<br />';
315316 }
316317
@@ -396,7 +397,7 @@
397398 $updated = false;
398399 }
399400
400 - if ($wgRCShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) {
 401+ if ( $wgRCShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' ) ) {
401402 $rc->numberofWatchingusers = $dbr->selectField( 'watchlist',
402403 'COUNT(*)',
403404 array(
@@ -434,7 +435,7 @@
435436
436437 $sk = $wgUser->getSkin();
437438 $title = Title::newFromText( $wgContLang->specialPage( $page ) );
438 - $options['days'] = ($h / 24.0);
 439+ $options['days'] = ( $h / 24.0 );
439440
440441 return $sk->linkKnown(
441442 $title,
@@ -450,7 +451,7 @@
451452 $sk = $wgUser->getSkin();
452453 $title = Title::newFromText( $wgContLang->specialPage( $page ) );
453454 $options['days'] = $d;
454 - $message = ($d ? $wgLang->formatNum( $d ) : wfMsgHtml( 'watchlistall2' ) );
 455+ $message = ( $d ? $wgLang->formatNum( $d ) : wfMsgHtml( 'watchlistall2' ) );
455456
456457 return $sk->linkKnown(
457458 $title,
@@ -462,6 +463,8 @@
463464
464465 /**
465466 * Returns html
 467+ *
 468+ * @return string
466469 */
467470 protected static function cutoffLinks( $days, $page = 'Watchlist', $options = array() ) {
468471 global $wgLang;

Follow-up revisions

RevisionCommit summaryAuthorDate
r88547Quick unbreak r88495: initialising the variable caused it not to be filled wi...nikerabbit20:39, 21 May 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88015(bug 21086) generateSitemap.php uses wfWikiID() in sitemap filenames...demon17:54, 13 May 2011

Status & tagging log