Community Wishlist Survey 2019/Archive/Create a magic word to check category inclusion for previous page version

From Meta, a Wikimedia project coordination wiki

Create a magic word to check category inclusion for previous page version

NoN This proposal is unclear

  • Problem: Many times we need a way to know in which category the page is included, for better templates creation.
  • Who would benefit: Everyone who writes templates.
  • Proposed solution: It will be very nice to create a magic word to check if the page is included in particular category. But it is not done, and from good reason, it's very dangerous. A mutual recursion may create a lot of problems. For example, template A adds the page to category B if it is in category C, and template D adds the page to category C if it is in B. So, the right solution for me is to check the previous page revision. So, we should have {{#wasincategory:<category name>}}, which will return logical true iff the page was in the named category in previous revision, does not matter what is the state now. This way the recursion will be broken, and we'll have good answers. For absolutely right answers we can in the worst case to add some space character at the line end, for example, forcing a new revision.
  • More comments: Of course, it will be always false for the creation version.
  • Phabricator tickets: None.

Discussion

While this might avoid recursion you now have to consider the whole version history. Let's say the second revision of an article added such a statement, we are now at the 632th. The 632th revision includes a check which category was included in the 631th revision. To figure that out we have to parse it. But that includes again such a check - to fully parse it we also need the 630th revision, and so on until we parsed all 632 revisions. Sure, you could store the categories somewhere separately to avoid that. How would this work with templates? If you use #wasincategory in a template, which revision is used when? This looks complicated. Do you have an example for an application? --mfb (talk) 03:52, 4 November 2018 (UTC)[reply]

Hello and thank you. Well, of course the previous version categories list should be stored physically and not computed each time. What is different with templates? Magic words are parsed in there as in any other place. So it will happen according to the version of the parsed page. Can you give an example where it can cause any problems? And what do you mean in "Do you have an example for an application?"? IKhitron (talk) 11:25, 4 November 2018 (UTC)[reply]

Archived

This proposal is too confusing for us to put it up for voting. It completely misses the use cases for this feature, for example. Even if this would have been clarified, a table storing all historical categories for every page would have grown extremely big for very little benefit. MaxSem (WMF) (talk) 01:02, 14 November 2018 (UTC)[reply]