r106032 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106031‎ | r106032 | r106033 >
Date:15:47, 13 December 2011
Author:reedy
Status:ok
Tags:
Comment:
Seriously, don't use "wgOut" as a function parameter name
Modified paths:
  • /trunk/extensions/HeaderTabs/HeaderTabs_body.jq.php (modified) (history)
  • /trunk/extensions/HeaderTabs/HeaderTabs_body.yui.php (modified) (history)
  • /trunk/extensions/ShortUrl/populateShortUrlTable.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/api/ApiQueryTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/api/ApiQueryTest.php
@@ -50,7 +50,6 @@
5151 'action' => 'query',
5252 'titles' => $title . '|Talk:' ) );
5353
54 -
5554 $this->assertArrayHasKey( 'query', $data[0] );
5655 $this->assertArrayHasKey( 'pages', $data[0]['query'] );
5756 $this->assertEquals( 2, count( $data[0]['query']['pages'] ) );
@@ -60,8 +59,6 @@
6160
6261 $this->assertArrayHasKey( 'missing', $data[0]['query']['pages'][-2] );
6362 $this->assertArrayHasKey( 'invalid', $data[0]['query']['pages'][-1] );
64 -
65 -
6663 }
6764
6865 }
Index: trunk/extensions/HeaderTabs/HeaderTabs_body.yui.php
@@ -106,16 +106,20 @@
107107 return true;
108108 }
109109
110 - public static function addHTMLHeader( &$wgOut ) {
 110+ /**
 111+ * @param $out OutputPage
 112+ * @return bool
 113+ */
 114+ public static function addHTMLHeader( &$out ) {
111115 global $htScriptPath, $htUseHistory;
112116
113117 if ( $htUseHistory ) {
114 - $wgOut->addScript( '<script type="text/javascript" src="'.$htScriptPath.'/skins-yui/combined-history-min.js"></script>' );
 118+ $out->addScript( '<script type="text/javascript" src="'.$htScriptPath.'/skins-yui/combined-history-min.js"></script>' );
115119 } else {
116 - $wgOut->addScript( '<script type="text/javascript" src="'.$htScriptPath.'/skins-yui/combined-min.js"></script>' );
 120+ $out->addScript( '<script type="text/javascript" src="'.$htScriptPath.'/skins-yui/combined-min.js"></script>' );
117121 }
118122
119 - $wgOut->addLink( array(
 123+ $out->addLink( array(
120124 'rel' => 'stylesheet',
121125 'type' => 'text/css',
122126 'media' => 'screen, projection',
@@ -142,4 +146,4 @@
143147 return $parser->insertStripItem( $output, $parser->mStripState );
144148 }
145149
146 -}
\ No newline at end of file
 150+}
Index: trunk/extensions/HeaderTabs/HeaderTabs_body.jq.php
@@ -256,20 +256,24 @@
257257 return true;
258258 }
259259
260 - public static function addHTMLHeader( &$wgOut ) {
 260+ /**
 261+ * @param $out OutputPage
 262+ * @return bool
 263+ */
 264+ public static function addHTMLHeader( &$out ) {
261265 global $htScriptPath,$htStyle;
262266
263267 wfDebugLog('headertabs', __METHOD__.': loading javascript');
264268
265269 //! @todo we might be able to only load our js and styles if we are rendering tabs, speeding up pages that don't use it? but what about cached pages? (2011-12-12, ofb)
266270
267 - $wgOut->addModules( 'ext.headertabs' );
 271+ $out->addModules( 'ext.headertabs' );
268272
269273 // add the stylesheet for our perticular style
270274 if (!empty($htStyle) && $htStyle !== 'jquery') {
271275 $styleFile = $htScriptPath.'/skins-jquery/ext.headertabs.'.$htStyle.'.css';
272276 wfDebugLog('headertabs', __METHOD__.': including style file: '.$styleFile);
273 - $wgOut->addExtensionStyle( $styleFile );
 277+ $out->addExtensionStyle( $styleFile );
274278 }
275279
276280 return true;
@@ -292,4 +296,4 @@
293297 return $parser->insertStripItem( $output, $parser->mStripState );
294298 }
295299
296 -}
\ No newline at end of file
 300+}
Index: trunk/extensions/ShortUrl/populateShortUrlTable.php
@@ -14,8 +14,8 @@
1515
1616 private function insertRows( $a ) {
1717 $dbw = wfGetDB( DB_MASTER );
18 - $dbw->insert(
19 - 'shorturls',
 18+ $dbw->insert(
 19+ 'shorturls',
2020 $a,
2121 __METHOD__,
2222 array( 'IGNORE' )
@@ -29,7 +29,6 @@
3030
3131 $last_processed_id = 0;
3232
33 -
3433 while( true ) {
3534 $insertBuffer = array();
3635 $res = $dbr->select(
@@ -41,7 +40,7 @@
4241 );
4342 if( $res->numRows() == 0 ) {
4443 break;
45 - }
 44+ }
4645
4746 foreach( $res as $row ) {
4847 $rowCount++;

Follow-up revisions

RevisionCommit summaryAuthorDate
r106054Follow-up to r106028 and r106032 - code cleanupyaron18:30, 13 December 2011

Status & tagging log