| @@ 41-47 (lines=7) @@ | ||
| 38 | private $count = 0; |
|
| 39 | private $startTime; |
|
| 40 | ||
| 41 | public function __construct() { |
|
| 42 | parent::__construct(); |
|
| 43 | $this->addDescription( 'Does something with a dump' ); |
|
| 44 | $this->addOption( 'file', 'File with text to run.', false, true ); |
|
| 45 | $this->addOption( 'dump', 'XML dump to execute all revisions.', false, true ); |
|
| 46 | $this->addOption( 'from', 'Article from XML dump to start from.', false, true ); |
|
| 47 | } |
|
| 48 | ||
| 49 | public function execute() { |
|
| 50 | if ( !( $this->hasOption( 'file' ) ^ $this->hasOption( 'dump' ) ) ) { |
|
| @@ 36-42 (lines=7) @@ | ||
| 33 | * @since 1.22 |
|
| 34 | */ |
|
| 35 | class EraseArchivedFile extends Maintenance { |
|
| 36 | public function __construct() { |
|
| 37 | parent::__construct(); |
|
| 38 | $this->addDescription( 'Erases traces of deleted files.' ); |
|
| 39 | $this->addOption( 'delete', 'Perform the deletion' ); |
|
| 40 | $this->addOption( 'filename', 'File name', false, true ); |
|
| 41 | $this->addOption( 'filekey', 'File storage key (with extension) or "*"', true, true ); |
|
| 42 | } |
|
| 43 | ||
| 44 | public function execute() { |
|
| 45 | if ( !$this->hasOption( 'delete' ) ) { |
|
| @@ 56-63 (lines=8) @@ | ||
| 53 | ||
| 54 | private $json, $dir, $hasWarning = false; |
|
| 55 | ||
| 56 | public function __construct() { |
|
| 57 | parent::__construct(); |
|
| 58 | $this->addDescription( 'Converts extension entry points to the new JSON registration format' ); |
|
| 59 | $this->addArg( 'path', 'Location to the PHP entry point you wish to convert', |
|
| 60 | /* $required = */ true ); |
|
| 61 | $this->addOption( 'skin', 'Whether to write to skin.json', false, false ); |
|
| 62 | $this->addOption( 'config-prefix', 'Custom prefix for configuration settings', false, true ); |
|
| 63 | } |
|
| 64 | ||
| 65 | protected function getAllGlobals() { |
|
| 66 | $processor = new ReflectionClass( 'ExtensionProcessor' ); |
|
| @@ 34-72 (lines=39) @@ | ||
| 31 | */ |
|
| 32 | class CleanupEmptyCategories extends LoggedUpdateMaintenance { |
|
| 33 | ||
| 34 | public function __construct() { |
|
| 35 | parent::__construct(); |
|
| 36 | $this->addDescription( |
|
| 37 | <<<TEXT |
|
| 38 | This script will clean up the category table by removing entries for empty |
|
| 39 | categories without a description page and adding entries for empty categories |
|
| 40 | with a description page. It will print out progress indicators every batch. The |
|
| 41 | script is perfectly safe to run on large, live wikis, and running it multiple |
|
| 42 | times is harmless. You may want to use the throttling options if it's causing |
|
| 43 | too much load; they will not affect correctness. |
|
| 44 | ||
| 45 | If the script is stopped and later resumed, you can use the --mode and --begin |
|
| 46 | options with the last printed progress indicator to pick up where you left off. |
|
| 47 | ||
| 48 | When the script has finished, it will make a note of this in the database, and |
|
| 49 | will not run again without the --force option. |
|
| 50 | TEXT |
|
| 51 | ); |
|
| 52 | ||
| 53 | $this->addOption( |
|
| 54 | 'mode', |
|
| 55 | '"add" empty categories with description pages, "remove" empty categories ' |
|
| 56 | . 'without description pages, or "both"', |
|
| 57 | false, |
|
| 58 | true |
|
| 59 | ); |
|
| 60 | $this->addOption( |
|
| 61 | 'begin', |
|
| 62 | 'Only do categories whose names are alphabetically after the provided name', |
|
| 63 | false, |
|
| 64 | true |
|
| 65 | ); |
|
| 66 | $this->addOption( |
|
| 67 | 'throttle', |
|
| 68 | 'Wait this many milliseconds after each batch. Default: 0', |
|
| 69 | false, |
|
| 70 | true |
|
| 71 | ); |
|
| 72 | } |
|
| 73 | ||
| 74 | protected function getUpdateKey() { |
|
| 75 | return 'cleanup empty categories'; |
|