For MediaWiki (recent comments | status changes | tags | authors | states | release notes | statistics)
RELEASE-NOTES update missing.
This is useful, I was considering adding such a hook too. However, this doesn't affect internal links in page content (they remain redlinks) and I think it would be better/more logical if it does. They're checked in LinkHolderArray.php calling Title->isAlwaysKnown() and page existence checks are optimised in that file so I suppose we can't just change it to call isKnown(). We could perhaps either add a parameter to isKnown() which would skip the $this->exists() check or move this hook to isAlwaysKnown().
Good, catch, I had actually not noticed links in pages remained redlinks. That sucks.
I'm reluctant to just move over the hook though, as the docs for isAlwaysKnown state:
"This function is semi-deprecated for public use, as well as somewhat misleadingly named. You probably just want to call isKnown(), which calls this function internally."
What about having LinkHolderArray call isKnown instead? Would this cause issues?
isKnown was introduced in r44520, with the intention to be a shortcut to both check page existence and to isAlwaysKnown. LinkHolderArray calls isAlwaysKnown and does the page existence check separately so it can do them in batches for pages with a lot of links. Consequently, to ensure consistency, it's best that isKnown remains a "shortcut" exclusively to exists() and isAlwaysKnown. It may be that other functions only call isAlwaysKnown and do their own page existence check.
So I would move the hook to isAlwaysKnown, what the docs say is intended for functions calling it, while the hook we want to add is for extra exceptions similar to those in isAlwaysKnown.
In that case I will move the hook as suggested. So what's the deal with the note of "semi deprecation" for isAlwaysKnown? Let's kill that?
Thanks for moving.
That note might be removed, i think it just means that most calls should be to isKnown. Not really important I think.
In any case I added a note in r111338 about isKnown().