Author: dto
Description:
Methods of the Linker class can and should be static, as Linker 1) is an utility
class and 2) stores no state information.
See comments for bug 7357.
Version: 1.9.x
Severity: enhancement
| • bzimport | |
| Sep 25 2006, 2:46 AM |
| F3376: linkerextensions.diff | |
| Nov 21 2014, 9:28 PM |
| F3377: linker.diff | |
| Nov 21 2014, 9:28 PM |
Author: dto
Description:
Methods of the Linker class can and should be static, as Linker 1) is an utility
class and 2) stores no state information.
See comments for bug 7357.
Version: 1.9.x
Severity: enhancement
dto wrote:
patch for phase3
Makes all of the methods of the Linker class static and updates calls to those
methods accordingly.
In addition, I've tried to remove as many references to Skin, $skin,
->getSkin(), ->skin, and $sk (did I miss any?) as possible. These are the major
changes:
constructor (ChangesList.php)
(ImageGallery.php)
static (LogPage.php)
occurrences of $skin were for checking whether $skin was null) (LogPage.php)
ParserOptions::setSkin() (Parser.php)
(QueryPage.php and many special pages)
(Skin.php)
I checked /extensions for stuff that these changes might break. Another patch
coming for that.
attachment linkerphase3.diff ignored as obsolete
dto wrote:
patch for extensions
Suggested changes for extensions. Many of these (the ones for Semantic
MediaWiki) are just a result of QueryPage::formatResult taking one less
argument.
attachment linkerextensions.diff ignored as obsolete
dto wrote:
patch (phase3)
Updated patch to latest revision.
attachment linker.diff ignored as obsolete
dto wrote:
patch (extensions)
Patch for extensions that preserves backwards compatibility, I believe.
attachment linkerextensions.diff ignored as obsolete
dto wrote:
updated patch (extensions)
Updated patch for extensions to current revision.
Attached:
dto wrote:
updated patch (phase3)
Updated patch for phase3. Ugh, this patch is hard to maintain.
Attached:
ayg wrote:
submitting a patch. It just makes it harder to review.
code.
things and nothing's broken, after some testing by me.
dto wrote:
(In reply to comment #8)
- Please don't make unrelated changes to whitespace, comments, etc. when
submitting a patch. It just makes it harder to review.
Sorry. I thought that since I was changing so much of Linker.php anyways, I
might as well. (But at this point, I hope it's all right if I leave them.)
- I don't think @static is necessary for functions marked as static in the PHP
code.
OK...should I remove those from the patch? They should eventually be removed
from the current MediaWiki code as well, then.
- How much have you tested this? I'd be willing to commit it if you've poked
things and nothing's broken, after some testing by me.
My low-activity wiki runs. Editing/viewing pages and special pages seems OK.
After all, all I've really done in the patch is refactoring.
Thanks for your interest in this enhancement!
nickpj wrote:
Summarising info from TimS on IRC in regards to his concerns about this:
When the user runs "php maintenance/dumpHTML.php", it looks like the overridden
makeBrokenLinkObj() function isn't called. The result is that broken links in
the static dump will show up as red links, instead of plain text as per normal
(i.e. there should be no red links). Would prefer to not use static functions,
and would prefer to use a factory function for best flexibility. An example of
this is getSkin() in includes/User.php.
ayg wrote:
So basically the answer to this is we want Linker methods to be overridable by skins, and specifically we want them overridden transparently to the caller, so that when some random code calls makeBrokenLinkObj() or anything else it calls it from Monobook or whatever instead of Linker, without the main code knowing or caring what class it's calling. Thus you cannot call the methods with anything like Linker::makeBrokenLinkObj(), since that won't be overridden. Thus we use non-static calls. Thus this is WONTFIX. Correct?