Improve documentation of maintenance scripts.
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Mon, 25 Jun 2012 19:54:41 +0000 (21:54 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Mon, 25 Jun 2012 19:54:41 +0000 (21:54 +0200)
Change-Id: I1c911eb0fd6108fdee0b4e96363d87b926aba396

12 files changed:
maintenance/cleanupAncientTables.php
maintenance/cleanupCaps.php
maintenance/cleanupImages.php
maintenance/cleanupRemovedModules.php
maintenance/cleanupSpam.php
maintenance/cleanupTable.inc
maintenance/cleanupTitles.php
maintenance/cleanupUploadStash.php
maintenance/cleanupWatchlist.php
maintenance/clear_interwiki_cache.php
maintenance/clear_stats.php
maintenance/compareParsers.php

index 56d7698..d449d6c 100644 (file)
 
 require_once( dirname( __FILE__ ) . '/Maintenance.php' );
 
+/**
+ * Maintenance script to cleans up old database tables, dropping old indexes
+ * and fields.
+ *
+ * @ingroup Maintenance
+ */
 class CleanupAncientTables extends Maintenance {
 
        public function __construct() {
index 6f8e180..b61f6ff 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Script to clean up broken page links when somebody turns on $wgCapitalLinks.
+ * Clean up broken page links when somebody turns on $wgCapitalLinks.
  *
  * Usage: php cleanupCaps.php [--dry-run]
  * Options:
 
 require_once( dirname( __FILE__ ) . '/cleanupTable.inc' );
 
+/**
+ * Maintenance script to clean up broken page links when somebody turns on $wgCapitalLinks.
+ *
+ * @ingroup Maintenance
+ */
 class CapsCleanup extends TableCleanup {
        public function __construct() {
                parent::__construct();
index 687a95c..2beed72 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 /**
- * Script to clean up broken, unparseable upload filenames.
+ * Clean up broken, unparseable upload filenames.
  *
  * Usage: php cleanupImages.php [--fix]
  * Options:
  *   --fix  Actually clean up titles; otherwise just checks for them
  *
- * Copyright (C) 2005-2006 Brion Vibber <brion@pobox.com>
+ * Copyright © 2005-2006 Brion Vibber <brion@pobox.com>
  * http://www.mediawiki.org/
  *
  * This program is free software; you can redistribute it and/or modify
 
 require_once( dirname( __FILE__ ) . '/cleanupTable.inc' );
 
+/**
+ * Maintenance script to clean up broken, unparseable upload filenames.
+ *
+ * @ingroup Maintenance
+ */
 class ImageCleanup extends TableCleanup {
        protected $defaultParams = array(
                'table' => 'image',
index fb8afd2..b339bfc 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 /**
- * Maintenance script to remove cache entries for removed ResourceLoader modules
- * from the database
+ * Remove cache entries for removed ResourceLoader modules from the database.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 
 require_once( dirname( __FILE__ ) . '/Maintenance.php' );
 
+/**
+ * Maintenance script to remove cache entries for removed ResourceLoader modules
+ * from the database.
+ *
+ * @ingroup Maintenance
+ */
 class CleanupRemovedModules extends Maintenance {
 
        public function __construct() {
index f104899..42d8440 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Cleanup all spam from a given hostname
+ * Cleanup all spam from a given hostname.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 
 require_once( dirname( __FILE__ ) . '/Maintenance.php' );
 
+/**
+ * Maintenance script to cleanup all spam from a given hostname.
+ *
+ * @ingroup Maintenance
+ */
 class CleanupSpam extends Maintenance {
 
        public function __construct() {
index 1c27976..898bdf4 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Generic table cleanup class. Already subclasses maintenance
+ * Generic class to cleanup a database table.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 
 require_once( dirname( __FILE__ ) . '/Maintenance.php' );
 
+/**
+ * Generic class to cleanup a database table. Already subclasses Maintenance.
+ *
+ * @ingroup Maintenance
+ */
 class TableCleanup extends Maintenance {
        protected $defaultParams = array(
                'table' => 'page',
index 4fc6415..a2dc3a3 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Script to clean up broken, unparseable titles.
+ * Clean up broken, unparseable titles.
  *
  * Usage: php cleanupTitles.php [--fix]
  * Options:
 
 require_once( dirname( __FILE__ ) . '/cleanupTable.inc' );
 
+/**
+ * Maintenance script to clean up broken, unparseable titles.
+ *
+ * @ingroup Maintenance
+ */
 class TitleCleanup extends TableCleanup {
        public function __construct() {
                parent::__construct();
index c8d8924..32377b6 100644 (file)
 
 require_once( dirname( __FILE__ ) . '/Maintenance.php' );
 
+/**
+ * Maintenance script to remove old or broken uploads from temporary uploaded
+ * file storage and clean up associated database records.
+ *
+ * @ingroup Maintenance
+ */
 class UploadStashCleanup extends Maintenance {
 
        public function __construct() {
index a9b20fe..840337c 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 /**
- * Script to remove broken, unparseable titles in the Watchlist.
+ * Remove broken, unparseable titles in the watchlist table.
  *
  * Usage: php cleanupWatchlist.php [--fix]
  * Options:
  *   --fix  Actually remove entries; without will only report.
  *
- * Copyright (C) 2005,2006 Brion Vibber <brion@pobox.com>
+ * Copyright © 2005,2006 Brion Vibber <brion@pobox.com>
  * http://www.mediawiki.org/
  *
  * This program is free software; you can redistribute it and/or modify
 
 require_once( dirname( __FILE__ ) . '/cleanupTable.inc' );
 
+/**
+ * Maintenance script to remove broken, unparseable titles in the watchlist table.
+ *
+ * @ingroup Maintenance
+ */
 class WatchlistCleanup extends TableCleanup {
        protected $defaultParams = array(
                'table' => 'watchlist',
index 953bd4c..638a475 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 /**
- * This script is used to clear the interwiki links for ALL languages in
- * the cache.
+ * Clear the cache of interwiki prefixes for all local wikis.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 
 require_once( dirname( __FILE__ ) . '/Maintenance.php' );
 
+/**
+ * Maintenance script to clear the cache of interwiki prefixes for all local wikis.
+ *
+ * @ingroup Maintenance
+ */
 class ClearInterwikiCache extends Maintenance {
 
        public function __construct() {
index 61314e6..2ed5a67 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * This script remove all statistics tracking from the cache
+ * Removes all statistics tracking from the cache.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 
 require_once( dirname( __FILE__ ) . '/Maintenance.php' );
 
+/**
+ * Maintenance script to remove all statistics tracking from the cache.
+ *
+ * @ingroup Maintenance
+ */
 class clear_stats extends Maintenance {
 
        public function __construct() {
index 4fe4e4d..9d7f5c7 100644 (file)
@@ -6,8 +6,9 @@
  *
  * Templates etc are pulled from the local wiki database, not from the dump.
  *
- * Copyright (C) 2011 Platonides - http://www.mediawiki.org/
- * 
+ * Copyright © 2011 Platonides
+ * http://www.mediawiki.org/
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * @file
  * @ingroup Maintenance
  */
+
 require_once( dirname( __FILE__ ) . '/dumpIterator.php' );
 
+/**
+ * Maintenance script to take page text out of an XML dump file and render
+ * basic HTML out to files.
+ *
+ * @ingroup Maintenance
+ */
 class CompareParsers extends DumpIterator {
 
        private $count = 0;
@@ -51,10 +58,10 @@ class CompareParsers extends DumpIterator {
                if ( $this->hasOption('save-failed') ) {
                        $this->saveFailed = $this->getOption('save-failed');
                }
-               
+
                $this->stripParametersEnabled = $this->hasOption( 'strip-parameters' );
                $this->showParsedOutput = $this->hasOption( 'show-parsed-output' );
-               
+
                $this->showDiff = $this->hasOption( 'show-diff' );
                if ( $this->showDiff ) {
                        $bin = $this->getOption( 'diff-bin', getenv( 'DIFF' ) );
@@ -63,10 +70,10 @@ class CompareParsers extends DumpIterator {
                                $wgDiff = $bin;
                        }
                }
-               
-               $user = new User();             
+
+               $user = new User();
                $this->options = ParserOptions::newFromUser( $user );
-               
+
                if ( $this->hasOption( 'tidy' ) ) {
                        global $wgUseTidy;
                        if ( !$wgUseTidy ) {
@@ -74,46 +81,46 @@ class CompareParsers extends DumpIterator {
                        }
                        $this->options->setTidy( true );
                }
-               
+
                $this->failed = 0;
        }
-       
-       public function conclusions() { 
+
+       public function conclusions() {
                $this->error( "{$this->failed} failed revisions out of {$this->count}" );
                if ($this->count > 0)
                        $this->output( " (" . ( $this->failed / $this->count ) . "%)\n" );
        }
-       
+
        function stripParameters( $text ) {
                if ( !$this->stripParametersEnabled ) {
                        return $text;
                }
                return preg_replace( '/(<a) [^>]+>/', '$1>', $text );
        }
-       
+
        /**
         * Callback function for each revision, parse with both parsers and compare
         * @param $rev Revision
         */
        public function processRevision( $rev ) {
                $title = $rev->getTitle();
-                               
+
                $parser1Name = $this->getOption( 'parser1' );
                $parser2Name = $this->getOption( 'parser2' );
-               
+
                self::checkParserLocally( $parser1Name );
                self::checkParserLocally( $parser2Name );
-               
+
                $parser1 = new $parser1Name();
                $parser2 = new $parser2Name();
-               
+
                $output1 = $parser1->parse( $rev->getText(), $title, $this->options );
                $output2 = $parser2->parse( $rev->getText(), $title, $this->options );
 
                if ( $output1->getText() != $output2->getText() ) {
                        $this->failed++;
                        $this->error( "Parsing for {$title->getPrefixedText()} differs\n" );
-                       
+
                        if ( $this->saveFailed ) {
                                file_put_contents( $this->saveFailed . '/' . rawurlencode( $title->getPrefixedText() ) . ".txt", $rev->getText());
                        }
@@ -127,7 +134,7 @@ class CompareParsers extends DumpIterator {
                        }
                }
        }
-       
+
        private static function checkParserLocally( $parserName ) {
                /* Look for the parser in a file appropiately named in the current folder */
                if ( !class_exists( $parserName ) && file_exists( "$parserName.php" ) ) {