Documentation
authorSam Reed <reedy@users.mediawiki.org>
Thu, 27 Oct 2011 00:46:17 +0000 (00:46 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Thu, 27 Oct 2011 00:46:17 +0000 (00:46 +0000)
Deprecated code updates

14 files changed:
includes/api/ApiBase.php
includes/api/ApiBlock.php
includes/api/ApiDelete.php
includes/api/ApiFeedContributions.php
includes/api/ApiFeedWatchlist.php
includes/api/ApiFormatBase.php
includes/api/ApiParse.php
includes/api/ApiQueryDeletedrevs.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryRecentChanges.php
includes/api/ApiQueryRevisions.php
includes/api/ApiQueryUserInfo.php
includes/api/ApiQueryUsers.php
includes/api/ApiUnblock.php

index 861da5b..e0167d9 100644 (file)
@@ -436,6 +436,7 @@ abstract class ApiBase extends ContextSource {
         * Callback for preg_replace_callback() call in makeHelpMsg().
         * Replaces a source file name with a link to ViewVC
         *
+        * @param $matches array
         * @return string
         */
        public function makeHelpMsg_callback( $matches ) {
index 65001d6..56c6289 100644 (file)
@@ -52,7 +52,7 @@ class ApiBlock extends ApiBase {
                $params = $this->extractRequestParams();
 
                if ( $params['gettoken'] ) {
-                       $res['blocktoken'] = $user->editToken( '', $this->getMain()->getRequest() );
+                       $res['blocktoken'] = $user->getEditToken( '', $this->getMain()->getRequest() );
                        $this->getResult()->addValue( null, $this->getModuleName(), $res );
                        return;
                }
index de324e4..83cf6f0 100644 (file)
@@ -98,20 +98,15 @@ class ApiDelete extends ApiBase {
        }
 
        /**
-        *
-        * @param &$title Title
+        * @param $title Title
         * @param $token String
+        * @return array
         */
        private static function getPermissionsError( &$title, $token ) {
                global $wgUser;
 
                // Check permissions
-               $errors = $title->getUserPermissionsErrors( 'delete', $wgUser );
-               if ( count( $errors ) > 0 ) {
-                       return $errors;
-               }
-
-               return array();
+               return $title->getUserPermissionsErrors( 'delete', $wgUser );
        }
 
        /**
index 66559c2..e2b6900 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  *
  *
@@ -206,4 +205,4 @@ class ApiFeedContributions extends ApiBase {
        public function getVersion() {
                return __CLASS__ . ': $Id$';
        }
-}
\ No newline at end of file
+}
index 2346b32..e77a08c 100644 (file)
@@ -152,6 +152,10 @@ class ApiFeedWatchlist extends ApiBase {
                }
        }
 
+       /**
+        * @param $info array
+        * @return FeedItem
+        */
        private function createFeedItem( $info ) {
                $titleStr = $info['title'];
                $title = Title::newFromText( $titleStr );
index 036d113..65b11f1 100644 (file)
@@ -235,8 +235,10 @@ See <a href='http://www.mediawiki.org/wiki/API'>complete documentation</a>, or
        public function getBuffer() {
                return $this->mBuffer;
        }
+
        /**
         * Set the flag to buffer the result instead of printing it.
+        * @param $value bool
         */
        public function setBufferResult( $value ) {
                $this->mBufferResult = $value;
@@ -335,6 +337,8 @@ class ApiFormatFeedWrapper extends ApiFormatBase {
 
        /**
         * Feed does its own headers
+        *
+        * @return null
         */
        public function getMimeType() {
                return null;
index 1c80b27..cfc2fb2 100644 (file)
@@ -390,6 +390,8 @@ class ApiParse extends ApiBase {
        /**
         * @deprecated since 1.18 No modern skin generates language links this way, please use language links
         *                        data to generate your own HTML.
+        * @param $languages array
+        * @return string
         */
        private function languagesHtml( $languages ) {
                global $wgContLang, $wgHideInterlanguageLinks;
index 62ae9e3..546e081 100644 (file)
@@ -132,7 +132,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
 
                if ( $fld_token ) {
                        // Undelete tokens are identical for all pages, so we cache one here
-                       $token = $user->editToken( '', $this->getMain()->getRequest() );
+                       $token = $user->getEditToken( '', $this->getMain()->getRequest() );
                }
 
                $dir = $params['dir'];
index b56775c..fe98bb3 100644 (file)
@@ -119,7 +119,7 @@ class ApiQueryInfo extends ApiQueryBase {
                        return $cachedEditToken;
                }
 
-               $cachedEditToken = $wgUser->editToken();
+               $cachedEditToken = $wgUser->getEditToken();
                return $cachedEditToken;
        }
 
@@ -134,7 +134,7 @@ class ApiQueryInfo extends ApiQueryBase {
                        return $cachedDeleteToken;
                }
 
-               $cachedDeleteToken = $wgUser->editToken();
+               $cachedDeleteToken = $wgUser->getEditToken();
                return $cachedDeleteToken;
        }
 
@@ -149,7 +149,7 @@ class ApiQueryInfo extends ApiQueryBase {
                        return $cachedProtectToken;
                }
 
-               $cachedProtectToken = $wgUser->editToken();
+               $cachedProtectToken = $wgUser->getEditToken();
                return $cachedProtectToken;
        }
 
@@ -164,7 +164,7 @@ class ApiQueryInfo extends ApiQueryBase {
                        return $cachedMoveToken;
                }
 
-               $cachedMoveToken = $wgUser->editToken();
+               $cachedMoveToken = $wgUser->getEditToken();
                return $cachedMoveToken;
        }
 
@@ -179,7 +179,7 @@ class ApiQueryInfo extends ApiQueryBase {
                        return $cachedBlockToken;
                }
 
-               $cachedBlockToken = $wgUser->editToken();
+               $cachedBlockToken = $wgUser->getEditToken();
                return $cachedBlockToken;
        }
 
@@ -199,7 +199,7 @@ class ApiQueryInfo extends ApiQueryBase {
                        return $cachedEmailToken;
                }
 
-               $cachedEmailToken = $wgUser->editToken();
+               $cachedEmailToken = $wgUser->getEditToken();
                return $cachedEmailToken;
        }
 
@@ -214,7 +214,7 @@ class ApiQueryInfo extends ApiQueryBase {
                        return $cachedImportToken;
                }
 
-               $cachedImportToken = $wgUser->editToken();
+               $cachedImportToken = $wgUser->getEditToken();
                return $cachedImportToken;
        }
 
@@ -229,7 +229,7 @@ class ApiQueryInfo extends ApiQueryBase {
                        return $cachedWatchToken;
                }
 
-               $cachedWatchToken = $wgUser->editToken( 'watch' );
+               $cachedWatchToken = $wgUser->getEditToken( 'watch' );
                return $cachedWatchToken;
        }
 
index 9bcbefb..7d62f33 100644 (file)
@@ -52,7 +52,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
         * Get an array mapping token names to their handler functions.
         * The prototype for a token function is func($pageid, $title, $rc)
         * it should return a token or false (permission denied)
-        * @return array(tokenname => function)
+        * @return array array(tokenname => function)
         */
        protected function getTokenFunctions() {
                // Don't call the hooks twice
@@ -89,7 +89,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                // The patrol token is always the same, let's exploit that
                static $cachedPatrolToken = null;
                if ( is_null( $cachedPatrolToken ) ) {
-                       $cachedPatrolToken = $wgUser->editToken( 'patrol' );
+                       $cachedPatrolToken = $wgUser->getEditToken( 'patrol' );
                }
 
                return $cachedPatrolToken;
index 018449a..807b201 100644 (file)
@@ -84,8 +84,8 @@ class ApiQueryRevisions extends ApiQueryBase {
                if ( !$wgUser->isAllowed( 'rollback' ) ) {
                        return false;
                }
-               return $wgUser->editToken( array( $title->getPrefixedText(),
-                                               $rev->getUserText() ) );
+               return $wgUser->getEditToken(
+                       array( $title->getPrefixedText(), $rev->getUserText() ) );
        }
 
        public function execute() {
index 5fd9bb1..ca1dfb6 100644 (file)
@@ -110,7 +110,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
                if ( isset( $this->prop['preferencestoken'] ) &&
                        is_null( $this->getMain()->getRequest()->getVal( 'callback' ) )
                ) {
-                       $vals['preferencestoken'] = $user->editToken( '', $this->getMain()->getRequest() );
+                       $vals['preferencestoken'] = $user->getEditToken( '', $this->getMain()->getRequest() );
                }
 
                if ( isset( $this->prop['editcount'] ) ) {
index a76bfed..76f815c 100644 (file)
@@ -74,7 +74,7 @@ class ApiQueryUsers extends ApiQueryBase {
                global $wgUser;
                // Since the permissions check for userrights is non-trivial,
                // don't bother with it here
-               return $wgUser->editToken( $user->getName() );
+               return $wgUser->getEditToken( $user->getName() );
        }
 
        public function execute() {
index a2921bd..4115727 100644 (file)
@@ -49,7 +49,7 @@ class ApiUnblock extends ApiBase {
                $params = $this->extractRequestParams();
 
                if ( $params['gettoken'] ) {
-                       $res['unblocktoken'] = $user->editToken( '', $this->getMain()->getRequest() );
+                       $res['unblocktoken'] = $user->getEditToken( '', $this->getMain()->getRequest() );
                        $this->getResult()->addValue( null, $this->getModuleName(), $res );
                        return;
                }