From 8c05a71bebfabc78c4d1c228ab9ef93528387a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 17 Aug 2023 21:58:52 +0200 Subject: [PATCH] Remove references to VisualEditorFullRestbaseURL The VisualEditorFullRestbaseURL config variable is no longer used by VisualEditor and is no longer set in Wikimedia production configuration. Bug: T344458 Change-Id: Ifd0b9f919f7a9bdceb8761125588fe72e8d1e50c --- extension.json | 2 +- src/Hooks.php | 16 +++++----------- src/MathRestbaseInterface.php | 11 ++++------- tests/phpunit/unit/HooksTest.php | 11 ----------- 4 files changed, 10 insertions(+), 30 deletions(-) diff --git a/extension.json b/extension.json index 8981dc7ad..38bf23788 100644 --- a/extension.json +++ b/extension.json @@ -131,7 +131,7 @@ "value": "https://mathoid-beta.wmflabs.org" }, "MathUseInternalRestbasePath": { - "description": "Whether to allow to use of internal RESTBase path instead of $wgMathFullRestbaseURL and $wgVisualEditorFullRestbaseURL. Set false if you want to use external RESTBase in any case.", + "description": "Whether to allow to use of internal RESTBase path instead of $wgMathFullRestbaseURL. Set false if you want to use external RESTBase in any case.", "value": true, "public": true }, diff --git a/src/Hooks.php b/src/Hooks.php index 7ef799547..67bb9706f 100644 --- a/src/Hooks.php +++ b/src/Hooks.php @@ -30,23 +30,17 @@ class Hooks implements public static function onConfig( array $extInfo, SettingsBuilder $settings ) { $config = $settings->getConfig(); + // Documentation of MathRestbaseInterface::getUrl() should be updated when this is changed. + $fullRestbaseUrl = $config->get( 'MathFullRestbaseURL' ); $internalRestbaseURL = $config->get( 'MathInternalRestbaseURL' ); $useInternalRestbasePath = $config->get( 'MathUseInternalRestbasePath' ); $virtualRestConfig = $config->get( 'VirtualRestConfig' ); if ( !$fullRestbaseUrl ) { - if ( $config->has( 'VisualEditorFullRestbaseURL' ) ) { - $settings->warning( "MathFullRestbaseURL is falling back to using VisualEditorFullRestbaseURL. " . - "Please configure the Mathoid API URL explicitly." ); - - $fullRestbaseUrl = $config->get( 'VisualEditorFullRestbaseURL' ); - $settings->overrideConfigValue( 'MathFullRestbaseURL', $fullRestbaseUrl ); - } else { - throw new ConfigException( - 'Math extension can not find Restbase URL. Please specify $wgMathFullRestbaseURL.' - ); - } + throw new ConfigException( + 'Math extension can not find Restbase URL. Please specify $wgMathFullRestbaseURL.' + ); } if ( !$useInternalRestbasePath ) { diff --git a/src/MathRestbaseInterface.php b/src/MathRestbaseInterface.php index 584d1ef89..2acad67f3 100644 --- a/src/MathRestbaseInterface.php +++ b/src/MathRestbaseInterface.php @@ -205,16 +205,13 @@ class MathRestbaseInterface { * Case A: $internal = false, which means one needs a URL that is accessible from * outside: * - * --> If $wgMathFullRestbaseURL is configured use it, otherwise fall back try to - * $wgVisualEditorFullRestbaseURL. (Note, that this is not be worse than failing - * immediately.) + * --> Use $wgMathFullRestbaseURL. It must always be configured. * - * Case B: $internal= true, which means one needs to access content from Restbase + * Case B: $internal = true, which means one needs to access content from Restbase * which does not need to be accessible from outside: * - * --> Use the mount point when it is available and $wgMathUseInternalRestbasePath= - * true. If not, use $wgMathFullRestbaseURL with fallback to - * wgVisualEditorFullRestbaseURL + * --> Use the mount point when it is available and $wgMathUseInternalRestbasePath = + * true. If not, use $wgMathFullRestbaseURL. * * @param string $path * @param bool|true $internal diff --git a/tests/phpunit/unit/HooksTest.php b/tests/phpunit/unit/HooksTest.php index b67b0d1d4..a0b6ed1d9 100644 --- a/tests/phpunit/unit/HooksTest.php +++ b/tests/phpunit/unit/HooksTest.php @@ -39,17 +39,6 @@ class HooksTest extends MediaWikiUnitTestCase { ] ]; - yield 'use VisualEditorFullRestbaseURL' => [ - [ - 'MathFullRestbaseURL' => null, - 'VisualEditorFullRestbaseURL' => 'https://wikimedia.org/api/rest_', - ] + $defaults, - [ - 'MathFullRestbaseURL' => 'https://wikimedia.org/api/rest_', - 'MathInternalRestbaseURL' => 'https://wikimedia.org/api/rest_', - ] - ]; - yield 'explicit MathInternalRestbaseURL' => [ [ 'MathInternalRestbaseURL' => 'https://localhost:12345/rest/',