Let's allow action=purge to recalculate the number of pages/subcats/files in a category. We continuously get reports about these counts being incorrect, even for pages with as few as ~300 pages.
Adding/removing pages to/from categories only increments/decrements the counts, never recalculating them from scratch, so as time goes they get more and more out of date. Curiously, there isn't even a maintenance script to rebuild them; they are only reset if the count becomes negative (so obviously incorrect) and sometimes when there are <200 pages.
Currently the only way to force recount is to manually remove the relevant row from the 'category' table. That's suboptimal.
This would need to be limited to categories with, say, fewer than 5000 entries; for pathological cases like Category:All stub articles on en.wp with nearly two million pages, the query (see Category::refreshCounts()) takes several minutes to run (I tried on labs and it took 6m18s to count 1,877,668 pages). I also tried Category:Year of birth unknown and it took only 4.5s for 20,125 pages, so only doing this for categories where the current count is <5000 should be safe?
- T18036: Number of category members (PAGESINCATEGORY) is inaccurate for large categories
- T18765: Write a maintenance script to refresh category member counts
- T23230: Category count is incorrect
- T85527: Category gives wrong number of pages
- T117971: Category size count is radically different than actual count.