User "Happy-melon" posted a comment on MediaWiki.r86255.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/86255#c16155
Commit summary:

Refactor the factory/i18n/list/etc static methods from SpecialPage into their 
own class; there's no reason we need to be parsing them in every single 
SpecialPage subclass.  Leave all the methods as stubs in SpecialPage.php; if we 
required PHP 5.3 they could be replaced by a a __callStatic() magic method, but 
that doesn't work on PHP 5.2.

Also make a few changes to the functions available.  
SpecialPageFactory::resolveAlias() now takes an optional subpage and returns 
array(<name>,<subpage>).  Similarly merge getPage() and getPageByAlias().  
There were many examples of (extensions particularly) making dubious 
assumptions about the presence or absence of subpages or canonical-ness.

I didn't deprecate SpecialPage::getTitleFor() as it's got over six hundred 
calls.  I'm rather undecided on the best position of getPage()/executePath().  
Although the latter needs cleanup anyway.

Comment:

It's not so much laziness as code clarity; it would need a dozen temporary 
variables to make it parse properly as an array.  Plus an object has the 
advantage that it's intrinsically pass-by-reference.  I could implement some 
sort of Iterator which can be accessed with either method, but that might well 
make it more opaque, not less.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to