From d7247efc90fb780fb9f063987f503f5f4c7ce848 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Tue, 20 Sep 2016 15:28:15 -0400 Subject: [PATCH] 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: Iff2eeb2bbfba15c84a4fcec85b6647c28886e9aa --- ApiVisualEditor.php | 26 +++++++++----------------- ApiVisualEditorEdit.php | 24 ++++++------------------ 2 files changed, 15 insertions(+), 35 deletions(-) diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php index cc73e43839..1e047b5b6b 100644 --- a/ApiVisualEditor.php +++ b/ApiVisualEditor.php @@ -212,14 +212,10 @@ class ApiVisualEditor extends ApiBase { false // enable write? ); $api->execute(); - if ( defined( 'ApiResult::META_CONTENT' ) ) { - $result = $api->getResult()->getResultData( null, [ - 'BC' => [], // Transform content nodes to '*' - 'Types' => [], // Add back-compat subelements - ] ); - } else { - $result = $api->getResultData(); - } + $result = $api->getResult()->getResultData( null, [ + 'BC' => [], // Transform content nodes to '*' + 'Types' => [], // Add back-compat subelements + ] ); if ( !isset( $result['query']['pages'][$title->getArticleID()]['revisions'][0]['diff']['*'] ) ) { return [ 'result' => 'fail' ]; } @@ -260,15 +256,11 @@ class ApiVisualEditor extends ApiBase { ); $api->execute(); - if ( defined( 'ApiResult::META_CONTENT' ) ) { - $result = $api->getResult()->getResultData( null, [ - 'BC' => [], // Backwards-compatible structure transformations - 'Types' => [], // Backwards-compatible structure transformations - 'Strip' => 'all', // Remove any metadata keys from the langlinks array - ] ); - } else { - $result = $api->getResultData(); - } + $result = $api->getResult()->getResultData( null, [ + 'BC' => [], // Backwards-compatible structure transformations + 'Types' => [], // Backwards-compatible structure transformations + 'Strip' => 'all', // Remove any metadata keys from the langlinks array + ] ); if ( !isset( $result['query']['pages'][$title->getArticleID()]['langlinks'] ) ) { return false; } diff --git a/ApiVisualEditorEdit.php b/ApiVisualEditorEdit.php index bad751fa3c..01cdb7a149 100644 --- a/ApiVisualEditorEdit.php +++ b/ApiVisualEditorEdit.php @@ -53,11 +53,7 @@ class ApiVisualEditorEdit extends ApiVisualEditor { $api->execute(); - if ( defined( 'ApiResult::META_CONTENT' ) ) { - return $api->getResult()->getResultData(); - } else { - return $api->getResultData(); - } + return $api->getResult()->getResultData(); } protected function parseWikitext( $title, $newRevId ) { @@ -77,15 +73,11 @@ class ApiVisualEditorEdit extends ApiVisualEditor { ); $api->execute(); - if ( defined( 'ApiResult::META_CONTENT' ) ) { - $result = $api->getResult()->getResultData( null, [ - 'BC' => [], // Transform content nodes to '*' - 'Types' => [], // Add back-compat subelements - 'Strip' => 'all', // Remove any metadata keys from the links array - ] ); - } else { - $result = $api->getResultData(); - } + $result = $api->getResult()->getResultData( null, [ + 'BC' => [], // Transform content nodes to '*' + 'Types' => [], // Add back-compat subelements + 'Strip' => 'all', // Remove any metadata keys from the links array + ] ); $content = isset( $result['parse']['text']['*'] ) ? $result['parse']['text']['*'] : false; $categorieshtml = isset( $result['parse']['categorieshtml']['*'] ) ? $result['parse']['categorieshtml']['*'] : false; @@ -280,10 +272,6 @@ class ApiVisualEditorEdit extends ApiVisualEditor { return 'csrf'; } - public function getTokenSalt() { - return ''; - } - public function mustBePosted() { return true; }