Jump to content

Deglobalization

From mediawiki.org

Globals need to die. When everything in MediaWiki is class-based, globals break a lot of the time. This is a list of all the biggest violaters of the "no-globals" style.

At large

[edit]
  • All configuration variables — Replace with new Conf class (harder than it looks: Requests for comment/Configuration database)
  • wgConf — Kill it with fire (and replace with new Conf class)
  • wgPageProps — Replace with PageProps class
  • wgTitle — Use the proper newFrom* functions; Various instances of classes like OutputPage and Article you may be working with will have their own getTitle() that should be used
  • wgLang — Replace with User::getLang()

Disputed

[edit]

These are argued to only be hiding the problem, not solving it. They should be considered either way.

  • wgUser — Replace with User::current().
  • wgOut — Ideally, replace with a proper output system

Now fixed

[edit]
  • wgArticle — Use the proper newFrom* functions. Deprecated in r88588, removed from 1.20 in r111168.
  • wgHooks — Hooks class (since r80435)

See also

[edit]