Manual:cleanupEmptyCategories.php

From Linux Web Expert

Revision as of 06:03, 22 March 2022 by imported>FuzzyBot (Updating to match new version of source page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<td class="mw-version-versionbox" title="<translate nowrap> The latest stable version is <tvar name=1>1.41</tvar></translate>">
<translate> ≥</translate> 1.28
<translate> MediaWiki version:</translate>

Details

cleanupEmptyCategories.php is a maintenance script to clean up empty categories in the category table. This script will clean up the category table by removing entries for empty categories without a description page and adding entries for empty categories with a description page. It will print out progress indicators every batch. The script is perfectly safe to run on large, live wikis, and running it multiple times is harmless. You may want to use the throttling options if it's causing too much load; they will not affect correctness.

If the script is stopped and later resumed, you can use the --mode and --begin options with the last printed progress indicator to pick up where you left off.

Options/Arguments

Option Description Required?
--mode Use "add" option to empty categories with description pages, "remove" option to empty categories without description pages or "both" to actually do both. Default: both <translate> Optional</translate>
--begin Only do categories whose names are alphabetically after the provided name <translate> Optional</translate>
--throttle Wait this many milliseconds after each batch. Default: 0 <translate> Optional</translate>
--force If the script was already ever used once force it to cleanup again. Default: unused <translate> Optional</translate>

Usage

php maintenance/cleanupEmptyCategories.php [ --mode| --begin| --throttle| --force ]


Terminal


<translate> Whenever the script runs, it makes a note in the database and will not run again.</translate> <translate> If you want to run the script again, run the command with the <tvar name=1>--force</tvar> option.</translate>

See <translate> bug <tvar name=1>T235019</tvar></translate>.

See also