jenkins-bot has submitted this change and it was merged.

Change subject: Remove pre-1.25 API compatibility code
......................................................................


Remove pre-1.25 API compatibility code

Since this extension uses extension.json, it already requires 1.25+ so
no need to keep the old code around.

Change-Id: I58f66901e345dd58cb826277fe9fde0dd8a8180f
---
M includes/api/ApiMobileView.php
M includes/api/ApiParseExtender.php
M includes/specials/SpecialMobileLanguages.php
M tests/phpunit/api/ApiMobileViewTest.php
M tests/phpunit/api/ApiParseExtenderTest.php
5 files changed, 14 insertions(+), 122 deletions(-)

Approvals:
  Jforrester: Looks good to me, but someone else must approve
  Jdlrobson: Looks good to me, approved
  Bmansurov: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/api/ApiMobileView.php b/includes/api/ApiMobileView.php
index 49687ed..5237cc3 100644
--- a/includes/api/ApiMobileView.php
+++ b/includes/api/ApiMobileView.php
@@ -839,87 +839,6 @@
        }
 
        /**
-        * Get the description for Api parameters.
-        * @deprecated since MediaWiki core 1.25
-        * @return array
-        */
-       public function getParamDescription() {
-               $res = [
-                       'id' => 'Id of the page',
-                       'page' => 'Title of page to process',
-                       'redirect' => 'Whether redirects should be followed',
-                       'sections' => [
-                               'Pipe-separated list of section numbers for 
which to return text.',
-                               " `all' can be used to return for all. Ranges 
in format '1-4' mean get sections 1,2,3,4.",
-                               " Ranges without second number, e.g. '1-' means 
get all until the end.",
-                               " `references' can be used to specify that all 
sections containing references",
-                               " should be returned."
-                       ],
-                       'prop' => [
-                               'Which information to get',
-                               ' text            - HTML of selected 
section(s)',
-                               ' sections        - information about all 
sections on page',
-                               ' normalizedtitle - normalized page title',
-                               ' lastmodified    - ISO 8601 timestamp for when 
the page was last modified, '
-                                       . 'e.g. "2014-04-13T22:42:14Z"',
-                               ' lastmodifiedby  - information about the user 
who modified the page last',
-                               ' revision        - return the current revision 
id of the page',
-                               ' protection      - information about 
protection level',
-                               ' editable        - whether current user can 
edit this page. This includes '
-                                       . 'all factors for logged-in users but 
not blocked status for anons.',
-                               ' languagecount   - number of languages that 
the page is available in',
-                               ' hasvariants     - whether or not the page is 
available in other language variants',
-                               ' displaytitle    - HTML of the page title for 
display, with {{DISPLAYTITLE}} and such applied',
-                               ' pageprops       - page properties',
-                               ' description     - page description from 
Wikidata',
-                               ' contentmodel    - page contentmodel',
-                               ' namespace       - the namespace of the page',
-                       ],
-                       'sectionprop' => 'What information about sections to 
get',
-                       'pageprops' => 'What page properties to return, a pipe 
(|) separated list or * for'
-                               . ' all properties',
-                       'variant' => "Convert content into this language 
variant",
-                       'noimages' => 'Return HTML without images',
-                       'noheadings' => "Don't include headings in output",
-                       'notransform' => "Don't transform HTML into 
mobile-specific version",
-                       'onlyrequestedsections' => 'Return only requested 
sections even with prop=sections',
-                       'offset' =>
-                               'Pretend all text result is one string, and 
return the substring starting at this point',
-                       'maxlen' => 'Pretend all text result is one string, and 
limit result to this length',
-               ];
-               if ( $this->usePageImages ) {
-                       $res['prop'][] = ' image           - information about 
an image associated with this page';
-                       $res['prop'][] = ' thumb           - thumbnail of an 
image associated with this page';
-                       $res['thumbsize'] = 'Maximum thumbnail dimensions 
(either width or height)';
-                       $res['thumbwidth'] = 'Maximum thumbnail width';
-                       $res['thumbheight'] = 'Maximum thumbnail height';
-               }
-               return $res;
-       }
-
-       /**
-        * Get description of this Api.
-        * @deprecated since MediaWiki core 1.25
-        * @return string
-        */
-       public function getDescription() {
-               return 'Returns data needed for mobile views';
-       }
-
-       /**
-        * Returns some Api request examples for mobile Api.
-        * @deprecated since MediaWiki core 1.25
-        * @return array
-        */
-       public function getExamples() {
-               return [
-                       'api.php?action=mobileview&page=Doom_metal&sections=0',
-                       
'api.php?action=mobileview&page=Candlemass&sections=0|references',
-                       
'api.php?action=mobileview&page=Candlemass&sections=1-|references',
-               ];
-       }
-
-       /**
         * Returns usage examples for this module.
         * @see ApiBase::getExamplesMessages()
         */
