Jump to content

Community Wishlist Survey 2022/Miscellaneous/Check if a page exists without populating WhatLinksHere

From Meta, a Wikimedia project coordination wiki

Check if a page exists without populating WhatLinksHere

  • Problem: Does a wiki page exist? This should be a simple thing to check in a template or module, and it partly is – you can use the #ifexist parser function. However, due to the way that this has been implemented in MediaWiki, this has unexpected consequences: pages that call the templates/modules that do this check will now appear in Special:WhatLinksHere. These false flags cause significant problems for editors that are working on resolving misplaced wikilinks, such as links to redirects or disambiguation pages. That in turn leads to them objecting to the use of any template/module that checks for the existence of a page to see if they should link to it.
  • Proposed solution: Rework the MediaWiki database structure so that uses of #ifexist do not also appear in Special:WhatLinksHere – although this is not easy.
  • Who would benefit: Template developers who need to check if a page exists. Editors resolving disambiguation links on all wikis who don't want to see false links.
  • More comments: This is a perennial request to fix some long-standing technical debt. It has been proposed in the 2015, 2017, 2019, and 2021 wishlists. There is a work-around that uses page protection information, see en:Template:Linkless exists, but this isn't a long-term solution.
  • Phabricator tickets: phab:T14019 (from 2007), phab:T268526 (the wider database structure issue)
  • Proposer: Mike Peel (talk) 19:04, 14 January 2022 (UTC)[reply]


This also causes a quirk at Wikisource. The proofreading statistics (how many pages exist, how many are proofread or validated, etc) for an index can be gathered using Lua. Obviously, this has to check that pages exist, which means registering a template dependency on every page in the index, existing or not so that if pages change status the stats are correct (note: the actual counts of page statuses in an index don't require to access every page). The upshot is that pages like the monthly overviews of things like the s:en:Wikisource:Monthly Challenge appear to transclude very very many pages, though they actually do not transclude a byte of content. There is an idea for a workaround to add an "approximate" mode to the stats function, which would dispense with the template link, but this would rely on pages using approximate stats to purge regularly, as changes to or creations of the pages would not cause an update. It would be better if there could be some concept of non-transcluded, non-linking dependency. Inductiveload (talk) 20:09, 14 January 2022 (UTC)[reply]

Procrastination is the #1 reason why the problem still has not been fixed despite requests from past surveys. People put things off all the time, so the developers put off implementing the required changes (in other words, they procrastinate). Next time, we should set reminders and deadlines so that the developers know to implement the required changes to prevent pages with #ifexist checks from appearing in Special:WhatLinksHere and stop procrastinating. GeoffreyT2000 (talk) 21:26, 14 January 2022 (UTC)[reply]

Why isn't en:Template:Linkless exists a long-term solution? Seems to me it would likely be a lot easier to make the #ifexist parser function use the "linkless exists" technique than to rework the MediaWiki database structure. I tried voting support below, but tired of the edit conflicts and it's not worth the waste my time to try voting again. Wbm1058 (talk) 20:45, 28 January 2022 (UTC)[reply]

@Wbm1058: It seems to work as a work-around, but having to ask 'what is the page protection' if you want to ask 'does this page exists' is fundamentally illogical. It also doesn't seem to be available via Lua (unless I've missed something). Thanks. Mike Peel (talk) 21:03, 28 January 2022 (UTC)[reply]
Because it's a hack. It works because of the peculiar behavior of the {{PROTECTEDEXPIRY:}} magic word, which might change at some point. Also not sure the caches are correctly updated when the page exists. Strainu (talk) 21:12, 28 January 2022 (UTC)[reply]
Well, I say just HACK AWAY! You'll get more satisfaction than waiting for the Cleveland Browns to appear in a Super Bowl. And if the developers are sufficiently annoyed by the hacks then that might just motivate them to fix it right. Wbm1058 (talk) 21:26, 28 January 2022 (UTC)[reply]
@Wbm1058, Strainu, and Mike Peel: Yes, it's a hack, or possibly an exploit of a data leak in MediaWiki. If you can think of a more elegant way to achieve this, please enhance the template! The Lua version was deleted per en:Wikipedia:Templates_for_discussion/Log/2018_October_10#Module:Linkless, but I have my original effort stored locally if anyone would like to use it in another module. Certes (talk) 19:45, 21 February 2022 (UTC)[reply]

Unexplained "oppose" comments such as that below are very unhelpful. There is nothing in them that can be addressed, nor that informs other editors of any problems that might have been identified. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 13:47, 9 February 2022 (UTC)[reply]