r92755 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92754‎ | r92755 | r92756 >
Date:17:17, 21 July 2011
Author:aaron
Status:reverted (Comments)
Tags:
Comment:
Revert r92013, r92018 per CR
Modified paths:
  • /trunk/extensions/ConfirmEdit/MathCaptcha.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmEdit/MathCaptcha.class.php
@@ -39,17 +39,11 @@
4040
4141 /** Fetch the math */
4242 function fetchMath( $sum ) {
43 - // class_exists() unfortunately doesn't work with HipHop, and
44 - // its replacement, MWInit::classExists(), wasn't added until
45 - // MW 1.18, and is thus unusable here - so instead, we'll
46 - // just duplicate the code of MWInit::classExists().
47 - try {
48 - $r = new ReflectionClass( 'MathRenderer' );
49 - } catch( ReflectionException $r ) {
 43+ if( MWInit::classExists( 'MathRenderer' ) ){
 44+ $math = new MathRenderer( $sum );
 45+ } else {
5046 throw new MWException( 'MathCaptcha requires the Math extension for MediaWiki versions 1.18 and above.' );
5147 }
52 -
53 - $math = new MathRenderer( $sum );
5448 $math->setOutputMode( MW_MATH_PNG );
5549 $html = $math->render();
5650 return preg_replace( '/alt=".*?"/', '', $html );

Follow-up revisions

RevisionCommit summaryAuthorDate
r92864Undoing r92755 - if you want to revert these changes, please let's discuss it...yaron16:49, 22 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92013Follow-up to r86811: changed MWInit::classExists() to class_exists() - the fo...yaron21:59, 12 July 2011
r92018Follow-up to r86811 and r92013 - instead of using class_exists() or MWInit::c...yaron23:11, 12 July 2011

Comments

#Comment by Yaron Koren (talk | contribs)   17:19, 21 July 2011

Hi - why did you revert this code? I think it was fine.

#Comment by 😂 (talk | contribs)   17:42, 21 July 2011

MWInit exists as of 1.18, and this change is is only in trunk (1.19). You're duplicating code for no reason.

#Comment by Yaron Koren (talk | contribs)   17:52, 21 July 2011

The reason is for backward compatibility, with versions of MediaWiki before 1.18 - so that, for example, someone running MW 1.17 can simply get the latest trunk version of ConfirmEdit and have it work. I can understand not wanting to go out of one's way to keep backward compatibility - but why go out of one's way to remove it?

Status & tagging log