r95878 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95877‎ | r95878 | r95879 >
Date:15:40, 31 August 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
compat fix
Modified paths:
  • /trunk/extensions/Validator/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/Validator/Validator.php (modified) (history)
  • /trunk/extensions/Validator/includes/Parameter.php (modified) (history)
  • /trunk/extensions/Validator/includes/Validator.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/RELEASE-NOTES
@@ -4,6 +4,11 @@
55 This change log contains a list of completed to-do's (new features, bug fixes, refactoring) for every version of Validator.
66
77
 8+=== Validator 0.4.11 ===
 9+(2011-09-xx)
 10+
 11+* Fixed compatibility fallback in Parameter::getDescription.
 12+
813 === Validator 0.4.10 ===
914 (2011-08-04)
1015
Index: trunk/extensions/Validator/includes/Parameter.php
@@ -196,8 +196,8 @@
197197 *
198198 * @var mixed string or false
199199 */
 200+
200201 protected $message = false;
201 -
202202 /**
203203 * Constructor.
204204 *
@@ -783,7 +783,12 @@
784784 * @return mixed string or false
785785 */
786786 public function getDescription() {
787 - return $this->description;
 787+ if ( $this->description === false and $this->message !== false ) {
 788+ return wfMsg( $this->message );
 789+ }
 790+ else {
 791+ return $this->description;
 792+ }
788793 }
789794
790795 /**
Index: trunk/extensions/Validator/includes/Validator.php
@@ -159,12 +159,10 @@
160160 * for unknown parameters and optionally for parameter overriding.
161161 *
162162 * @param array $parameters Parameter name as key, parameter value as value
163 - * @param array $parameterInfo Main parameter name as key, parameter meta data as value
 163+ * @param array $parameterInfo List of Parameter objects
164164 * @param boolean $toLower Indicates if the parameter values should be put to lower case. Defaults to true.
165165 */
166166 public function setParameters( array $parameters, array $parameterInfo, $toLower = true ) {
167 - $this->cleanParameterInfo( $parameterInfo );
168 -
169167 $this->parameters = $parameterInfo;
170168
171169 // Loop through all the user provided parameters, and distinguish between those that are allowed and those that are not.
@@ -210,29 +208,6 @@
211209 }
212210
213211 /**
214 - * Ensures all elements of the array are Parameter objects,
215 - * and that the array keys match the main parameter name.
216 - *
217 - * @since 0.4
218 - *
219 - * @param array $paramInfo
220 - */
221 - protected function cleanParameterInfo( array &$paramInfo ) {
222 - $cleanedList = array();
223 -
224 - foreach ( $paramInfo as $key => $parameter ) {
225 - if ( $parameter instanceof Parameter ) {
226 - $cleanedList[$parameter->getName()] = $parameter;
227 - }
228 - else {
229 - throw new Exception( "$key is not a valid Parameter." );
230 - }
231 - }
232 -
233 - $paramInfo = $cleanedList;
234 - }
235 -
236 - /**
237212 * Validates and formats all the parameters (but aborts when a fatal error occurs).
238213 *
239214 * @since 0.4
Index: trunk/extensions/Validator/Validator.php
@@ -25,7 +25,7 @@
2626 die( 'Not an entry point.' );
2727 }
2828
29 -define( 'Validator_VERSION', '0.4.10' );
 29+define( 'Validator_VERSION', '0.4.11 alpha' );
3030
3131 // Register the internationalization file.
3232 $wgExtensionMessagesFiles['Validator'] = dirname( __FILE__ ) . '/Validator.i18n.php';