r87687 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87686‎ | r87687 | r87688 >
Date:16:48, 8 May 2011
Author:reedy
Status:ok
Tags:
Comment:
Documentation

Remove long deprecated isBot()/isSysop() in ApiMain
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiMain.php
@@ -225,6 +225,8 @@
226226
227227 /**
228228 * Set how long the response should be cached.
 229+ *
 230+ * @param $maxage
229231 */
230232 public function setCacheMaxAge( $maxage ) {
231233 $this->setCacheControl( array(
@@ -315,6 +317,8 @@
316318 /**
317319 * Create an instance of an output formatter by its name
318320 *
 321+ * @param $format string
 322+ *
319323 * @return ApiFormatBase
320324 */
321325 public function createPrinterByName( $format ) {
@@ -676,6 +680,8 @@
677681
678682 /**
679683 * Print results using the current printer
 684+ *
 685+ * @param $isError bool
680686 */
681687 protected function printResult( $isError ) {
682688 $this->getResult()->cleanUpUTF8();
@@ -706,6 +712,8 @@
707713
708714 /**
709715 * See ApiBase for description.
 716+ *
 717+ * @return array
710718 */
711719 public function getAllowedParams() {
712720 return array(
@@ -736,6 +744,8 @@
737745
738746 /**
739747 * See ApiBase for description.
 748+ *
 749+ * @return array
740750 */
741751 public function getParamDescription() {
742752 return array(
@@ -752,6 +762,8 @@
753763
754764 /**
755765 * See ApiBase for description.
 766+ *
 767+ * @return array
756768 */
757769 public function getDescription() {
758770 return array(
@@ -782,6 +794,9 @@
783795 );
784796 }
785797
 798+ /**
 799+ * @return array
 800+ */
786801 public function getPossibleErrors() {
787802 return array_merge( parent::getPossibleErrors(), array(
788803 array( 'readonlytext' ),
@@ -794,6 +809,7 @@
795810
796811 /**
797812 * Returns an array of strings with credits for the API
 813+ * @return array
798814 */
799815 protected function getCredits() {
800816 return array(
@@ -808,8 +824,11 @@
809825 'or file a bug report at http://bugzilla.wikimedia.org/'
810826 );
811827 }
 828+
812829 /**
813830 * Sets whether the pretty-printer should format *bold* and $italics$
 831+ *
 832+ * @param $help bool
814833 */
815834 public function setHelp( $help = true ) {
816835 $this->mPrinter->setHelp( $help );
@@ -817,6 +836,8 @@
818837
819838 /**
820839 * Override the parent to generate help messages for all available modules.
 840+ *
 841+ * @return string
821842 */
822843 public function makeHelpMsg() {
823844 global $wgMemc, $wgAPICacheHelpTimeout;
@@ -838,6 +859,9 @@
839860 return $retval;
840861 }
841862
 863+ /**
 864+ * @return mixed|string
 865+ */
842866 public function reallyMakeHelpMsg() {
843867 $this->setHelp();
844868
@@ -881,8 +905,8 @@
882906 }
883907
884908 /**
885 - * @param $module ApiBase
886 - * @param $paramName String What type of request is this? e.g. action, query, list, prop, meta, format
 909+ * @param $module ApiBase
 910+ * @param $paramName String What type of request is this? e.g. action, query, list, prop, meta, format
887911 * @return string
888912 */
889913 public static function makeHelpMsgHeader( $module, $paramName ) {
@@ -894,37 +918,9 @@
895919 return "* $paramName={$module->getModuleName()} $modulePrefix*";
896920 }
897921
898 - private $mIsBot = null;
899 - private $mIsSysop = null;
900922 private $mCanApiHighLimits = null;
901923
902924 /**
903 - * Returns true if the currently logged in user is a bot, false otherwise
904 - * OBSOLETE, use canApiHighLimits() instead
905 - */
906 - public function isBot() {
907 - if ( !isset( $this->mIsBot ) ) {
908 - global $wgUser;
909 - $this->mIsBot = $wgUser->isAllowed( 'bot' );
910 - }
911 - return $this->mIsBot;
912 - }
913 -
914 - /**
915 - * Similar to isBot(), this method returns true if the logged in user is
916 - * a sysop, and false if not.
917 - * OBSOLETE, use canApiHighLimits() instead
918 - */
919 - public function isSysop() {
920 - if ( !isset( $this->mIsSysop ) ) {
921 - global $wgUser;
922 - $this->mIsSysop = in_array( 'sysop', $wgUser->getGroups() );
923 - }
924 -
925 - return $this->mIsSysop;
926 - }
927 -
928 - /**
929925 * Check whether the current user is allowed to use high limits
930926 * @return bool
931927 */
@@ -948,9 +944,11 @@
949945 /**
950946 * Returns the version information of this file, plus it includes
951947 * the versions for all files that are not callable proper API modules
 948+ *
 949+ * @return array
952950 */
953951 public function getVersion() {
954 - $vers = array ();
 952+ $vers = array();
955953 $vers[] = 'MediaWiki: ' . SpecialVersion::getVersion() . "\n http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/";
956954 $vers[] = __CLASS__ . ': $Id$';
957955 $vers[] = ApiBase::getBaseVersion();
@@ -975,8 +973,8 @@
976974 * Add or overwrite an output format for this ApiMain. Intended for use by extending
977975 * classes who wish to add to or modify current formatters.
978976 *
979 - * @param $fmtName The identifier for this format.
980 - * @param $fmtClass The class implementing this format.
 977+ * @param $fmtName string The identifier for this format.
 978+ * @param $fmtClass ApiFormatBase The class implementing this format.
981979 */
982980 protected function addFormat( $fmtName, $fmtClass ) {
983981 $this->mFormats[$fmtName] = $fmtClass;
Index: trunk/phase3/includes/api/ApiBase.php
@@ -122,6 +122,9 @@
123123
124124 /**
125125 * Get the name of the module as shown in the profiler log
 126+ *
 127+ * @param $db
 128+ *
126129 * @return string
127130 */
128131 public function getModuleProfileName( $db = false ) {
@@ -401,6 +404,8 @@
402405 /**
403406 * Callback for preg_replace_callback() call in makeHelpMsg().
404407 * Replaces a source file name with a link to ViewVC
 408+ *
 409+ * @return string
405410 */
406411 public function makeHelpMsg_callback( $matches ) {
407412 global $wgAutoloadClasses, $wgAutoloadLocalClasses;
@@ -597,7 +602,7 @@
598603 * @param $titleObj Title the page under consideration
599604 * @param $userOption String The user option to consider when $watchlist=preferences.
600605 * If not set will magically default to either watchdefault or watchcreations
601 - * @returns Boolean
 606+ * @return bool
602607 */
603608 protected function getWatchlistValue ( $watchlist, $titleObj, $userOption = null ) {
604609
@@ -1181,7 +1186,7 @@
11821187
11831188 /**
11841189 * Returns whether this module requires a Token to execute
1185 - * @returns bool
 1190+ * @return bool
11861191 */
11871192 public function needsToken() {
11881193 return false;
@@ -1189,17 +1194,18 @@
11901195
11911196 /**
11921197 * Returns the token salt if there is one, '' if the module doesn't require a salt, else false if the module doesn't need a token
1193 - * @returns bool
 1198+ * @return bool
11941199 */
11951200 public function getTokenSalt() {
11961201 return false;
11971202 }
11981203
11991204 /**
1200 - * Gets the user for whom to get the watchlist
1201 - *
1202 - * @returns User
1203 - */
 1205+ * Gets the user for whom to get the watchlist
 1206+ *
 1207+ * @param $params array
 1208+ * @return User
 1209+ */
12041210 public function getWatchlistUser( $params ) {
12051211 global $wgUser;
12061212 if ( !is_null( $params['owner'] ) && !is_null( $params['token'] ) ) {

Status & tagging log