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: Id9e8fb026b26bb4db34fb22bd631205ce6f7072b
---
M includes/ApiQueryExtracts.php
M includes/Hooks.php
2 files changed, 17 insertions(+), 72 deletions(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/ApiQueryExtracts.php b/includes/ApiQueryExtracts.php
index 9dfd6c1..ce7f70a 100644
--- a/includes/ApiQueryExtracts.php
+++ b/includes/ApiQueryExtracts.php
@@ -208,14 +208,10 @@
                $api = new ApiMain( new FauxRequest( $request ) );
                try {
                        $api->execute();
-                       if ( defined( 'ApiResult::META_CONTENT' ) ) {
-                               $data = $api->getResult()->getResultData( null, 
array(
-                                       'BC' => array(),
-                                       'Types' => array(),
-                               ) );
-                       } else {
-                               $data = $api->getResultData();
-                       }
+                       $data = $api->getResult()->getResultData( null, array(
+                               'BC' => array(),
+                               'Types' => array(),
+                       ) );
                } catch ( UsageException $e ) {
                        if ( $e->getCodeString() === 'nosuchsection' ) {
                                // Looks like we tried to get the intro to a 
page without
@@ -223,14 +219,10 @@
                                unset( $request['section'] );
                                $api = new ApiMain( new FauxRequest( $request ) 
);
                                $api->execute();
-                               if ( defined( 'ApiResult::META_CONTENT' ) ) {
-                                       $data = 
$api->getResult()->getResultData( null, array(
-                                               'BC' => array(),
-                                               'Types' => array(),
-                                       ) );
-                               } else {
-                                       $data = $api->getResultData();
-                               }
+                               $data = $api->getResult()->getResultData( null, 
array(
+                                       'BC' => array(),
+                                       'Types' => array(),
+                               ) );
                        } else {
                                // Some other unexpected error - lets just 
report it to the user
                                // on the off chance that is the right thing.
@@ -369,45 +361,8 @@
                        ),
                        'continue' => array(
                                ApiBase::PARAM_TYPE => 'integer',
-                               /** @todo Once support for MediaWiki < 1.25 is 
dropped, just use ApiBase::PARAM_HELP_MSG directly */
-                               defined( 'ApiBase::PARAM_HELP_MSG' ) ? 
ApiBase::PARAM_HELP_MSG : '' => 'api-help-param-continue',
+                               ApiBase::PARAM_HELP_MSG => 
'api-help-param-continue',
                        ),
-               );
-       }
-
-       /**
-        * @deprecated since MediaWiki core 1.25
-        */
-       public function getParamDescription() {
-               return array(
-                       'chars' => 'How many characters to return, actual text 
returned might be slightly longer.',
-                       'sentences' => 'How many sentences to return',
-                       'limit' => 'How many extracts to return',
-                       'intro' => 'Return only content before the first 
section',
-                       'plaintext' => 'Return extracts as plaintext instead of 
limited HTML',
-                       'sectionformat' => array(
-                               'How to format sections in plaintext mode:',
-                               ' plain - No formatting',
-                               ' wiki - Wikitext-style formatting == like this 
==',
-                               " raw - This module's internal representation 
(section titles prefixed with <ASCII 1><ASCII 2><section level><ASCII 2><ASCII 
1>",
-                       ),
-                       'continue' => 'When more results are available, use 
this to continue',
-               );
-       }
-
-       /**
-        * @deprecated since MediaWiki core 1.25
-        */
-       public function getDescription() {
-               return 'Returns plain-text or limited HTML extracts of the 
given page(s)';
-       }
-
-       /**
-        * @deprecated since MediaWiki core 1.25
-        */
-       public function getExamples() {
-               return array(
-                       
'api.php?action=query&prop=extracts&exchars=175&titles=Therion' => 'Get a 
175-character extract',
                );
        }
 
diff --git a/includes/Hooks.php b/includes/Hooks.php
index ac1e6f2..06f291f 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -32,24 +32,14 @@
                        ) )
                );
                $api->execute();
-               if ( defined( 'ApiResult::META_CONTENT' ) ) {
-                       $data = $api->getResult()->getResultData( array( 
'query', 'pages' ) );
-                       foreach ( $pageIds as $id ) {
-                               $contentKey = isset( 
$data[$id]['extract'][ApiResult::META_CONTENT] )
-                                       ? 
$data[$id]['extract'][ApiResult::META_CONTENT]
-                                       : '*';
-                               if ( isset( $data[$id]['extract'][$contentKey] 
) ) {
-                                       $results[$id]['extract'] = 
$data[$id]['extract'][$contentKey];
-                                       $results[$id]['extract trimmed'] = 
false;
-                               }
-                       }
-               } else {
-                       $data = $api->getResultData();
-                       foreach ( $pageIds as $id ) {
-                               if ( isset( 
$data['query']['pages'][$id]['extract']['*'] ) ) {
-                                       $results[$id]['extract'] = 
$data['query']['pages'][$id]['extract']['*'];
-                                       $results[$id]['extract trimmed'] = 
false;
-                               }
+               $data = $api->getResult()->getResultData( array( 'query', 
'pages' ) );
+               foreach ( $pageIds as $id ) {
+                       $contentKey = isset( 
$data[$id]['extract'][ApiResult::META_CONTENT] )
+                               ? $data[$id]['extract'][ApiResult::META_CONTENT]
+                               : '*';
+                       if ( isset( $data[$id]['extract'][$contentKey] ) ) {
+                               $results[$id]['extract'] = 
$data[$id]['extract'][$contentKey];
+                               $results[$id]['extract trimmed'] = false;
                        }
                }
                return true;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id9e8fb026b26bb4db34fb22bd631205ce6f7072b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TextExtracts
Gerrit-Branch: master
Gerrit-Owner: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
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