Manual:CleanupEmptyCategories.php: Difference between revisions
T235019 |
tweaks |
||
| Line 14: | Line 14: | ||
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. When the script has finished, it will make a note of this in the database, and will not run again without the --force option. |
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. When the script has finished, it will make a note of this in the database, and will not run again without the --force option. |
||
</translate> |
</translate> |
||
{{ |
{{Note|1=<translate>Currently, this script will do nothing if it has been run before, stopping with the "<tvar|msg>Update 'cleanup empty categories' already logged as completed.</>" message. To prevent this, pass the <code>--force</code> parameter to it. See {{bug|T235019}}.</translate>|2=gotcha}} |
||
<translate> |
<translate> |
||
| Line 40: | Line 40: | ||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
php cleanupEmptyCategories.php --mode=add |
php cleanupEmptyCategories.php --mode=add --force |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
Revision as of 20:49, 9 October 2019
| MediaWiki file: cleanupEmptyCategories.php | |
|---|---|
| Location: | maintenance/ |
| Source code: | master • 1.46.0 • 1.45.4 • 1.43.9 |
| Classes: | CleanupEmptyCategories |
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. When the script has finished, it will make a note of this in the database, and will not run again without the --force option.
--force parameter to it. See bug T235019.Usage
php cleanupEmptyCategories.php [--mode] [--begin] [--throttle] [--force]
| Option/Parameter | Description |
|---|---|
| --mode | "add" to empty categories with description pages, "remove" to empty categories without description pages or "both" to actually do both. Default: both |
| --begin | Only do categories whose names are alphabetically after the provided name |
| --throttle | Wait this many milliseconds after each batch. Default: 0 |
Example
php cleanupEmptyCategories.php --mode=add --force
This adds entries for empty categories with a description page.