r82913 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82912‎ | r82913 | r82914 >
Date:21:10, 27 February 2011
Author:reedy
Status:ok
Tags:
Comment:
Tweak comments, remove some unused stuff.

Explicit definitions, move a few minor bits around
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiBlock.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/ApiQueryBacklinks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryExternalLinks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryInfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRandom.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRecentChanges.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRevisions.php (modified) (history)
  • /trunk/phase3/includes/api/ApiRollback.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php
@@ -43,7 +43,8 @@
4444
4545 private $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_userid = false,
4646 $fld_flags = false, $fld_timestamp = false, $fld_title = false, $fld_ids = false,
47 - $fld_sizes = false, $fld_redirect = false, $fld_patrolled = false, $fld_loginfo = false, $fld_tags = false;
 47+ $fld_sizes = false, $fld_redirect = false, $fld_patrolled = false, $fld_loginfo = false,
 48+ $fld_tags = false, $token = array();
4849
4950 private $tokenFunctions;
5051
Index: trunk/phase3/includes/api/ApiQueryRandom.php
@@ -73,7 +73,11 @@
7474 }
7575 }
7676
77 - protected function runQuery( &$resultPageSet ) {
 77+ /**
 78+ * @param $resultPageSet ApiPageSet
 79+ * @return int
 80+ */
 81+ protected function runQuery( $resultPageSet = null ) {
7882 $res = $this->select( __METHOD__ );
7983 $count = 0;
8084 foreach ( $res as $row ) {
Index: trunk/phase3/includes/api/ApiParse.php
@@ -253,11 +253,11 @@
254254 if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) {
255255 $out = new OutputPage;
256256 $out->addParserOutputNoText( $p_result );
 257+ $userSkin = $wgUser->getSkin();
257258
258259 if ( isset( $prop['headitems'] ) ) {
259260 $headItems = $this->formatHeadItems( $p_result->getHeadItems() );
260261
261 - $userSkin = $wgUser->getSkin();
262262 $userSkin->setupUserCss( $out );
263263 $css = $this->formatCss( $out->buildCssLinksArray() );
264264
Index: trunk/phase3/includes/api/ApiQueryBacklinks.php
@@ -46,8 +46,18 @@
4747
4848 private $params, $contID, $redirID, $redirect;
4949 private $bl_ns, $bl_from, $bl_table, $bl_code, $bl_title, $bl_sort, $bl_fields, $hasNS;
50 - private $pageMap, $resultArr;
5150
 51+ /**
 52+ * Maps ns and title to pageid
 53+ *
 54+ * @var array
 55+ */
 56+ private $pageMap = array();
 57+ private $resultArr;
 58+
 59+ private $redirTitles = array();
 60+ private $continueStr = null;
 61+
5262 // output element name, database column field prefix, database table
5363 private $backlinksSettings = array(
5464 'backlinks' => array(
@@ -232,9 +242,7 @@
233243 $res = $this->select( __METHOD__ . '::firstQuery' );
234244
235245 $count = 0;
236 - $this->pageMap = array(); // Maps ns and title to pageid
237 - $this->continueStr = null;
238 - $this->redirTitles = array();
 246+
239247 foreach ( $res as $row ) {
240248 if ( ++ $count > $this->params['limit'] ) {
241249 // We've reached the one extra which shows that there are additional pages to be had. Stop here...
Index: trunk/phase3/includes/api/ApiRollback.php
@@ -38,8 +38,16 @@
3939 parent::__construct( $main, $action );
4040 }
4141
42 - private $mTitleObj = null, $mUser = null;
 42+ /**
 43+ * @var Title
 44+ */
 45+ private $mTitleObj = null;
4346
 47+ /**
 48+ * @var User
 49+ */
 50+ private $mUser = null;
 51+
4452 public function execute() {
4553 $params = $this->extractRequestParams();
4654
Index: trunk/phase3/includes/api/ApiMain.php
@@ -478,9 +478,7 @@
479479 }
480480
481481 if ( $e instanceof UsageException ) {
482 - //
483482 // User entered incorrect parameters - print usage screen
484 - //
485483 $errMessage = $e->getMessageArray();
486484
487485 // Only print the help message when this is for the developer, not runtime
@@ -490,9 +488,7 @@
491489
492490 } else {
493491 global $wgShowSQLErrors, $wgShowExceptionDetails;
494 - //
495492 // Something is seriously wrong
496 - //
497493 if ( ( $e instanceof DBQueryError ) && !$wgShowSQLErrors ) {
498494 $info = 'Database query error';
499495 } else {
Index: trunk/phase3/includes/api/ApiPageSet.php
@@ -684,7 +684,6 @@
685685 $titleWasConverted = $unconvertedTitle !== $titleObj->getPrefixedText();
686686 }
687687
688 -
689688 if ( $titleObj->getNamespace() < 0 ) {
690689 // Handle Special and Media pages
691690 $titleObj = $titleObj->fixSpecialName();
Index: trunk/phase3/includes/api/ApiBlock.php
@@ -37,9 +37,6 @@
3838 */
3939 class ApiBlock extends ApiBase {
4040
41 - /**
42 - * Std ctor.
43 - */
4441 public function __construct( $main, $action ) {
4542 parent::__construct( $main, $action );
4643 }
Index: trunk/phase3/includes/api/ApiQueryRevisions.php
@@ -39,7 +39,7 @@
4040 class ApiQueryRevisions extends ApiQueryBase {
4141
4242 private $diffto, $difftotext, $expandTemplates, $generateXML, $section,
43 - $token;
 43+ $token, $parseContent;
4444
4545 public function __construct( $query, $moduleName ) {
4646 parent::__construct( $query, $moduleName, 'rv' );
@@ -126,8 +126,7 @@
127127 $params['diffto'] = 0;
128128 }
129129 if ( ( !ctype_digit( $params['diffto'] ) || $params['diffto'] < 0 )
130 - && $params['diffto'] != 'prev' && $params['diffto'] != 'next' )
131 - {
 130+ && $params['diffto'] != 'prev' && $params['diffto'] != 'next' ) {
132131 $this->dieUsage( 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"', 'diffto' );
133132 }
134133 // Check whether the revision exists and is readable,
@@ -176,7 +175,6 @@
177176 $this->getResult()->setParsedLimit( $this->getModuleName(), $limit );
178177 }
179178
180 -
181179 if ( !is_null( $this->token ) || $pageCount > 0 ) {
182180 $this->addFields( Revision::selectPageFields() );
183181 }
@@ -234,7 +232,6 @@
235233 // Bug 24166 - API error when using rvprop=tags
236234 $this->addTables( 'revision' );
237235
238 -
239236 if ( $enumRevMode ) {
240237 // This is mostly to prevent parameter errors (and optimize SQL?)
241238 if ( !is_null( $params['startid'] ) && !is_null( $params['start'] ) ) {
Index: trunk/phase3/includes/api/ApiQueryExternalLinks.php
@@ -59,7 +59,7 @@
6060 $this->addTables( 'externallinks' );
6161 $this->addWhereFld( 'el_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
6262
63 - //TODO: Refactor out,duplicated from ApiQueryExtLinksUsage
 63+ //TODO: Refactor out, duplicated from ApiQueryExtLinksUsage
6464 if ( !is_null( $query ) || $query != '' ) {
6565 if ( is_null( $protocol ) ) {
6666 $protocol = 'http://';
Index: trunk/phase3/includes/api/ApiBase.php
@@ -403,6 +403,8 @@
404404 */
405405 public function makeHelpMsg_callback( $matches ) {
406406 global $wgAutoloadClasses, $wgAutoloadLocalClasses;
 407+
 408+ $file = '';
407409 if ( isset( $wgAutoloadLocalClasses[get_class( $this )] ) ) {
408410 $file = $wgAutoloadLocalClasses[get_class( $this )];
409411 } elseif ( isset( $wgAutoloadClasses[get_class( $this )] ) ) {
Index: trunk/phase3/includes/api/ApiQueryInfo.php
@@ -41,6 +41,13 @@
4242 $fld_readable = false, $fld_watched = false,
4343 $fld_preload = false, $fld_displaytitle = false;
4444
 45+ private $params, $titles, $missing, $everything, $pageCounter;
 46+
 47+ private $pageRestrictions, $pageIsRedir, $pageIsNew, $pageTouched,
 48+ $pageLatest, $pageLength;
 49+
 50+ private $protections, $watched, $talkids, $subjectids, $displaytitles;
 51+
4552 private $tokenFunctions;
4653
4754 public function __construct( $query, $moduleName ) {

Sign-offs

UserFlagDate
Nikerabbitinspected22:12, 28 February 2011

Status & tagging log