r82429 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82428‎ | r82429 | r82430 >
Date:00:30, 19 February 2011
Author:reedy
Status:ok
Tags:
Comment:
More parameter documentation
Modified paths:
  • /trunk/phase3/includes/api/ApiDelete.php (modified) (history)
  • /trunk/phase3/includes/api/ApiEditPage.php (modified) (history)
  • /trunk/phase3/includes/api/ApiFormatRaw.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQuery.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryAllCategories.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryAllLinks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryAllimages.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryAllpages.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryBacklinks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryCategories.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryCategoryMembers.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryDuplicateFiles.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryIWBacklinks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryImageInfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryImages.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryInfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryLinks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryProtectedTitles.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryQueryPage.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/ApiQuerySearch.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryTags.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUsers.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryWatchlist.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryWatchlistRaw.php (modified) (history)
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)
  • /trunk/phase3/includes/upload/UploadBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadBase.php
@@ -504,7 +504,7 @@
505505 * Really perform the upload. Stores the file in the local repo, watches
506506 * if necessary and runs the UploadComplete hook.
507507 *
508 - * @return mixed Status indicating the whether the upload succeeded.
 508+ * @return Status indicating the whether the upload succeeded.
509509 */
510510 public function performUpload( $comment, $pageText, $watch, $user ) {
511511 $status = $this->getLocalFile()->upload(
@@ -657,7 +657,7 @@
658658 * API request to find this stashed file again.
659659 *
660660 * @param $key String: (optional) the session key used to find the file info again. If not supplied, a key will be autogenerated.
661 - * @return File: stashed file
 661+ * @return File stashed file
662662 */
663663 public function stashSessionFile( $key = null ) {
664664 $stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash();
Index: trunk/phase3/includes/api/ApiQueryAllLinks.php
@@ -52,6 +52,10 @@
5353 $this->run( $resultPageSet );
5454 }
5555
 56+ /**
 57+ * @param $resultPageSet ApiPageSet
 58+ * @return void
 59+ */
5660 private function run( $resultPageSet = null ) {
5761 $db = $this->getDB();
5862 $params = $this->extractRequestParams();
Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php
@@ -71,6 +71,13 @@
7272 return $this->tokenFunctions;
7373 }
7474
 75+ /**
 76+ * @static
 77+ * @param $pageid
 78+ * @param $title
 79+ * @param $rc RecentChange
 80+ * @return bool|String
 81+ */
7582 public static function getPatrolToken( $pageid, $title, $rc ) {
7683 global $wgUser;
7784 if ( !$wgUser->useRCPatrol() && ( !$wgUser->useNPPatrol() ||
@@ -118,6 +125,8 @@
119126
120127 /**
121128 * Generates and outputs the result of this query based upon the provided parameters.
 129+ *
 130+ * @param $resultPageSet ApiPageSet
122131 */
123132 public function run( $resultPageSet = null ) {
124133 global $wgUser;
Index: trunk/phase3/includes/api/ApiQueryAllCategories.php
@@ -53,6 +53,10 @@
5454 $this->run( $resultPageSet );
5555 }
5656
 57+ /**
 58+ * @param $resultPageSet ApiPageSet
 59+ * @return void
 60+ */
5761 private function run( $resultPageSet = null ) {
5862 $db = $this->getDB();
5963 $params = $this->extractRequestParams();
Index: trunk/phase3/includes/api/ApiQueryLinks.php
@@ -74,6 +74,10 @@
7575 $this->run( $resultPageSet );
7676 }
7777
 78+ /**
 79+ * @param $resultPageSet ApiPageSet
 80+ * @return
 81+ */
7882 private function run( $resultPageSet = null ) {
7983 if ( $this->getPageSet()->getGoodTitleCount() == 0 ) {
8084 return; // nothing to do
Index: trunk/phase3/includes/api/ApiQueryRandom.php
@@ -36,7 +36,7 @@
3737 * @ingroup API
3838 */
3939
40 - class ApiQueryRandom extends ApiQueryGeneratorBase {
 40+class ApiQueryRandom extends ApiQueryGeneratorBase {
4141
4242 public function __construct( $query, $moduleName ) {
4343 parent::__construct( $query, $moduleName, 'rn' );
@@ -50,6 +50,14 @@
5151 $this->run( $resultPageSet );
5252 }
5353
 54+ /**
 55+ * @param $randstr
 56+ * @param $limit
 57+ * @param $namespace
 58+ * @param $resultPageSet ApiPageSet
 59+ * @param $redirect
 60+ * @return void
 61+ */
5462 protected function prepareQuery( $randstr, $limit, $namespace, &$resultPageSet, $redirect ) {
5563 $this->resetQueryParams();
5664 $this->addTables( 'page' );
Index: trunk/phase3/includes/api/ApiQueryAllpages.php
@@ -48,6 +48,10 @@
4949 return 'public';
5050 }
5151
 52+ /**
 53+ * @param $resultPageSet ApiPageSet
 54+ * @return void
 55+ */
5256 public function executeGenerator( $resultPageSet ) {
5357 if ( $resultPageSet->isResolvingRedirects() ) {
5458 $this->dieUsage( 'Use "gapfilterredir=nonredirects" option instead of "redirects" when using allpages as a generator', 'params' );
@@ -56,6 +60,10 @@
5761 $this->run( $resultPageSet );
5862 }
5963
 64+ /**
 65+ * @param $resultPageSet ApiPageSet
 66+ * @return void
 67+ */
6068 private function run( $resultPageSet = null ) {
6169 $db = $this->getDB();
6270
Index: trunk/phase3/includes/api/ApiQueryBacklinks.php
@@ -39,7 +39,12 @@
4040 */
4141 class ApiQueryBacklinks extends ApiQueryGeneratorBase {
4242
43 - private $params, $rootTitle, $contID, $redirID, $redirect;
 43+ /**
 44+ * @var Title
 45+ */
 46+ private $rootTitle;
 47+
 48+ private $params, $contID, $redirID, $redirect;
4449 private $bl_ns, $bl_from, $bl_table, $bl_code, $bl_title, $bl_sort, $bl_fields, $hasNS;
4550 private $pageMap, $resultArr;
4651
@@ -103,6 +108,10 @@
104109 $this->run( $resultPageSet );
105110 }
106111
 112+ /**
 113+ * @param $resultPageSet ApiPageSet
 114+ * @return void
 115+ */
107116 private function prepareFirstQuery( $resultPageSet = null ) {
108117 /* SELECT page_id, page_title, page_namespace, page_is_redirect
109118 * FROM pagelinks, page WHERE pl_from=page_id
@@ -141,6 +150,10 @@
142151 $this->addOption( 'STRAIGHT_JOIN' );
143152 }
144153
 154+ /**
 155+ * @param $resultPageSet ApiPageSet
 156+ * @return void
 157+ */
145158 private function prepareSecondQuery( $resultPageSet = null ) {
146159 /* SELECT page_id, page_title, page_namespace, page_is_redirect, pl_title, pl_namespace
147160 FROM pagelinks, page WHERE pl_from=page_id
@@ -199,6 +212,10 @@
200213 $this->addOption( 'USE INDEX', array( 'page' => 'PRIMARY' ) );
201214 }
202215
 216+ /**
 217+ * @param $resultPageSet ApiPageSet
 218+ * @return void
 219+ */
203220 private function run( $resultPageSet = null ) {
204221 $this->params = $this->extractRequestParams( false );
205222 $this->redirect = isset( $this->params['redirect'] ) && $this->params['redirect'];
Index: trunk/phase3/includes/api/ApiDelete.php
@@ -161,7 +161,7 @@
162162 /**
163163 * @static
164164 * @param $token
165 - * @param $title
 165+ * @param $title Title
166166 * @param $oldimage
167167 * @param $reason
168168 * @param $suppress bool
Index: trunk/phase3/includes/api/ApiQueryCategoryMembers.php
@@ -52,6 +52,10 @@
5353 $this->run( $resultPageSet );
5454 }
5555
 56+ /**
 57+ * @param $resultPageSet ApiPageSet
 58+ * @return void
 59+ */
5660 private function run( $resultPageSet = null ) {
5761 $params = $this->extractRequestParams();
5862
Index: trunk/phase3/includes/api/ApiEditPage.php
@@ -67,7 +67,6 @@
6868
6969 $this->getResult()->addValue( null, 'foo', $titles );
7070
71 -
7271 $redirValues = array();
7372 foreach ( $titles as $id => $newTitle ) {
7473
Index: trunk/phase3/includes/api/ApiQueryAllimages.php
@@ -64,6 +64,10 @@
6565 return 'public';
6666 }
6767
 68+ /**
 69+ * @param $resultPageSet ApiPageSet
 70+ * @return void
 71+ */
6872 public function executeGenerator( $resultPageSet ) {
6973 if ( $resultPageSet->isResolvingRedirects() ) {
7074 $this->dieUsage( 'Use "gaifilterredir=nonredirects" option instead of "redirects" when using allimages as a generator', 'params' );
@@ -72,6 +76,10 @@
7377 $this->run( $resultPageSet );
7478 }
7579
 80+ /**
 81+ * @param $resultPageSet ApiPageSet
 82+ * @return void
 83+ */
7684 private function run( $resultPageSet = null ) {
7785 $repo = $this->mRepo;
7886 if ( !$repo instanceof LocalRepo ) {
Index: trunk/phase3/includes/api/ApiQuerySearch.php
@@ -48,6 +48,10 @@
4949 $this->run( $resultPageSet );
5050 }
5151
 52+ /**
 53+ * @param $resultPageSet ApiPageSet
 54+ * @return void
 55+ */
5256 private function run( $resultPageSet = null ) {
5357 global $wgContLang;
5458 $params = $this->extractRequestParams();
Index: trunk/phase3/includes/api/ApiQueryWatchlistRaw.php
@@ -49,6 +49,10 @@
5050 $this->run( $resultPageSet );
5151 }
5252
 53+ /**
 54+ * @param $resultPageSet ApiPageSet
 55+ * @return void
 56+ */
5357 private function run( $resultPageSet = null ) {
5458 $this->selectNamedDB( 'watchlist', DB_SLAVE, 'watchlist' );
5559
Index: trunk/phase3/includes/api/ApiFormatRaw.php
@@ -38,7 +38,7 @@
3939 /**
4040 * Constructor
4141 * @param $main ApiMain object
42 - * @param $errorFallback Formatter object to fall back on for errors
 42+ * @param $errorFallback ApiFormatBase object to fall back on for errors
4343 */
4444 public function __construct( $main, $errorFallback ) {
4545 parent::__construct( $main, 'raw' );
Index: trunk/phase3/includes/api/ApiQueryProtectedTitles.php
@@ -48,6 +48,10 @@
4949 $this->run( $resultPageSet );
5050 }
5151
 52+ /**
 53+ * @param $resultPageSet ApiPageSet
 54+ * @return void
 55+ */
5256 private function run( $resultPageSet = null ) {
5357 $params = $this->extractRequestParams();
5458
Index: trunk/phase3/includes/api/ApiQuery.php
@@ -627,7 +627,7 @@
628628 $moduleDescriptions = array();
629629
630630 foreach ( $moduleList as $moduleName => $moduleClass ) {
631 - $module = new $moduleClass ( $this, $moduleName, null );
 631+ $module = new $moduleClass( $this, $moduleName, null );
632632
633633 $msg = ApiMain::makeHelpMsgHeader( $module, $paramName );
634634 $msg2 = $module->makeHelpMsg();
Index: trunk/phase3/includes/api/ApiQueryImageInfo.php
@@ -117,8 +117,7 @@
118118 if (
119119 ( is_null( $start ) || $img->getTimestamp() <= $start ) &&
120120 ( is_null( $params['end'] ) || $img->getTimestamp() >= $params['end'] )
121 - )
122 - {
 121+ ) {
123122 $gotOne = true;
124123
125124 $fit = $this->addPageSubItem( $pageId,
@@ -352,7 +351,7 @@
353352 return $vals;
354353 }
355354
356 - /*
 355+ /**
357356 *
358357 * @param $metadata Array
359358 * @param $result ApiResult
@@ -379,6 +378,10 @@
380379 return 'public';
381380 }
382381
 382+ /**
 383+ * @param $img File
 384+ * @return string
 385+ */
383386 private function getContinueStr( $img ) {
384387 return $img->getOriginalTitle()->getText() .
385388 '|' . $img->getTimestamp();
Index: trunk/phase3/includes/api/ApiQueryIWBacklinks.php
@@ -48,6 +48,10 @@
4949 $this->run( $resultPageSet );
5050 }
5151
 52+ /**
 53+ * @param $resultPageSet ApiPageSet
 54+ * @return void
 55+ */
5256 public function run( $resultPageSet = null ) {
5357 $params = $this->extractRequestParams();
5458
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php
@@ -53,6 +53,10 @@
5454 $fld_timestamp = false, $fld_user = false, $fld_comment = false, $fld_parsedcomment = false, $fld_sizes = false,
5555 $fld_notificationtimestamp = false, $fld_userid = false;
5656
 57+ /**
 58+ * @param $resultPageSet ApiPageSet
 59+ * @return void
 60+ */
5761 private function run( $resultPageSet = null ) {
5862 $this->selectNamedDB( 'watchlist', DB_SLAVE, 'watchlist' );
5963
Index: trunk/phase3/includes/api/ApiQueryQueryPage.php
@@ -60,6 +60,10 @@
6161 $this->run( $resultPageSet );
6262 }
6363
 64+ /**
 65+ * @param $resultPageSet ApiPageSet
 66+ * @return void
 67+ */
6468 public function run( $resultPageSet = null ) {
6569 global $wgUser;
6670 $params = $this->extractRequestParams();
Index: trunk/phase3/includes/api/ApiQueryRevisions.php
@@ -73,6 +73,13 @@
7474 return $this->tokenFunctions;
7575 }
7676
 77+ /**
 78+ * @static
 79+ * @param $pageid
 80+ * @param $title Title
 81+ * @param $rev Revision
 82+ * @return bool|String
 83+ */
7784 public static function getRollbackToken( $pageid, $title, $rev ) {
7885 global $wgUser;
7986 if ( !$wgUser->isAllowed( 'rollback' ) ) {
Index: trunk/phase3/includes/api/ApiQueryCategories.php
@@ -52,6 +52,10 @@
5353 $this->run( $resultPageSet );
5454 }
5555
 56+ /**
 57+ * @param $resultPageSet ApiPageSet
 58+ * @return
 59+ */
5660 private function run( $resultPageSet = null ) {
5761 if ( $this->getPageSet()->getGoodTitleCount() == 0 ) {
5862 return; // nothing to do
Index: trunk/phase3/includes/api/ApiQueryInfo.php
@@ -47,6 +47,10 @@
4848 parent::__construct( $query, $moduleName, 'in' );
4949 }
5050
 51+ /**
 52+ * @param $pageSet ApiPageSet
 53+ * @return void
 54+ */
5155 public function requestExtraData( $pageSet ) {
5256 global $wgDisableCounters;
5357
Index: trunk/phase3/includes/api/ApiQueryDuplicateFiles.php
@@ -52,6 +52,10 @@
5353 $this->run( $resultPageSet );
5454 }
5555
 56+ /**
 57+ * @param $resultPageSet ApiPageSet
 58+ * @return
 59+ */
5660 private function run( $resultPageSet = null ) {
5761 $params = $this->extractRequestParams();
5862 $namespaces = $this->getPageSet()->getAllTitlesByNamespace();
Index: trunk/phase3/includes/api/ApiQueryTags.php
@@ -36,7 +36,12 @@
3737 */
3838 class ApiQueryTags extends ApiQueryBase {
3939
40 - private $limit, $result;
 40+ /**
 41+ * @var ApiResult
 42+ */
 43+ private $result;
 44+
 45+ private $limit;
4146 private $fld_displayname = false, $fld_description = false,
4247 $fld_hitcount = false;
4348
Index: trunk/phase3/includes/api/ApiUpload.php
@@ -33,7 +33,12 @@
3434 * @ingroup API
3535 */
3636 class ApiUpload extends ApiBase {
 37+
 38+ /**
 39+ * @var UploadBase
 40+ */
3741 protected $mUpload = null;
 42+
3843 protected $mParams;
3944
4045 public function __construct( $main, $action ) {
@@ -138,7 +143,6 @@
139144 return $sessionKey;
140145 }
141146
142 -
143147 /**
144148 * Select an upload module and set it to mUpload. Dies on failure. If the
145149 * request was a status request and not a true upload, returns false;
@@ -376,7 +380,6 @@
377381 $result['result'] = 'Success';
378382 $result['filename'] = $file->getName();
379383
380 -
381384 return $result;
382385 }
383386
Index: trunk/phase3/includes/api/ApiQueryUsers.php
@@ -66,6 +66,11 @@
6767 return $this->tokenFunctions;
6868 }
6969
 70+ /**
 71+ * @static
 72+ * @param $user User
 73+ * @return String
 74+ */
7075 public static function getUserrightsToken( $user ) {
7176 global $wgUser;
7277 // Since the permissions check for userrights is non-trivial,
Index: trunk/phase3/includes/api/ApiQueryImages.php
@@ -48,6 +48,10 @@
4949 $this->run( $resultPageSet );
5050 }
5151
 52+ /**
 53+ * @param $resultPageSet ApiPageSet
 54+ * @return
 55+ */
5256 private function run( $resultPageSet = null ) {
5357 if ( $this->getPageSet()->getGoodTitleCount() == 0 ) {
5458 return; // nothing to do

Status & tagging log