Manual:recountCategories.php
From Linux Web Expert
<td class="mw-version-versionbox" title="<translate nowrap> The latest stable version is <tvar name=1>1.41</tvar></translate>">
<translate> ≥</translate> 1.30
<translate> MediaWiki version:</translate> |
MediaWiki file: recountCategories.php | |
---|---|
Location: | maintenance/ |
Source code: | master • 1.41.1 • 1.40.3 • 1.39.7 |
Classes: | RecountCategories |
Details
recountCategories.php is a maintenance script used to update the counts of category members, if the numbers displayed on category pages are inaccurate. During normal operation, it shouldn't be needed to run this script. However, a bug may cause the counts to not update properly (see <translate> task <tvar name=1>T18036</tvar></translate> and <translate> task <tvar name=1>T85696</tvar></translate> and <translate> task <tvar name=1>T170737</tvar></translate>, the script was run on all public Wikimedia wikis 2021-06-23).
Options/Arguments
Option | Description | Required? |
---|---|---|
--mode | Which category count column to recompute: one of pages , subcats or files .
|
<translate> Required</translate> |
--begin | Only recount categories with cat_id greater than the given value | <translate> Optional</translate> |
--throttle | Wait this many milliseconds after each batch. Default: 0 | <translate> Optional</translate> |
--skip-cleanup | Skip running cleanupEmptyCategories if the "page" mode is selected | <translate> Optional</translate> |
Usage
php maintenance/recountCategories.php --mode modeName [ --begin| --throttle| --skip-cleanup ]
With pages mode
Terminal
$ php maintenance/recountCategories.php --mode pages Starting to recount pages counts. Finding up to 500 drifted rows greater than cat_id 0... Updated the pages counts of 0 categories. Done! Now run the script using the other --mode options if you haven't already. Running cleanupEmptyCategories.php Adding empty categories with description pages... Removing empty categories without description pages... Category cleanup complete.
With subcats mode
Terminal
$ php maintenance/recountCategories.php --mode subcats Starting to recount subcats counts. Finding up to 500 drifted rows greater than cat_id 0... Updated the subcats counts of 0 categories. Done! Now run the script using the other --mode options if you haven't already.
With files mode
Terminal
$ php maintenance/recountCategories.php --mode files Starting to recount files counts. Finding up to 500 drifted rows greater than cat_id 0... Updated the files counts of 0 categories. Done! Now run the script using the other --mode options if you haven't already.