Daniel Friesen has uploaded a new change for review.
https://gerrit.wikimedia.org/r/49384
Change subject: Update MathCaptcha to support recent versions of Math.
......................................................................
Update MathCaptcha to support recent versions of Math.
Currently Math inside of the Math extension uses code differently than
MathCaptcha expects.
MathRenderer is abstract and cannot be instanced. Instead a static getRenderer
call must
be called. And setOutputMode does not exist.
Change-Id: I54efd01f147a1f11607c21af59d0f7efe2240255
---
M MathCaptcha.class.php
1 file changed, 7 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ConfirmEdit
refs/changes/84/49384/1
diff --git a/MathCaptcha.class.php b/MathCaptcha.class.php
index 7874991..5cba9b2 100644
--- a/MathCaptcha.class.php
+++ b/MathCaptcha.class.php
@@ -39,12 +39,15 @@
/** Fetch the math */
function fetchMath( $sum ) {
- if ( MWInit::classExists( 'MathRenderer' ) ) {
- $math = new MathRenderer( $sum );
- } else {
+ if ( !MWInit::classExists( 'MathRenderer' ) ) {
throw new MWException( 'MathCaptcha requires the Math
extension for MediaWiki versions 1.18 and above.' );
}
- $math->setOutputMode( MW_MATH_PNG );
+ if ( MWInit::methodExists( 'MathRenderer', 'getRenderer' ) ) {
+ $math = MathRenderer::getRenderer( $sum, array(),
MW_MATH_PNG );
+ } else {
+ $math = new MathRenderer( $sum );
+ $math->setOutputMode( MW_MATH_PNG );
+ }
$html = $math->render();
return preg_replace( '/alt=".*?"/', '', $html );
}
--
To view, visit https://gerrit.wikimedia.org/r/49384
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I54efd01f147a1f11607c21af59d0f7efe2240255
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ConfirmEdit
Gerrit-Branch: master
Gerrit-Owner: Daniel Friesen <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits