r75460 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:< r75459‎ | r75460 | r75461 >
Date:19:34, 26 October 2010
Author:reedy
Status:deferred
Tags:
Comment:
Remove whitespace, some unused globals, wfLoadExtensionMessages

Add braces, fixup some indenting
Modified paths:
  • /trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php
——@@ -27,8 +27,6 @@
2828 **/
2929
3030 class GoogleNewsSitemap extends IncludableSpecialPage {
31 -
32 -
3331 /**
3432 * FIXME: Some of this might need a config eventually
3533 * @var string
——@@ -53,7 +51,6 @@
5452 var $wgDPLallowUnlimitedResults = true; // Allow unlimited results
5553 var $wgDPLallowUnlimitedCategories = false; // Allow unlimited categories
5654
57 -
5855 /**
5956 * @var array Parameters array
6057 **/
——@@ -72,12 +69,7 @@
7370 * main()
7471 **/
7572 public function execute( $par ) {
76 - global $wgUser;
77 - global $wgLang;
78 - global $wgContLang;
79 - global $wgRequest, $wgOut;
8073 global $wgSitename, $wgServer, $wgScriptPath;
81 - wfLoadExtensionMessages( 'GoogleNewsSitemap' );
8274 global $wgFeedClasses, $wgLocaltimezone;
8375
8476 // Not sure how clean $wgLocaltimezone is
——@@ -89,7 +81,6 @@
9082
9183 $this->dpl_parm( $par );
9284
93 -
9485 $wgFeedClasses[] = array( 'sitemap' => 'SitemapFeed' );
9586
9687 if ( 'sitemap' == $this->params['feed'] ) {
——@@ -123,17 +114,18 @@
124115 // FIXME: figure out how to fail with no results gracefully
125116 if ( $dbr->numRows( $res ) == 0 ) {
126117 $feed->outFooter();
127 - if ( false == $this->params['suppressErrors'] )
128 - return htmlspecialchars( wfMsg( 'gnsm_noresults' ) );
129 - else
130 - return '';
 118+ if ( false == $this->params['suppressErrors'] ) {
 119+ return htmlspecialchars( wfMsg( 'gnsm_noresults' ) );
 120+ } else {
 121+ return '';
 122+ }
131123 }
132124
133 - while ( $row = $dbr->fetchObject( $res ) ) {
 125+ foreach ($res as $row ) {
134126 $title = Title::makeTitle( $row->page_namespace, $row->page_title );
135127
136128 if ( $title ) {
137 - // This is printing things in places it shouldn't
 129+ // This is printing things in places it shouldn't
138130 // print $this->params['nameSpace'];
139131
140132 $titleText = ( true == $this->params['nameSpace'] ) ? $title->getPrefixedText() : $title->getText();
——@@ -155,10 +147,10 @@
156148
157149 $this->Date = isset( $row->cl_timestamp ) ? $row->cl_timestamp : date( DATE_ATOM );
158150 if ( isset( $row->comment ) ) {
159 - $comments = htmlspecialchars( $row->comment );
 151+ $comments = htmlspecialchars( $row->comment );
160152 } else {
161 - $talkpage = $title->getTalkPage();
162 - $comments = $talkpage->getFullURL();
 153+ $talkpage = $title->getTalkPage();
 154+ $comments = $talkpage->getFullURL();
163155 }
164156 $titleText = ( true === $this->params['nameSpace'] ) ? $title->getPrefixedText() : $title->getText();
165157 $feedItem = new FeedItem(
——@@ -251,16 +243,17 @@
252244 $currentTableNumber++;
253245 }
254246
255 - if ( 'lastedit' == $this->params['orderMethod'] )
 247+ if ( 'lastedit' == $this->params['orderMethod'] ) {
256248 $sqlWhere .= ' ORDER BY page_touched ';
257 - else
 249+ } else {
258250 $sqlWhere .= ' ORDER BY c1.cl_timestamp ';
 251+ }
259252
260 - if ( 'descending' == $this->params['order'] )
 253+ if ( 'descending' == $this->params['order'] ) {
261254 $sqlWhere .= 'DESC';
262 - else
 255+ } else {
263256 $sqlWhere .= 'ASC';
264 -
 257+ }
265258 // FIXME: Note: this is not a boolean type check - will also trap count = 0 which may
266259 // accidentally give unlimited returns
267260 if ( 0 < $this->params['count'] ) {
——@@ -454,7 +447,6 @@
455448 $this->params['catCount'] = count( $this->categories );
456449 } else {
457450 echo "\$feed is not an object.\n";
458 - continue;
459451 }
460452 }
461453
——@@ -511,7 +503,6 @@
512504 $str = substr( $str, 2 ); # to remove leading ', '
513505 return $str;
514506 }
515 -
516507 }
517508
518509 /**

Status & tagging log