On Wed, Mar 5, 2008 at 12:59 PM, Yaron Koren yaron57@gmail.com wrote:
Oh, wow - 10 parameters for the hook function? Somehow that seems like overkill, though I don't know what exactly could be removed from that list.
SkinTemplateTabAction has 9. So does ArticleSaveComplete. Those seem to be the biggest; up for record-breaking? :D
Would the call to wfRunHooks() be placed before or after the line that sets the actual link ($s)? If it comes afterwards, passing in the variables of $style and $inside might not be necessary, since those are just helper variables that are used to create the link.
Definitely before. Otherwise you'd have to parse $s if you wanted to tweak some single aspect of the link.
Maybe it's also better to not have makeBrokenLinkObj() override the values of $text and $trail, and instead use new variables for those, so that the original values could be passed in without problems (and the new variables could similarly be ignored).
Well, it's not really necessary. The original $trail is just "$trail$inside", I think. (Looking at the code, actually, it depends on $wgContLang->linkTrail(), but I think that's always *supposed* to be the case.) And $text is equal to the input $text unless there was no input, in which case it just has a default that needs to be specified in the code instead of on the call line. Passing &$this, $nt, $query, &$u, &$style, &$prefix, &$text, &$inside, &$trail, &$ret should be fine.
On Wed, Mar 5, 2008 at 1:13 PM, Jim Wilson wilson.jim.r@gmail.com wrote:
One use case could be for integration with something like Brion's TitleKey extension, so if the title already exists, but with a different capitalization, a known link obj could be generated rather than a broken link obj.
That would be much better done as a hook in makeLinkObj(). You're running extra queries for no good reason if you wait till it's already been decided broken, and you might break other things too. This hook should be for if the link is really broken, and you just want to handle broken links differently than linking to an edit page or something.
This is the biggest discussion I've ever seen about adding a single stupid hook. :)