On Fri, May 23, 2008 at 10:14 PM, DanTMan dan_the_man@telus.net wrote:
Bah, that looks even uglier. If you're going to make a singleton, make it something sane and reasonable.
User::getCurrent();
It's would be part of the class actually being mentioned, and it specifies what you are trying to get, the user of the current transaction. Same would go for other things like Title::getCurrent();
It does not necessarily look nice, but keeping the current stuff in one class sounds like a better idea to me.
However, unfortunately part of things done at times are testing $wgTitle if it's null (has been set yet), and sometimes there are reasons to override it (Special use, primarily things outside of the scope of a article view). In those cases we should also probably setup things like TITLE_ISINSTANTIATED and also allow a Title::setCurrent();
Directly scraping $wgTitle is of course not possible. MediaWiki::singleton()->getTitle(); would for now just be return $wgTitle; but in 2020 when no globals are used anymore, the globals can be killed.
Bryan