r41692 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41691‎ | r41692 | r41693 >
Date:09:20, 5 October 2008
Author:nikerabbit
Status:old
Tags:
Comment:
* Really fix FreeCol checks
Modified paths:
  • /trunk/extensions/Translate/MessageChecks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/MessageChecks.php
@@ -310,10 +310,12 @@
311311 * @return True if namespace has been tampered with.
312312 */
313313 protected function checkFreeColMissingVars( TMessage $message, $code, &$desc = null ) {
314 - if ( !preg_match_all( '/%[^% ]+%/U', $message->definition, $defVars ) ) {
 314+ $varPattern = '%[a-zA-Z_]+%';
 315+
 316+ if ( !preg_match_all( "/$varPattern/U", $message->definition, $defVars ) ) {
315317 return false;
316318 }
317 - preg_match_all( '/%[^% ]+%/U', $message->translation, $transVars );
 319+ preg_match_all( "/$varPattern/U", $message->translation, $transVars );
318320
319321 $missing = self::compareArrays( $defVars[0], $transVars[0] );
320322
@@ -336,9 +338,11 @@
337339 * @return True if namespace has been tampered with.
338340 */
339341 protected function checkFreeColExtraVars( TMessage $message, $code, &$desc = null ) {
340 - preg_match_all( '/%[^% ]+%/U', $message->definition, $defVars );
341 - preg_match_all( '/%[^% ]+%/U', $message->translation, $transVars );
 342+ $varPattern = '%[a-zA-Z_]+%';
342343
 344+ preg_match_all( "/$varPattern/U", $message->definition, $defVars );
 345+ preg_match_all( "/$varPattern/U", $message->translation, $transVars );
 346+
343347 $missing = self::compareArrays( $transVars[0], $defVars[0] );
344348
345349 if ( $count = count( $missing ) ) {

Status & tagging log