User:Catrope/Extension review/Babel

From mediawiki.org

BABEL REVIEW /trunk/extensions/Babel @ r88357

Most important issues:

  1. It looks like the first parameter of each template invocation is lost
  2. CSS should be loaded done in r94138
  3. Possible oldid-induced bug due to wrong use of Article constructor r94210
  4. No validity check for category creator user name done in r92141

General:

Babel.class.php:

  • Babel::Render()
    • (1) $templateParameter[0] is unused. Did you mean $templateParameters (plural)?
      • Looks like you did; right now the first parameter is overwritten with the template name
  • Babel::mReplaceCategoryVariables()
    • Use strtr(). Much easier and guards against double substitution bugs done in r96747

Babel.css:

  • (2) Why don't you just load this file (with ResourceLoader of course)?
    • Local sysops can put overrides in MediaWiki:Common.css if they want to
    • ResourceLoader automatically flips rules on RTL wikis

BabelAutoCreate.class.php:

  • BabelAutoCreate::create()
    • (3) Use new Article( $title, 0 ) instead of new Article( $title )
  • BabelAutoCreate::user()
    • (4) Why is false being passed to User::newFromName() to suppress the validity check? It seems to me that a user name you're about to create should be valid