Merge "API: Internationalize all remaining core API modules"
[lhc/web/wiklou.git] / includes / api / ApiQueryInfo.php
index be1de93..3a924b0 100644 (file)
@@ -64,9 +64,6 @@ class ApiQueryInfo extends ApiQueryBase {
                }
                $pageSet->requestField( 'page_is_new' );
                $config = $this->getConfig();
-               if ( !$config->get( 'DisableCounters' ) ) {
-                       $pageSet->requestField( 'page_counter' );
-               }
                $pageSet->requestField( 'page_touched' );
                $pageSet->requestField( 'page_latest' );
                $pageSet->requestField( 'page_len' );
@@ -79,6 +76,7 @@ class ApiQueryInfo extends ApiQueryBase {
         * Get an array mapping token names to their handler functions.
         * The prototype for a token function is func($pageid, $title)
         * it should return a token or false (permission denied)
+        * @deprecated since 1.24
         * @return array Array(tokenname => function)
         */
        protected function getTokenFunctions() {
@@ -110,10 +108,16 @@ class ApiQueryInfo extends ApiQueryBase {
 
        static protected $cachedTokens = array();
 
+       /**
+        * @deprecated since 1.24
+        */
        public static function resetTokenCache() {
                ApiQueryInfo::$cachedTokens = array();
        }
 
+       /**
+        * @deprecated since 1.24
+        */
        public static function getEditToken( $pageid, $title ) {
                // We could check for $title->userCan('edit') here,
                // but that's too expensive for this purpose
@@ -131,6 +135,9 @@ class ApiQueryInfo extends ApiQueryBase {
                return ApiQueryInfo::$cachedTokens['edit'];
        }
 
+       /**
+        * @deprecated since 1.24
+        */
        public static function getDeleteToken( $pageid, $title ) {
                global $wgUser;
                if ( !$wgUser->isAllowed( 'delete' ) ) {
@@ -145,6 +152,9 @@ class ApiQueryInfo extends ApiQueryBase {
                return ApiQueryInfo::$cachedTokens['delete'];
        }
 
+       /**
+        * @deprecated since 1.24
+        */
        public static function getProtectToken( $pageid, $title ) {
                global $wgUser;
                if ( !$wgUser->isAllowed( 'protect' ) ) {
@@ -159,6 +169,9 @@ class ApiQueryInfo extends ApiQueryBase {
                return ApiQueryInfo::$cachedTokens['protect'];
        }
 
+       /**
+        * @deprecated since 1.24
+        */
        public static function getMoveToken( $pageid, $title ) {
                global $wgUser;
                if ( !$wgUser->isAllowed( 'move' ) ) {
@@ -173,6 +186,9 @@ class ApiQueryInfo extends ApiQueryBase {
                return ApiQueryInfo::$cachedTokens['move'];
        }
 
+       /**
+        * @deprecated since 1.24
+        */
        public static function getBlockToken( $pageid, $title ) {
                global $wgUser;
                if ( !$wgUser->isAllowed( 'block' ) ) {
@@ -187,11 +203,17 @@ class ApiQueryInfo extends ApiQueryBase {
                return ApiQueryInfo::$cachedTokens['block'];
        }
 
+       /**
+        * @deprecated since 1.24
+        */
        public static function getUnblockToken( $pageid, $title ) {
                // Currently, this is exactly the same as the block token
                return self::getBlockToken( $pageid, $title );
        }
 
+       /**
+        * @deprecated since 1.24
+        */
        public static function getEmailToken( $pageid, $title ) {
                global $wgUser;
                if ( !$wgUser->canSendEmail() || $wgUser->isBlockedFromEmailUser() ) {
@@ -206,6 +228,9 @@ class ApiQueryInfo extends ApiQueryBase {
                return ApiQueryInfo::$cachedTokens['email'];
        }
 
+       /**
+        * @deprecated since 1.24
+        */
        public static function getImportToken( $pageid, $title ) {
                global $wgUser;
                if ( !$wgUser->isAllowedAny( 'import', 'importupload' ) ) {
@@ -220,6 +245,9 @@ class ApiQueryInfo extends ApiQueryBase {
                return ApiQueryInfo::$cachedTokens['import'];
        }
 
+       /**
+        * @deprecated since 1.24
+        */
        public static function getWatchToken( $pageid, $title ) {
                global $wgUser;
                if ( !$wgUser->isLoggedIn() ) {
@@ -234,6 +262,9 @@ class ApiQueryInfo extends ApiQueryBase {
                return ApiQueryInfo::$cachedTokens['watch'];
        }
 
+       /**
+        * @deprecated since 1.24
+        */
        public static function getOptionsToken( $pageid, $title ) {
                global $wgUser;
                if ( !$wgUser->isLoggedIn() ) {
@@ -294,9 +325,6 @@ class ApiQueryInfo extends ApiQueryBase {
                        : array();
                $this->pageIsNew = $pageSet->getCustomField( 'page_is_new' );
 
-               if ( !$this->getConfig()->get( 'DisableCounters' ) ) {
-                       $this->pageCounter = $pageSet->getCustomField( 'page_counter' );
-               }
                $this->pageTouched = $pageSet->getCustomField( 'page_touched' );
                $this->pageLatest = $pageSet->getCustomField( 'page_latest' );
                $this->pageLength = $pageSet->getCustomField( 'page_len' );
@@ -358,9 +386,6 @@ class ApiQueryInfo extends ApiQueryBase {
                if ( $titleExists ) {
                        $pageInfo['touched'] = wfTimestamp( TS_ISO_8601, $this->pageTouched[$pageid] );
                        $pageInfo['lastrevid'] = intval( $this->pageLatest[$pageid] );
-                       $pageInfo['counter'] = $this->getConfig()->get( 'DisableCounters' )
-                               ? ''
-                               : intval( $this->pageCounter[$pageid] );
                        $pageInfo['length'] = intval( $this->pageLength[$pageid] );
 
                        if ( isset( $this->pageIsRedir[$pageid] ) && $this->pageIsRedir[$pageid] ) {
@@ -424,6 +449,7 @@ class ApiQueryInfo extends ApiQueryBase {
                if ( $this->fld_url ) {
                        $pageInfo['fullurl'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
                        $pageInfo['editurl'] = wfExpandUrl( $title->getFullURL( 'action=edit' ), PROTO_CURRENT );
+                       $pageInfo['canonicalurl'] = wfExpandUrl( $title->getFullURL(), PROTO_CANONICAL );
                }
                if ( $this->fld_readable && $title->userCan( 'read', $this->getUser() ) ) {
                        $pageInfo['readable'] = '';
@@ -784,42 +810,23 @@ class ApiQueryInfo extends ApiQueryBase {
                                        // need to be added to getCacheMode()
                                ) ),
                        'token' => array(
+                               ApiBase::PARAM_DEPRECATED => true,
                                ApiBase::PARAM_DFLT => null,
                                ApiBase::PARAM_ISMULTI => true,
                                ApiBase::PARAM_TYPE => array_keys( $this->getTokenFunctions() )
                        ),
-                       'continue' => null,
-               );
-       }
-
-       public function getParamDescription() {
-               return array(
-                       'prop' => array(
-                               'Which additional properties to get:',
-                               ' protection            - List the protection level of each page',
-                               ' talkid                - The page ID of the talk page for each non-talk page',
-                               ' watched               - List the watched status of each page',
-                               ' watchers              - The number of watchers, if allowed',
-                               ' notificationtimestamp - The watchlist notification timestamp of each page',
-                               ' subjectid             - The page ID of the parent page for each talk page',
-                               ' url                   - Gives a full URL to the page, and also an edit URL',
-                               ' readable              - Whether the user can read this page',
-                               ' preload               - Gives the text returned by EditFormPreloadText',
-                               ' displaytitle          - Gives the way the page title is actually displayed',
+                       'continue' => array(
+                               ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
                        ),
-                       'token' => 'Request a token to perform a data-modifying action on a page',
-                       'continue' => 'When more results are available, use this to continue',
                );
        }
 
-       public function getDescription() {
-               return 'Get basic page information such as namespace, title, last touched date, ...';
-       }
-
-       public function getExamples() {
+       public function getExamplesMessages() {
                return array(
-                       'api.php?action=query&prop=info&titles=Main%20Page',
-                       'api.php?action=query&prop=info&inprop=protection&titles=Main%20Page'
+                       'action=query&prop=info&titles=Main%20Page'
+                               => 'apihelp-query+info-example-simple',
+                       'action=query&prop=info&inprop=protection&titles=Main%20Page'
+                               => 'apihelp-query+info-example-protection',
                );
        }