Page MenuHomePhabricator

Negative namespace titles handled inconsistently
Closed, ResolvedPublic

Description

Until recently, (*_namespace, *_title) pairs in the database never had a negative value for *_namespace. Somehow, that convention changed recently: the pagelinks table now contains links to Special: (-1) and Media: (-2) pages as well, causing code making assumptions about the nonexistence of negative namespaces to fail (e.g. bug 16158).

On top of this, behavior for registering links to special pages is inconsistent. According to a quick test Splarka ran early this morning, links through [[Image:Foo.jpg|link=Special:Bar]] are always registered, while regular links like [[Special:Foo]] are only registered if the special page doesn't exist; links to existing special pages like [[Special:Allpages]] are *not* registered. AFAIK, tests concerning links to the Media: namespace or transclusion (stuff like {{Special:PrefixIndex/API}}) haven't been done yet (if you feel like it, go right ahead).

We should decide to register all links and related stuff to Special: and Media: pages, or to register none of them. The current behavior is confusing and inconsistent.

CCing to Tim as Splarka tells me he knows more about it.


Version: 1.14.x
Severity: normal

Details

Reference
bz16162

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:16 PM
bzimport set Reference to bz16162.
bzimport added a subscriber: Unknown Object (MLST).

My opinion is that they should be registered. The fact that they aren't registered is an accident of history. One can think of useful applications for registration of both special pages and media links.

This was a side effect of enforcement of looks being distributed in various different places.

Changes to Title::isAlwaysKnown() caused the behavior to become inconsistent for inline links (with existing special pages not getting recorded, while nonexistent ones ended up going through the main code path and now getting recorded), while the image link target one simply went through a new, very different code path and got recorded.

I've now moved the special checks explicitly into ParserOutput::addLink() in r45266 for bug 16806, so behavior should be nice and consistent.

For now the special links are not being recorded. It could be useful to start recording them, but we'd want to do a few things:

  • Normalize the link names to canonical form
  • Consider a way to deal with parameters
  • Add UI for all the various "show me stuff from the link tables" to consistently allow doing something with that data

This belongs in a new bug if it's desirable.