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() {
<?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();
<?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',
<?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() {
<?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() {
<?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',
<?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();
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() {
<?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',
<?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() {
<?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() {
*
* 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;
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' ) );
$wgDiff = $bin;
}
}
-
- $user = new User();
+
+ $user = new User();
$this->options = ParserOptions::newFromUser( $user );
-
+
if ( $this->hasOption( 'tidy' ) ) {
global $wgUseTidy;
if ( !$wgUseTidy ) {
}
$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());
}
}
}
}
-
+
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" ) ) {