r65183 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65182‎ | r65183 | r65184 >
Date:20:58, 17 April 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Stylize Api upto date
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiEmailUser.php (modified) (history)
  • /trunk/phase3/includes/api/ApiFormatYaml_spyc.php (modified) (history)
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)
  • /trunk/phase3/includes/api/ApiPageSet.php (modified) (history)
  • /trunk/phase3/includes/api/ApiParse.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryAllmessages.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryBacklinks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryImageInfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiRollback.php (modified) (history)
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiParse.php
@@ -54,10 +54,10 @@
5555 // $title parameter in Parser::parse isn't enough *sigh*
5656 global $wgParser, $wgUser, $wgTitle, $wgEnableParserCache, $wgLang;
5757
58 - //Current unncessary, code to act as a safeguard against any change in current behaviour of uselang breaks
 58+ // Current unncessary, code to act as a safeguard against any change in current behaviour of uselang breaks
5959 $oldLang = null;
6060 if ( isset( $params['uselang'] ) && $params['uselang'] != $wgLang->getCode() ) {
61 - $oldLang = $wgLang; //Backup wgLang
 61+ $oldLang = $wgLang; // Backup wgLang
6262 $wgLang = Language::factory( $params['uselang'] );
6363 }
6464
@@ -214,7 +214,7 @@
215215 $result->addValue( null, $this->getModuleName(), $result_array );
216216
217217 if ( !is_null( $oldLang ) ) {
218 - $wgLang = $oldLang; //Reset $wgLang to $oldLang
 218+ $wgLang = $oldLang; // Reset $wgLang to $oldLang
219219 }
220220 }
221221
Index: trunk/phase3/includes/api/ApiQueryBacklinks.php
@@ -246,7 +246,7 @@
247247 if ( $this->hasNS ) {
248248 $parentID = $this->pageMap[$row-> { $this->bl_ns } ][$row-> { $this->bl_title } ];
249249 } else {
250 - $parentID = $this->pageMap[NS_IMAGE][$row->{$this->bl_title}];
 250+ $parentID = $this->pageMap[NS_IMAGE][$row-> { $this->bl_title } ];
251251 }
252252 $this->continueStr = $this->getContinueRedirStr( $parentID, $row->page_id );
253253 break;
Index: trunk/phase3/includes/api/ApiRollback.php
@@ -155,7 +155,7 @@
156156
157157 $params = $this->extractRequestParams();
158158 if ( !isset( $params['title'] ) ) {
159 - $this->dieUsageMsg( array( 'missingparam', 'title' ) );
 159+ $this->dieUsageMsg( array( 'missingparam', 'title' ) );
160160 }
161161
162162 $this->mTitleObj = Title::newFromText( $params['title'] );
Index: trunk/phase3/includes/api/ApiQueryAllmessages.php
@@ -46,7 +46,7 @@
4747
4848 $oldLang = null;
4949 if ( !is_null( $params['lang'] ) && $params['lang'] != $wgLang->getCode() ) {
50 - $oldLang = $wgLang; //Keep $wgLang for restore later
 50+ $oldLang = $wgLang; // Keep $wgLang for restore later
5151 $wgLang = Language::factory( $params['lang'] );
5252 }
5353
@@ -125,7 +125,7 @@
126126 $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'message' );
127127
128128 if ( !is_null( $oldLang ) ) {
129 - $wgLang = $oldLang; //Restore $oldLang
 129+ $wgLang = $oldLang; // Restore $oldLang
130130 }
131131 }
132132
Index: trunk/phase3/includes/api/ApiFormatYaml_spyc.php
@@ -185,7 +185,7 @@
186186 else
187187 $string = $spaces . "-\n";
188188 } else {
189 - if ($key == '*') //bug 21922 - Quote asterix used as keys
 189+ if ( $key == '*' ) // bug 21922 - Quote asterix used as keys
190190 $key = "'*'";
191191
192192 // It's mapped
Index: trunk/phase3/includes/api/ApiMain.php
@@ -168,7 +168,7 @@
169169
170170 $this->mRequest = &$request;
171171
172 - $this->mSquidMaxage = -1; // flag for executeActionWithErrorHandling()
 172+ $this->mSquidMaxage = - 1; // flag for executeActionWithErrorHandling()
173173 $this->mCommit = false;
174174 }
175175
@@ -451,7 +451,7 @@
452452 * @param $params Array an array containing the request parameters.
453453 * @return boolean True on success, false should exit immediately
454454 */
455 - protected function checkMaxLag($module, $params) {
 455+ protected function checkMaxLag( $module, $params ) {
456456 if ( $module->shouldCheckMaxlag() && isset( $params['maxlag'] ) ) {
457457 // Check for maxlag
458458 global $wgShowHostnames;
@@ -476,7 +476,7 @@
477477 * Check for sufficient permissions to execute
478478 * @param $module object An Api module
479479 */
480 - protected function checkExecutePermissions($module) {
 480+ protected function checkExecutePermissions( $module ) {
481481 global $wgUser, $wgGroupPermissions;
482482 if ( $module->isReadMode() && !$wgGroupPermissions['*']['read'] && !$wgUser->isAllowed( 'read' ) )
483483 {
@@ -500,7 +500,7 @@
501501 * @param $module object An Api module
502502 * @param $params Array an array with the request parameters
503503 */
504 - protected function setupExternalResponse($module, $params) {
 504+ protected function setupExternalResponse( $module, $params ) {
505505 // Ignore mustBePosted() for internal calls
506506 if ( $module->mustBePosted() && !$this->mRequest->wasPosted() ) {
507507 $this->dieUsageMsg( array( 'mustbeposted', $this->mAction ) );
@@ -525,12 +525,12 @@
526526 $params = $this->setupExecuteAction();
527527 $module = $this->setupModule();
528528
529 - $this->checkExecutePermissions($module);
 529+ $this->checkExecutePermissions( $module );
530530
531 - if(!$this->checkMaxLag($module, $params)) return;
 531+ if ( !$this->checkMaxLag( $module, $params ) ) return;
532532
533533 if ( !$this->mInternalMode ) {
534 - $this->setupExternalResponse($module, $params);
 534+ $this->setupExternalResponse( $module, $params );
535535 }
536536
537537 // Execute
Index: trunk/phase3/includes/api/ApiQueryImageInfo.php
@@ -288,11 +288,11 @@
289289 ),
290290 'urlwidth' => array(
291291 ApiBase::PARAM_TYPE => 'integer',
292 - ApiBase::PARAM_DFLT => -1
 292+ ApiBase::PARAM_DFLT => - 1
293293 ),
294294 'urlheight' => array(
295295 ApiBase::PARAM_TYPE => 'integer',
296 - ApiBase::PARAM_DFLT => -1
 296+ ApiBase::PARAM_DFLT => - 1
297297 ),
298298 'continue' => null,
299299 );
Index: trunk/phase3/includes/api/ApiEmailUser.php
@@ -61,9 +61,9 @@
6262 }
6363
6464 $data = array(
65 - 'Target' => $targetUser->getName(),
66 - 'Text' => $params['text'],
67 - 'Subject' => $params['subject'],
 65+ 'Target' => $targetUser->getName(),
 66+ 'Text' => $params['text'],
 67+ 'Subject' => $params['subject'],
6868 'CCMe' => $params['ccme'],
6969 );
7070 $retval = SpecialEmailuser::submit( $data );
Index: trunk/phase3/includes/api/ApiPageSet.php
@@ -79,7 +79,7 @@
8080 $this->mPendingRedirectIDs = array();
8181 }
8282
83 - $this->mFakePageId = -1;
 83+ $this->mFakePageId = - 1;
8484 }
8585
8686 /**
Index: trunk/phase3/includes/api/ApiBase.php
@@ -475,7 +475,7 @@
476476 $params = $this->getFinalParams();
477477 $results = array();
478478
479 - if( $params ) { // getFinalParams() can return false
 479+ if ( $params ) { // getFinalParams() can return false
480480 foreach ( $params as $paramName => $paramSettings ) {
481481 $results[$paramName] = $this->getParameterFromSettings( $paramName, $paramSettings, $parseLimit );
482482 }
@@ -559,7 +559,7 @@
560560 }
561561 # If no user option was passed, use watchdefault or watchcreation
562562 if ( is_null( $userOption ) ) {
563 - $userOption = $titleObj->exists()
 563+ $userOption = $titleObj->exists()
564564 ? 'watchdefault' : 'watchcreations';
565565 }
566566 # If the corresponding user option is true, watch, else no change
@@ -581,7 +581,7 @@
582582 */
583583 protected function setWatch ( $watch, $titleObj, $userOption = null ) {
584584 $value = $this->getWatchlistValue( $watch, $titleObj, $userOption );
585 - if( $value === null ) {
 585+ if ( $value === null ) {
586586 return;
587587 }
588588
@@ -705,9 +705,9 @@
706706 $value = wfTimestamp( TS_MW, $value );
707707 break;
708708 case 'user':
709 - if( !is_array( $value ) ) $value = array( $value );
 709+ if ( !is_array( $value ) ) $value = array( $value );
710710
711 - foreach( $value as $key => $val ) {
 711+ foreach ( $value as $key => $val ) {
712712 $title = Title::makeTitleSafe( NS_USER, $val );
713713 if ( is_null( $title ) ) {
714714 $this->dieUsage( "Invalid value for user parameter $encParamName", "baduser_{$encParamName}" );
@@ -715,7 +715,7 @@
716716 $value[$key] = $title->getText();
717717 }
718718
719 - if( !$multi ) $value = $value[0];
 719+ if ( !$multi ) $value = $value[0];
720720
721721 break;
722722 default:
Index: trunk/phase3/includes/api/ApiUpload.php
@@ -241,7 +241,7 @@
242242 $this->verifyUpload();
243243
244244 $warnings = $this->checkForWarnings();
245 - if( isset($warnings) ) return $warnings;
 245+ if ( isset( $warnings ) ) return $warnings;
246246
247247 // Use comment as initial page text by default
248248 if ( is_null( $this->mParams['text'] ) ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r75921Cleanup r65183, fix ugly stylize.php formattingdemon12:49, 3 November 2010

Comments

#Comment by Bryan (talk | contribs)   21:18, 29 April 2010
-						$parentID = $this->pageMap[NS_IMAGE][$row->{$this->bl_title}];
+						$parentID = $this->pageMap[NS_IMAGE][$row-> { $this->bl_title } ];
-		$this->mSquidMaxage = -1; // flag for executeActionWithErrorHandling()
+		$this->mSquidMaxage = - 1; // flag for executeActionWithErrorHandling()

I don't believe that those two actually look nicer.

#Comment by Reedy (talk | contribs)   21:29, 29 April 2010

r65188 fixes the -1 issue. Not rerun it yet.

Presumably the first still exists...

Status & tagging log