[Mediawiki-l] "What links here" and DPL problem

Anne Wilson annew at kde.org
Sat Jul 2 13:11:30 UTC 2011


Last week we became aware that "What links here" searches were missing some 
items.  Evidence appeared to point to interference by the Special:myLanguage 
links that we are using (according to Nikerabbit WhatLinksHere should not find 
pages containing such links), so we set out to find ways around this, starting 
with a DPL query.  Gradually other factors became clear - some links had a 
space in the name and others had an underscore.  Finally, links were not 
always on the same namespace.  At that point a template was made:

<quote>
Finding all pages linking to {{{1}}}: <code><nowiki>{{LinksTo</nowiki>{{!}}
{{{1}}}<nowiki>}}</nowiki></code>

{{#dpl:
| namespace = Main
| nottitleregexp = .*(/..(-..)?{{!}}_[(].*[)])$
| include = *
| includematch = @\[\[([Ss]pecial\:[mM]y[lL]anguage/)?{{{1}}}(\]{{!}}\{{!}}
{{!}}#)@
| includemaxlength = 0
| format = ,\n* [[%PAGE%|%TITLE%]],,
}}
{{#dpl:
| namespace = User
| nottitleregexp = .*(/..(-..)?{{!}}_[(].*[)])$
| include = *
| includematch = @\[\[([Ss]pecial\:[mM]y[lL]anguage/)?{{{1}}}(\]{{!}}\{{!}}
{{!}}#)@
| includemaxlength = 0
| format = ,\n* [[%PAGE%|%TITLE%]],,
}}
{{#dpl:
| namespace = Talk
| nottitleregexp = .*(/..(-..)?{{!}}_[(].*[)])$
| include = *
| includematch = @\[\[([Ss]pecial\:[mM]y[lL]anguage/)?{{{1}}}(\]{{!}}\{{!}}
{{!}}#)@
| includemaxlength = 0
| format = ,\n* [[%PAGE%|%TITLE%]],,
}}
<noinclude>
----
Finds all English pages linking to the page given as argument. Usage 
<nowiki>{{LinksTo|</nowiki>'''''page name'''''<nowiki>}}</nowiki>, where 
'''''page name''''' is the name of the page. Note, that any space characters 
or underscores in the name should be replaced by <nowiki>[_ ]</nowiki> &mdash; 
that is: 'open square bracket', 'underscore', 'space', 'close square bracket'. 
This is because the links are found by a string search of the text of pages. 
In wiki format names can be written with either space or underscore, and for 
many pages both form occur. The search covers the namespaces Main, User and 
Talk.

As an example, <nowiki>{{LinksTo|Getting[_ ]Help}}</nowiki> gives<br />
{{LinksTo|Getting[_ ]Help}}
[[Category:Template]]
</noinclude>
</quote>

At that point we thought we had cracked it - we were getting the results we 
expected - or we thought we were.

Recently we found at least one example, when neither Special:WhatLinksHere og 
our LinksTo template works: The page http://userbase.kde.org/Plasma links to 
http://userbase.kde.org/Plasma/Panels, but is not found by either method. Both 
methods find the page http://userbase.kde.org/User:Claus_chr/ToDo which also 
links to the Panels page.

We are now tearing hair.  Has anyone any ideas as to why our efforts are 
falling down?  We have some pages that should be deleted, and without a 
reliable search we are reluctant to proceed.
-- 
New to KDE Software? - get help from http://userbase.kde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.wikimedia.org/pipermail/mediawiki-l/attachments/20110702/37314b2c/attachment.pgp 


More information about the MediaWiki-l mailing list