From aa277850231edf883b66e1c15abc00b3ce70f70e Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Fri, 5 Jun 2009 17:14:03 +0000 Subject: [PATCH] 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. --- ParserFunctions_body.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ParserFunctions_body.php b/ParserFunctions_body.php index 789d0c4f..0f1c75d7 100644 --- a/ParserFunctions_body.php +++ b/ParserFunctions_body.php @@ -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? }