http://www.mediawiki.org/wiki/Special:Code/MediaWiki/92864

Revision: 92864
Author:   yaron
Date:     2011-07-22 16:49:06 +0000 (Fri, 22 Jul 2011)
Log Message:
-----------
Undoing r92755 - if you want to revert these changes, please let's discuss it 
first

Modified Paths:
--------------
    trunk/extensions/ConfirmEdit/MathCaptcha.class.php

Modified: trunk/extensions/ConfirmEdit/MathCaptcha.class.php
===================================================================
--- trunk/extensions/ConfirmEdit/MathCaptcha.class.php  2011-07-22 16:10:22 UTC 
(rev 92863)
+++ trunk/extensions/ConfirmEdit/MathCaptcha.class.php  2011-07-22 16:49:06 UTC 
(rev 92864)
@@ -39,11 +39,17 @@
 
        /** Fetch the math */
        function fetchMath( $sum ) {
-               if( MWInit::classExists( 'MathRenderer' ) ){
-                       $math = new MathRenderer( $sum );
-               } else {
+               // class_exists() unfortunately doesn't work with HipHop, and
+               // its replacement, MWInit::classExists(), wasn't added until
+               // MW 1.18, and is thus unusable here - so instead, we'll
+               // just duplicate the code of MWInit::classExists().
+               try {
+                       $r = new ReflectionClass( 'MathRenderer' );
+               } catch( ReflectionException $r ) {
                        throw new MWException( 'MathCaptcha requires the Math 
extension for MediaWiki versions 1.18 and above.' );
                }
+
+               $math = new MathRenderer( $sum );
                $math->setOutputMode( MW_MATH_PNG );
                $html = $math->render();
                return preg_replace( '/alt=".*?"/', '', $html );


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to