diff --git a/includes/api/ApiParseExtender.php 
b/includes/api/ApiParseExtender.php
index ddb5971..5850cd8 100644
--- a/includes/api/ApiParseExtender.php
+++ b/includes/api/ApiParseExtender.php
@@ -66,11 +66,7 @@
                        ->getMFConfig()->get( 'MFSpecialCaseMainPage' );
 
                if ( $module->getModuleName() == 'parse' ) {
-                       if ( defined( 'ApiResult::META_CONTENT' ) ) {
-                               $data = $module->getResult()->getResultData();
-                       } else {
-                               $data = $module->getResultData();
-                       }
+                       $data = $module->getResult()->getResultData();
                        $params = $module->extractRequestParams();
                        if ( isset( $data['parse']['text'] ) && 
$params['mobileformat'] ) {
                                $result = $module->getResult();
@@ -79,9 +75,7 @@
                                $title = Title::newFromText( 
$data['parse']['title'] );
                                $text = $data['parse']['text'];
                                if ( is_array( $text ) ) {
-                                       if ( defined( 'ApiResult::META_CONTENT' 
) &&
-                                               isset( 
$text[ApiResult::META_CONTENT] )
-                                       ) {
+                                       if ( isset( 
$text[ApiResult::META_CONTENT] ) ) {
                                                $contentKey = 
$text[ApiResult::META_CONTENT];
                                        } else {
                                                $contentKey = '*';
diff --git a/includes/specials/SpecialMobileLanguages.php 
b/includes/specials/SpecialMobileLanguages.php
index 245e688..9cb9606 100644
--- a/includes/specials/SpecialMobileLanguages.php
+++ b/includes/specials/SpecialMobileLanguages.php
@@ -36,17 +36,8 @@
                );
 
                $api->execute();
-               if ( defined( 'ApiResult::META_CONTENT' ) ) {
-                       $data = (array)$api->getResult()->getResultData( [ 
'query', 'pages' ],
-                               [ 'Strip' => 'all' ] );
-               } else {
-                       $data = $api->getResult()->getData();
-                       // Paranoia
-                       if ( !isset( $data['query']['pages'] ) ) {
-                               return [];
-                       }
-                       $data = $data['query']['pages'];
-               }
+               $data = (array)$api->getResult()->getResultData( [ 'query', 
'pages' ],
+                       [ 'Strip' => 'all' ] );
 
                return $this->processLanguages( $data );
        }
diff --git a/tests/phpunit/api/ApiMobileViewTest.php 
b/tests/phpunit/api/ApiMobileViewTest.php
index 75dd69a..db20904 100644
--- a/tests/phpunit/api/ApiMobileViewTest.php
+++ b/tests/phpunit/api/ApiMobileViewTest.php
@@ -131,15 +131,11 @@
 
        private function executeMobileViewApi( $api, $expected ) {
                $api->execute();
-               if ( defined( 'ApiResult::META_CONTENT' ) ) {
-                       $result = $api->getResult()->getResultData( null, [
-                               'BC' => [],
-                               'Types' => [],
-                               'Strip' => 'all',
-                       ] );
-               } else {
-                       $result = $api->getResultData();
-               }
+               $result = $api->getResult()->getResultData( null, [
+                       'BC' => [],
+                       'Types' => [],
+                       'Strip' => 'all',
+               ] );
                $this->assertTrue(
                        isset( $result['mobileview'] ),
                        'API output should be encloded in mobileview element'
@@ -408,11 +404,7 @@
 
                $api->execute();
 
-               if ( defined( 'ApiResult::META_CONTENT' ) ) {
-                       $result = $api->getResult()->getResultData();
-               } else {
-                       $result = $api->getResultData();
-               }
+               $result = $api->getResult()->getResultData();
 
                foreach ( $props as $prop ) {
                        $this->assertFalse(
diff --git a/tests/phpunit/api/ApiParseExtenderTest.php 
b/tests/phpunit/api/ApiParseExtenderTest.php
index b6abb0f..041ff45 100644
--- a/tests/phpunit/api/ApiParseExtenderTest.php
+++ b/tests/phpunit/api/ApiParseExtenderTest.php
@@ -31,14 +31,10 @@
                $req = new FauxRequest( $params );
                $api = new ApiMain( $req );
                $api->execute();
-               if ( defined( 'ApiResult::META_CONTENT' ) ) {
-                       $data = $api->getResult()->getResultData( null, [
-                               'BC' => [],
-                               'Types' => [],
-                       ] );
-               } else {
-                       $data = $api->getResultData();
-               }
+               $data = $api->getResult()->getResultData( null, [
+                       'BC' => [],
+                       'Types' => [],
+               ] );
                $this->assertFalse( isset( $data['errors'] ) );
                $text = preg_replace( "/[\r\n]/", '', trim( 
$data['parse']['text']['*'] ) );
                $expected = preg_replace( "/[\r\n]/", '', trim( $expected ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/311789
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I58f66901e345dd58cb826277fe9fde0dd8a8180f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Bmansurov <bmansu...@wikimedia.org>
Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Jhobs <jhob...@wikimedia.org>
Gerrit-Reviewer: Phuedx <g...@samsmith.io>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to