Manual:Globals are evil/zh

以前的MediaWiki代码过于频繁地依赖于全局处理上下文. 从那以后，MediaWiki的发展就是一个缓慢地把全局变量移动到对象的故事. 将上下文存储在对象的成员变量中允许这些对象可以以更灵活的方式重用. 考虑下面优雅的代码：

与

Some of the current MediaWiki developers have an idle fantasy that some day, globals will be eliminated from MediaWiki entirely, replaced by an application object which would be passed to constructors. Whether that would be an efficient, convenient solution remains to be seen, but certainly PHP 5 makes such object-oriented programming models easier than they were in previous versions.

For the time being though, MediaWiki programmers will have to work in an environment with some global context.

For more information on the global variables used in MediaWiki, see.