mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-27 17:01:07 +00:00
Cleanup SpecialMathWikibase WikibaseClient availability
If the Special Page is removed in onSpecialPage_initList, it is not accessible, so the same logic that is duplicated in SpecialMathWikibase is redundant. Remove math-wikibase-special-error-no-wikibase, but leave math-wikibase-special-error-header because it's used for another error too. Change-Id: I62d67a6f39591cc3c8d3b1af80380a6c758ff44f
This commit is contained in:
parent
81dedc1909
commit
702c6a1382
|
@ -125,6 +125,5 @@
|
|||
"math-wikibase-special-form-button": "Request Information",
|
||||
"math-wikibase-special-error-header": "Error",
|
||||
"math-wikibase-special-error-invalid-argument": "Your specified Wikibase item ID does not exist.",
|
||||
"math-wikibase-special-error-unknown": "An unknown error occurred while fetching data from Wikibase.",
|
||||
"math-wikibase-special-error-no-wikibase": "The Wikibase extension is required in order to use this special page."
|
||||
"math-wikibase-special-error-unknown": "An unknown error occurred while fetching data from Wikibase."
|
||||
}
|
||||
|
|
|
@ -125,6 +125,5 @@
|
|||
"math-wikibase-special-form-button": "The button label to submits the form to request a wikibase id.",
|
||||
"math-wikibase-special-error-header": "The header of the error page. Will be shown when an error occurred on the special page.\n{{Identical|Error}}",
|
||||
"math-wikibase-special-error-invalid-argument": "The error text if the requested wikibase does not exist.",
|
||||
"math-wikibase-special-error-unknown": "The error text when an unkown error occurred during fetching the information.\nFurther information about the error can be found in the logs.",
|
||||
"math-wikibase-special-error-no-wikibase": "The error text that show up when the required Wikibase extension is missing."
|
||||
"math-wikibase-special-error-unknown": "The error text when an unkown error occurred during fetching the information.\nFurther information about the error can be found in the logs."
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace MediaWiki\Extension\Math;
|
||||
|
||||
use Exception;
|
||||
use ExtensionRegistry;
|
||||
use InvalidArgumentException;
|
||||
use MediaWiki\Extension\Math\Widget\WikibaseEntitySelector;
|
||||
use MediaWiki\Html\Html;
|
||||
|
@ -43,21 +42,7 @@ class SpecialMathWikibase extends SpecialPage {
|
|||
public function execute( $par ) {
|
||||
global $wgLanguageCode;
|
||||
|
||||
if ( !self::isWikibaseAvailable() ) {
|
||||
$out = $this->getOutput();
|
||||
|
||||
$out->setPageTitle(
|
||||
$this->getPlainText( 'math-wikibase-special-error-header' )
|
||||
);
|
||||
$out->addHTML(
|
||||
$this->msg( 'math-wikibase-special-error-no-wikibase' )->inContentLanguage()->parse()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !$this->wikibase ) {
|
||||
$this->wikibase = MediaWikiServices::getInstance()->get( 'Math.WikibaseConnector' );
|
||||
}
|
||||
$this->wikibase = MediaWikiServices::getInstance()->get( 'Math.WikibaseConnector' );
|
||||
|
||||
$request = $this->getRequest();
|
||||
$output = $this->getOutput();
|
||||
|
@ -246,12 +231,4 @@ class SpecialMathWikibase extends SpecialPage {
|
|||
$header
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether Wikibase is available or not
|
||||
* @return bool
|
||||
*/
|
||||
public static function isWikibaseAvailable(): bool {
|
||||
return ExtensionRegistry::getInstance()->isLoaded( 'WikibaseClient' );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue