Improve documentation of maintenance scripts.
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Thu, 20 Sep 2012 20:49:55 +0000 (22:49 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Fri, 21 Sep 2012 04:40:32 +0000 (06:40 +0200)
Change-Id: Id86d06d3c22a69f7e378bf6e75b5c78ef8b47c51

maintenance/language/langmemusage.php
maintenance/locking/LockServerDaemon.php
maintenance/oracle/alterSharedConstraints.php
maintenance/storage/checkStorage.php
maintenance/storage/compressOld.php
maintenance/storage/dumpRev.php
maintenance/storage/fixBug20757.php
maintenance/storage/orphanStats.php
maintenance/storage/recompressTracked.php
maintenance/storage/resolveStubs.php
maintenance/storage/testCompression.php

index 2323638..ad29efb 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 /**
- * Dumb program that tries to get the memory usage
- * for each language file.
+ * Dumb program that tries to get the memory usage for each language file.
  *
  * 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
@@ -18,6 +17,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
+ * @file
  * @ingroup MaintenanceLanguage
  */
 
 require_once( __DIR__ . '/../Maintenance.php' );
 require_once( __DIR__ . '/languages.inc' );
 
+/**
+ * Maintenance script that tries to get the memory usage for each language file.
+ *
+ * @ingroup MaintenanceLanguage
+ */
 class LangMemUsage extends Maintenance {
 
        public function __construct() {
@@ -41,7 +46,7 @@ class LangMemUsage extends Maintenance {
                $memlast = $memstart = memory_get_usage();
 
                $this->output( "Base memory usage: $memstart\n" );
-       
+
                foreach ( $langtool->getLanguages() as $langcode ) {
                        Language::factory( $langcode );
                        $memstep = memory_get_usage();
index 689c930..f45525c 100644 (file)
@@ -39,6 +39,8 @@ LockServerDaemon::init(
 
 /**
  * Simple lock server daemon that accepts lock/unlock requests
+ *
+ * @ingroup LockManager Maintenance
  */
 class LockServerDaemon {
        /** @var resource */
index e222314..a46c5e1 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
+ * @file
  * @ingroup Maintenance
  */
 
 /**
  * When using shared tables that are referenced by foreign keys on local
  * tables you have to change the constraints on local tables.
- * 
+ *
  * The shared tables have to have GRANT REFERENCE on shared tables to local schema
  * i.e.: GRANT REFERENCES (user_id) ON mwuser TO hubclient;
  */
@@ -40,12 +41,12 @@ class AlterSharedConstraints extends Maintenance {
 
        public function execute() {
                global $wgSharedDB, $wgSharedTables, $wgSharedPrefix, $wgDBprefix;
-               
+
                if ( $wgSharedDB == null ) {
                        $this->output( "Database sharing is not enabled\n" );
                        return;
                }
-               
+
                $dbw = wfGetDB( DB_MASTER );
                foreach ( $wgSharedTables as $table ) {
                        $stable = $dbw->tableNameInternal($table);
@@ -54,7 +55,7 @@ class AlterSharedConstraints extends Maintenance {
                        } else {
                                $ltable = "{$wgDBprefix}{$stable}" ;
                        }
-                       
+
                        $result = $dbw->query( "SELECT uc.constraint_name, uc.table_name, ucc.column_name, uccpk.table_name pk_table_name, uccpk.column_name pk_column_name, uc.delete_rule, uc.deferrable, uc.deferred
                                          FROM user_constraints uc, user_cons_columns ucc, user_cons_columns uccpk
                                         WHERE uc.constraint_type = 'R'
@@ -62,9 +63,9 @@ class AlterSharedConstraints extends Maintenance {
                                           AND uccpk.constraint_name = uc.r_constraint_name
                                           AND uccpk.table_name = '$ltable'" );
                        while (($row = $result->fetchRow()) !== false) {
-                               
+
                                        $this->output( "Altering {$row['constraint_name']} ...");
-                                       
+
                                        try {
                                                $dbw->query( "ALTER TABLE {$row['table_name']} DROP CONSTRAINT {$wgDBprefix}{$row['constraint_name']}" );
                                        } catch (DBQueryError $exdb) {
@@ -72,13 +73,13 @@ class AlterSharedConstraints extends Maintenance {
                                                        throw $exdb;
                                                }
                                        }
-                                       
+
                                        $deleteRule = $row['delete_rule'] == 'NO ACTION' ? '' : "ON DELETE {$row['delete_rule']}";
-                                       $dbw->query( "ALTER TABLE {$row['table_name']} ADD CONSTRAINT {$wgDBprefix}{$row['constraint_name']} 
-                                               FOREIGN KEY ({$row['column_name']}) 
-                                               REFERENCES {$wgSharedDB}.$stable({$row['pk_column_name']}) 
+                                       $dbw->query( "ALTER TABLE {$row['table_name']} ADD CONSTRAINT {$wgDBprefix}{$row['constraint_name']}
+                                               FOREIGN KEY ({$row['column_name']})
+                                               REFERENCES {$wgSharedDB}.$stable({$row['pk_column_name']})
                                                {$deleteRule} {$row['deferrable']} INITIALLY {$row['deferred']}" );
-                                       
+
                                        $this->output( "DONE\n" );
                        }
                }
index 6c669bf..5797a6c 100644 (file)
@@ -38,6 +38,8 @@ if ( !defined( 'MEDIAWIKI' ) ) {
 // ----------------------------------------------------------------------------------
 
 /**
+ * Maintenance script to do various checks on external storage.
+ *
  * @ingroup Maintenance ExternalStorage
  */
 class CheckStorage {
index 4594db7..951ab1a 100644 (file)
 
 require_once( __DIR__ . '/../Maintenance.php' );
 
+/**
+ * Maintenance script that compress the text of a wiki.
+ *
+ * @ingroup Maintenance ExternalStorage
+ */
 class CompressOld extends Maintenance {
        /**
         * @todo document
index 6020f22..39f08f9 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Get the text of a revision, resolving external storage if needed.
+ *
  * 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
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
+ * @file
  * @ingroup Maintenance ExternalStorage
  */
 
 require_once( __DIR__ . '/../Maintenance.php' );
 
+/**
+ * Maintenance script that gets the text of a revision,
+ * resolving external storage if needed.
+ *
+ * @ingroup Maintenance ExternalStorage
+ */
 class DumpRev extends Maintenance {
        public function __construct() {
                parent::__construct();
index 52ee825..21a4957 100644 (file)
 
 require_once( __DIR__ . '/../Maintenance.php' );
 
+/**
+ * Maintenance script to fix bug 20757.
+ *
+ * @ingroup Maintenance ExternalStorage
+ */
 class FixBug20757 extends Maintenance {
        var $batchSize = 10000;
        var $mapCache = array();
index 82ee135..4e24628 100644 (file)
@@ -1,7 +1,6 @@
 <?php
-
 /**
- * Show some statistics on the blob_orphans table, created with trackBlobs.php
+ * Show some statistics on the blob_orphans table, created with trackBlobs.php.
  *
  * 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
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
+ * @file
  * @ingroup Maintenance ExternalStorage
  */
+
 require_once( __DIR__ . '/../Maintenance.php' );
 
+/**
+ * Maintenance script that shows some statistics on the blob_orphans table,
+ * created with trackBlobs.php.
+ *
+ * @ingroup Maintenance ExternalStorage
+ */
 class OrphanStats extends Maintenance {
        public function __construct() {
                parent::__construct();
index 4098077..f770681 100644 (file)
@@ -42,6 +42,12 @@ Options:
 $job = RecompressTracked::newFromCommandLine( $args, $options );
 $job->execute();
 
+/**
+ * Maintenance script that moves blobs indexed by trackBlobs.php to a specified
+ * list of destination clusters, and recompresses them in the process.
+ *
+ * @ingroup Maintenance ExternalStorage
+ */
 class RecompressTracked {
        var $destClusters;
        var $batchSize = 1000;
index 7e288e1..0f5cd2b 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
- * Script to convert history stubs that point to an external row to direct
- * external pointers.
+ * Convert history stubs that point to an external row to direct external
+ * pointers.
  *
  * 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
index 998ebe4..58b0847 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Test revision text compression and decompression.
+ *
  * 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
@@ -16,8 +18,7 @@
  * http://www.gnu.org/copyleft/gpl.html
  *
  * @file
- * @ingroup Maintenance
- * @see wfWaitForSlaves()
+ * @ingroup Maintenance ExternalStorage
  */
 
 $optionsWithArgs = array( 'start', 'limit', 'type' );