The thing is PHP makes it really, really really easy to use globals, easy to the point where a MediaWiki developer commented:
In your opinion, is this analysis of the situation correct? I've been using a single global Registry class, which had to be propogated and then used to retrieve whatever global class I wanted, resulting in several lines of code in order to get to one global class. And I don't like this very much. But global data is evil! Evil I say! But where there's repetition, there's refactorability.PHP loves globals. I hate them. This is not a great
combination, but I manage. I could get rid of most of
them by having a single "HTTP request" object, and using
it to hold everything that's now global (which is exactly
what I'd do in a Java servlet). But that's really
awkward in PHP, and wouldn't really provide much benefit
in readability or maintainability, so I go with the flow
of PHP and use globals. Here's documentation on the
important globals used by the system.
Code: Select all
$Registry =& Registry::instance();
$Mapper_User =& $Registry->getMapperUser();Code: Select all
global $wgMapperUser;