Deprecate llurl= in favour of llprop=url for action=query&prop=langlinks
authorumherirrender <umherirrender_de.wp@web.de>
Tue, 11 Feb 2014 18:29:10 +0000 (19:29 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Tue, 11 Feb 2014 18:29:10 +0000 (19:29 +0100)
New props will be added with I54c66c8935b0dbbf3bf8e292236119597f1cbe41

Change-Id: I1340b18b51bccdfaaddec6a16df320d5f6e5acfa

RELEASE-NOTES-1.23
includes/api/ApiQueryLangLinks.php

index 4fc198a..ffda350 100644 (file)
@@ -164,6 +164,7 @@ production.
   possible page restriction (protection) levels and types.
 * Added prop 'limitreportdata' and 'limitreporthtml' to action=parse.
 * (bug 58627) Provide language names on action=parse&prop=langlinks.
+* Deprecated llurl= in favour of llprop=url for action=query&prop=langlinks.
 
 === Languages updated in 1.23 ===
 
index a20b855..506bd2e 100644 (file)
@@ -41,11 +41,18 @@ class ApiQueryLangLinks extends ApiQueryBase {
                }
 
                $params = $this->extractRequestParams();
+               $prop = array_flip( (array)$params['prop'] );
 
                if ( isset( $params['title'] ) && !isset( $params['lang'] ) ) {
                        $this->dieUsageMsg( array( 'missingparam', 'lang' ) );
                }
 
+               // Handle deprecated param
+               $this->requireMaxOneParameter( $params, 'url', 'prop' );
+               if ( $params['url'] ) {
+                       $prop = array( 'url' => 1 );
+               }
+
                $this->addFields( array(
                        'll_from',
                        'll_lang',
@@ -104,7 +111,7 @@ class ApiQueryLangLinks extends ApiQueryBase {
                                break;
                        }
                        $entry = array( 'lang' => $row->ll_lang );
-                       if ( $params['url'] ) {
+                       if ( isset( $prop['url'] ) ) {
                                $title = Title::newFromText( "{$row->ll_lang}:{$row->ll_title}" );
                                if ( $title ) {
                                        $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
@@ -133,7 +140,16 @@ class ApiQueryLangLinks extends ApiQueryBase {
                                ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
                        ),
                        'continue' => null,
-                       'url' => false,
+                       'url' => array(
+                               ApiBase::PARAM_DFLT => false,
+                               ApiBase::PARAM_DEPRECATED => true,
+                       ),
+                       'prop' => array(
+                               ApiBase::PARAM_ISMULTI => true,
+                               ApiBase::PARAM_TYPE => array(
+                                       'url',
+                               )
+                       ),
                        'lang' => null,
                        'title' => null,
                        'dir' => array(
@@ -150,7 +166,11 @@ class ApiQueryLangLinks extends ApiQueryBase {
                return array(
                        'limit' => 'How many langlinks to return',
                        'continue' => 'When more results are available, use this to continue',
-                       'url' => 'Whether to get the full URL',
+                       'url' => "Whether to get the full URL (Cannot be used with {$this->getModulePrefix()}prop)",
+                       'prop' => array(
+                               'Which additional properties to get for each interlanguage link',
+                               ' url - Adds the full URL',
+                       ),
                        'lang' => 'Language code',
                        'title' => "Link to search for. Must be used with {$this->getModulePrefix()}lang",
                        'dir' => 'The direction in which to list',
@@ -175,9 +195,14 @@ class ApiQueryLangLinks extends ApiQueryBase {
        }
 
        public function getPossibleErrors() {
-               return array_merge( parent::getPossibleErrors(), array(
-                       array( 'missingparam', 'lang' ),
-               ) );
+               return array_merge( parent::getPossibleErrors(),
+                       $this->getRequireMaxOneParameterErrorMessages(
+                               array( 'url', 'prop' )
+                       ),
+                       array(
+                               array( 'missingparam', 'lang' ),
+                       )
+               );
        }
 
        public function getExamples() {