Documentation
authorSam Reed <reedy@users.mediawiki.org>
Sun, 8 May 2011 16:48:30 +0000 (16:48 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sun, 8 May 2011 16:48:30 +0000 (16:48 +0000)
Remove long deprecated isBot()/isSysop() in ApiMain

includes/api/ApiBase.php
includes/api/ApiMain.php

index 616f5a6..1c3da74 100644 (file)
@@ -122,6 +122,9 @@ abstract class ApiBase {
 
        /**
         * Get the name of the module as shown in the profiler log
+        *
+        * @param $db
+        *
         * @return string
         */
        public function getModuleProfileName( $db = false ) {
@@ -401,6 +404,8 @@ abstract class ApiBase {
        /**
         * Callback for preg_replace_callback() call in makeHelpMsg().
         * Replaces a source file name with a link to ViewVC
+        *
+        * @return string
         */
        public function makeHelpMsg_callback( $matches ) {
                global $wgAutoloadClasses, $wgAutoloadLocalClasses;
@@ -597,7 +602,7 @@ abstract class ApiBase {
         * @param $titleObj Title the page under consideration
         * @param $userOption String The user option to consider when $watchlist=preferences.
         *      If not set will magically default to either watchdefault or watchcreations
-        * @returns Boolean
+        * @return bool
         */
        protected function getWatchlistValue ( $watchlist, $titleObj, $userOption = null ) {
 
@@ -1181,7 +1186,7 @@ abstract class ApiBase {
 
        /**
         * Returns whether this module requires a Token to execute
-        * @returns bool
+        * @return bool
         */
        public function needsToken() {
                return false;
@@ -1189,17 +1194,18 @@ abstract class ApiBase {
 
        /**
         * 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
-        * @returns bool
+        * @return bool
         */
        public function getTokenSalt() {
                return false;
        }
 
        /**
-       * Gets the user for whom to get the watchlist
-       *
-       * @returns User
-       */
+        * Gets the user for whom to get the watchlist
+        *
+        * @param $params array
+        * @return User
+        */
        public function getWatchlistUser( $params ) {
                global $wgUser;
                if ( !is_null( $params['owner'] ) && !is_null( $params['token'] ) ) {
index 4ea30da..cf06e5a 100644 (file)
@@ -225,6 +225,8 @@ class ApiMain extends ApiBase {
 
        /**
         * Set how long the response should be cached.
+        *
+        * @param $maxage
         */
        public function setCacheMaxAge( $maxage ) {
                $this->setCacheControl( array(
@@ -315,6 +317,8 @@ class ApiMain extends ApiBase {
        /**
         * Create an instance of an output formatter by its name
         *
+        * @param $format string
+        *
         * @return ApiFormatBase
         */
        public function createPrinterByName( $format ) {
@@ -676,6 +680,8 @@ class ApiMain extends ApiBase {
 
        /**
         * Print results using the current printer
+        *
+        * @param $isError bool
         */
        protected function printResult( $isError ) {
                $this->getResult()->cleanUpUTF8();
@@ -706,6 +712,8 @@ class ApiMain extends ApiBase {
 
        /**
         * See ApiBase for description.
+        *
+        * @return array
         */
        public function getAllowedParams() {
                return array(
@@ -736,6 +744,8 @@ class ApiMain extends ApiBase {
 
        /**
         * See ApiBase for description.
+        *
+        * @return array
         */
        public function getParamDescription() {
                return array(
@@ -752,6 +762,8 @@ class ApiMain extends ApiBase {
 
        /**
         * See ApiBase for description.
+        *
+        * @return array
         */
        public function getDescription() {
                return array(
@@ -782,6 +794,9 @@ class ApiMain extends ApiBase {
                );
        }
 
+       /**
+        * @return array
+        */
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
                        array( 'readonlytext' ),
@@ -794,6 +809,7 @@ class ApiMain extends ApiBase {
 
        /**
         * Returns an array of strings with credits for the API
+        * @return array
         */
        protected function getCredits() {
                return array(
@@ -808,8 +824,11 @@ class ApiMain extends ApiBase {
                        'or file a bug report at http://bugzilla.wikimedia.org/'
                );
        }
+
        /**
         * Sets whether the pretty-printer should format *bold* and $italics$
+        *
+        * @param $help bool
         */
        public function setHelp( $help = true ) {
                $this->mPrinter->setHelp( $help );
@@ -817,6 +836,8 @@ class ApiMain extends ApiBase {
 
        /**
         * Override the parent to generate help messages for all available modules.
+        *
+        * @return string
         */
        public function makeHelpMsg() {
                global $wgMemc, $wgAPICacheHelpTimeout;
@@ -838,6 +859,9 @@ class ApiMain extends ApiBase {
                return $retval;
        }
 
+       /**
+        * @return mixed|string
+        */
        public function reallyMakeHelpMsg() {
                $this->setHelp();
 
@@ -881,8 +905,8 @@ class ApiMain extends ApiBase {
        }
 
        /**
-        * @param  $module ApiBase
-        * @param  $paramName String What type of request is this? e.g. action, query, list, prop, meta, format
+        * @param $module ApiBase
+        * @param $paramName String What type of request is this? e.g. action, query, list, prop, meta, format
         * @return string
         */
        public static function makeHelpMsgHeader( $module, $paramName ) {
@@ -894,36 +918,8 @@ class ApiMain extends ApiBase {
                return "* $paramName={$module->getModuleName()} $modulePrefix*";
        }
 
-       private $mIsBot = null;
-       private $mIsSysop = null;
        private $mCanApiHighLimits = null;
 
-       /**
-        * Returns true if the currently logged in user is a bot, false otherwise
-        * OBSOLETE, use canApiHighLimits() instead
-        */
-       public function isBot() {
-               if ( !isset( $this->mIsBot ) ) {
-                       global $wgUser;
-                       $this->mIsBot = $wgUser->isAllowed( 'bot' );
-               }
-               return $this->mIsBot;
-       }
-
-       /**
-        * Similar to isBot(), this method returns true if the logged in user is
-        * a sysop, and false if not.
-        * OBSOLETE, use canApiHighLimits() instead
-        */
-       public function isSysop() {
-               if ( !isset( $this->mIsSysop ) ) {
-                       global $wgUser;
-                       $this->mIsSysop = in_array( 'sysop', $wgUser->getGroups() );
-               }
-
-               return $this->mIsSysop;
-       }
-
        /**
         * Check whether the current user is allowed to use high limits
         * @return bool
@@ -948,9 +944,11 @@ class ApiMain extends ApiBase {
        /**
         * Returns the version information of this file, plus it includes
         * the versions for all files that are not callable proper API modules
+        *
+        * @return array
         */
        public function getVersion() {
-               $vers = array ();
+               $vers = array();
                $vers[] = 'MediaWiki: ' . SpecialVersion::getVersion() . "\n    http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/";
                $vers[] = __CLASS__ . ': $Id$';
                $vers[] = ApiBase::getBaseVersion();
@@ -975,8 +973,8 @@ class ApiMain extends ApiBase {
         * Add or overwrite an output format for this ApiMain. Intended for use by extending
         * classes who wish to add to or modify current formatters.
         *
-        * @param $fmtName The identifier for this format.
-        * @param $fmtClass The class implementing this format.
+        * @param $fmtName string The identifier for this format.
+        * @param $fmtClass ApiFormatBase The class implementing this format.
         */
        protected function addFormat( $fmtName, $fmtClass ) {
                $this->mFormats[$fmtName] = $fmtClass;