r106390 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106389‎ | r106390 | r106391 >
Date:23:04, 15 December 2011
Author:platonides
Status:ok (Comments)
Tags:
Comment:
Improve class guessing.
Error reduction: 362 -> 444 -> 311
Modified paths:
  • /trunk/tools/code-utils/check-vars.php (modified) (history)

Diff [purge]

Index: trunk/tools/code-utils/check-vars.php
@@ -880,7 +880,17 @@
881881 '$dbw' => 'DatabaseBase', '$dbr' => 'DatabaseBase',
882882 '$sk' => 'Skin',
883883 '$wgMemc' => 'MWMemcached',
 884+ '$thumb' => 'MediaTransformOutput',
 885+ '$title' => 'Title', '$titleObj' => 'Title', '$desiredTitleObj' => 'Title',
 886+ '$article' => 'Article', '$articleObj' => 'Article',
 887+ '$rev' => 'Revision', '$revision' => 'Revision',
 888+ '$undoRev' => 'Revision', '$undoafterRev' => 'Revision',
 889+ '$msg' => 'Message',
 890+ '$stash' => 'UploadStash',
884891 );
 892+ static $wellKnownMembers = array(
 893+ 'db' => 'DatabaseBase', 'dbw' => 'DatabaseBase',
 894+ );
885895
886896 if ( $token[0] == T_VARIABLE ) {
887897 if ( isset( $wellKnownVars[ $token[1] ] ) ) {
@@ -901,7 +911,9 @@
902912
903913 $name = $token[1];
904914
905 - if ( $token[1][0] == 'm' ) // member
 915+ if ( isset( $wellKnownMembers[$name] ) )
 916+ $name = $wellKnownMembers[$name];
 917+ elseif ( $token[1][0] == 'm' ) // member
906918 $name = substr( $token[1], 1 );
907919 } else {
908920 return null;

Comments

#Comment by Nikerabbit (talk | contribs)   10:29, 16 December 2011

Not sure about $msg.

Status & tagging log