Add extension.json dependency on Math to MathCaptcha

Change-Id: I7b20114365cb22536cf9e9e74ee5dd00b85a41d5
This commit is contained in:
Reedy 2019-03-02 19:21:48 +00:00 committed by Umherirrender
parent f96b1eda5b
commit ae67c81991
2 changed files with 6 additions and 6 deletions

View file

@ -3,6 +3,11 @@
"author": [ "author": [
"..." "..."
], ],
"requires": {
"extensions": {
"Math": "*"
}
},
"url": "https://www.mediawiki.org/wiki/Extension:ConfirmEdit#MathCaptcha", "url": "https://www.mediawiki.org/wiki/Extension:ConfirmEdit#MathCaptcha",
"descriptionmsg": "mathcaptcha-desc", "descriptionmsg": "mathcaptcha-desc",
"license-name": "GPL-2.0-or-later", "license-name": "GPL-2.0-or-later",

View file

@ -73,12 +73,7 @@ class MathCaptcha extends SimpleCaptcha {
* @return string * @return string
*/ */
private function fetchMath( $sum ) { private function fetchMath( $sum ) {
if ( class_exists( MathRenderer::class ) ) {
$math = MathRenderer::getRenderer( $sum, [], 'png' ); $math = MathRenderer::getRenderer( $sum, [], 'png' );
} else {
throw new LogicException(
'MathCaptcha requires the Math extension for MediaWiki versions 1.18 and above.' );
}
$math->render(); $math->render();
$html = $math->getHtmlOutput(); $html = $math->getHtmlOutput();
return preg_replace( '/alt=".*?"/', '', $html ); return preg_replace( '/alt=".*?"/', '', $html );