Make r51509 work with older MediaWiki versions too

After discussion with Tim.  The back-compat stuff here seems pretty
useless -- why can't people with old versions of MediaWiki just keep the
old feature sets, and upgrade MediaWiki to get new features for
extensions?  We branch extensions for a reason.
This commit is contained in:
Aryeh Gregor 2009-06-05 17:14:03 +00:00
parent 6905775132
commit aa27785023

View file

@ -149,7 +149,7 @@ class ExtParserFunctions {
$args = func_get_args();
array_shift( $args );
$primary = trim(array_shift($args));
$found = false;
$found = $defaultFound = false;
$parts = null;
$default = null;
$mwDefault =& MagicWord::get( 'default' );
@ -160,7 +160,7 @@ class ExtParserFunctions {
if ( $found || $parts[0] == $primary ) {
# Found a match, return now
return $parts[1];
} elseif ( $mwDefault->matchStartAndRemove( $parts[0] ) ) {
} elseif ( $defaultFound || $mwDefault->matchStartAndRemove( $parts[0] ) ) {
$default = $parts[1];
} # else wrong case, continue
} elseif ( count( $parts ) == 1 ) {
@ -168,6 +168,8 @@ class ExtParserFunctions {
# If the value matches, set a flag and continue
if ( $parts[0] == $primary ) {
$found = true;
} elseif ( $mwDefault->matchStartAndRemove( $parts[0] ) ) {
$defaultFound = true;
}
} # else RAM corruption due to cosmic ray?
}