Page MenuHomePhabricator

Templates are not updating related links (Whatlinkshere, categories, etc)
Closed, ResolvedPublic


Author: jylee

A user on the English Wikipedia of [[en:User:Mom2jandk]] pointed out to me that
Whats links here is broken, and that it produces less article links that it use
to ever since the introduction of the (inclusion) feature.

As in the above example, one of the pages should be listed but is not listed is
[[en:Talk:1803 silver dollar]]


From what it looks like, the author who wrote the new feature must have
forgotten to include inclusion to be anything that used
{{Template:templatename}} (or any variation thereof), this likely means anything
that may include something like {{msg:templatename}} or
{{msg:Template:templatename}} won't pop up in the list of 'What links here' when
it use to.

It should be noted that 'msg:' is case insensitive as well as 'Template:'
Additionally, when correcting, considerations for other namespaces as well as
their namespaces translated in the different local languages, should be
accounted for.

Version: 1.6.x
Severity: critical



Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 9:02 PM
bzimport set Reference to bz4549.
bzimport added a subscriber: Unknown Object (MLST).

jylee wrote:

It should be noted that the user previously produced a bigger list here:
[[en:Wikipedia:WikiProject Numismatics/Articles]]

philharnish wrote:

I was unable to reproduce the bug on 1.6a. Something is wrong though.

Also, doing an edit on a page which should be listed will list the article

My theory is that at some point after the mw_templatelinks table was introduced,
incorrect entries in mw_pagelinks were removed. That is, all template links
which were in mw_pagelinks but should not have been. Since the template links
were removed from mw_pagelinks and are not yet in mw_templatelinks, it is not
shown in "What links here".

Theory aside, I have examined the code, and normal links and template links are
treated identically (except template links add localized 'istemplate' text:
"inclusion"). If one were to break, so would the other. All links were correctly
added on both my install and the test edit I did to [[en:Talk:1947 Maple Leaf]].

As to how the templatelinks would have been removed from pagelinks, I suspect
that was done right around when the mw_templatelinks table was created. For
whatever reason it was created, someone would then separate the two kinds of
links right?

jylee wrote: was categoryredirected at 11:28, 16
January 2006 UTC
My bot, NekoDaemon, picked up this and made changes to only the Template:
at 11:58, 16 January 2006;

The images still seem stuck in when it
should appear in
since the template was changed.

gangleri wrote:


The original problem (from comment 0) is the same as the problem from
Bug 2904: Old message templates ({{msg:foo}}) problem

As far as I remember Special:Whatlinkshere listed only a limited number of pages
in the past. What is not known to me is if insertion in the "whatlinkshere"
table stoped when the limitation was reached or not.

Mihai used a bot as well to replace {{msg:foo}} with {{foo}} this summer. We
supposed we can identify all pages with Special:Whatlinkshere but later Mihai
realised that this was not the case.

I have no clue if these tables have been rebuild or not in the mean time. If the
tables where never rebuild this would be a good reason why some pages are not
displayed properly.

There is another "historical" bug regarding {{msg:foo}} which I want to mention
here which might be the reason for database inconsistency regarding
Special:Whatlinkshere :
Bug 2394: cleaning {{msg:foo}} usage and cleaning the MediaWiki namespace

I never investigated the impacts of bug 2394.

What is described in comment 4 seems relates to the request from
ug 2098: action=purge and categories - implement a more effectiv action=update
or action=rebuild

best regards reinhardt [[user:gangleri]]

jylee wrote:

The limitation was removed, it seemed, because a user did generate an extensive
list of pages, but when the (inclusion) tag was implemented, the list reduced

But the two seem to relate since both deal with templates, and neither update
without a no-change edit.

jofiwiki wrote:

Similar problem at de.wikisource. After a software update a few weeks ago all
Whatlinkshere-pages of templates displayed 0 links. After editing the pages the
links increased, but some days later it went to 0 links again. Now the number of
links is increasing, but for example displayed
about 800 links before the software update, now it's only displaying about 140
links to articles that have been edited or created since the last reset.

tuvic.tuvic wrote:

It looks to me like this functionality keeps getting resetted: for example:
yesterday there were at least 20 links to this template, ,
today there are only 5 or 6! This gets annoying, because bots rely on this
feature to replace templates, or for tagging images. Does someone know what's
causing it, and how it can be fixed?

This must be a refreshLinks.php bug, surely.

Indeed. Template link registration is done in Parser::fetchTemplate(), which is
only called on cache misses. The template cache ($wgParser->mTemplates) is never
cleared, it would have been growing indefinitely during refreshLinks.php. So
reports of the templatelinks table being almost cleared are quite plausible.
I'll commit the fix within 10 minutes or so and then start another run of

So is this bug resolved now? It seems to be fixed as far as I can tell.

ligulem wrote:

Reopenend bug. On the en: wiki [[Kingdom (biology)]] uses [[template:Journal
reference]] but that article is not on the what links here of Journal reference.

robchur wrote:

Doesn't matter which bug it was, either; the statement was wrong. It does show
up, at least for me.

It shows up *now* because I *fixed* the other bug and resaved the page.