r51511 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51510‎ | r51511 | r51512 >
Date:17:14, 5 June 2009
Author:simetrical
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/extensions/ParserFunctions/ParserFunctions_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ParserFunctions/ParserFunctions_body.php
@@ -149,7 +149,7 @@
150150 $args = func_get_args();
151151 array_shift( $args );
152152 $primary = trim(array_shift($args));
153 - $found = false;
 153+ $found = $defaultFound = false;
154154 $parts = null;
155155 $default = null;
156156 $mwDefault =& MagicWord::get( 'default' );
@@ -160,7 +160,7 @@
161161 if ( $found || $parts[0] == $primary ) {
162162 # Found a match, return now
163163 return $parts[1];
164 - } elseif ( $mwDefault->matchStartAndRemove( $parts[0] ) ) {
 164+ } elseif ( $defaultFound || $mwDefault->matchStartAndRemove( $parts[0] ) ) {
165165 $default = $parts[1];
166166 } # else wrong case, continue
167167 } elseif ( count( $parts ) == 1 ) {
@@ -168,6 +168,8 @@
169169 # If the value matches, set a flag and continue
170170 if ( $parts[0] == $primary ) {
171171 $found = true;
 172+ } elseif ( $mwDefault->matchStartAndRemove( $parts[0] ) ) {
 173+ $defaultFound = true;
172174 }
173175 } # else RAM corruption due to cosmic ray?
174176 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r51509Make default values fall through in switch...simetrical16:53, 5 June 2009

Status & tagging log