From 63601400e476c6cf43d985f3e7b9864681695ed4 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 18 Jan 2013 16:46:04 +0100 Subject: Update to MediaWiki 1.20.2 this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024 --- maintenance/cleanupAncientTables.php | 113 +++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 maintenance/cleanupAncientTables.php (limited to 'maintenance/cleanupAncientTables.php') diff --git a/maintenance/cleanupAncientTables.php b/maintenance/cleanupAncientTables.php new file mode 100644 index 00000000..dbc2e0d3 --- /dev/null +++ b/maintenance/cleanupAncientTables.php @@ -0,0 +1,113 @@ +mDescription = "Cleanup ancient tables and indexes"; + $this->addOption( 'force', 'Actually run this script' ); + } + + public function execute() { + if( !$this->hasOption( 'force' ) ) { + $this->error( "This maintenance script will remove old columns and indexes.\n" + . "It is recommended to backup your database first, and ensure all your data has been migrated to newer tables\n" + . "If you want to continue, run this script again with the --force \n" + ); + } + + $db = wfGetDB( DB_MASTER ); + $ancientTables = array( + 'blobs', // 1.4 + 'brokenlinks', // 1.4 + 'cur', // 1.4 + 'ip_blocks_old', // Temporary in 1.6 + 'links', // 1.4 + 'linkscc', // 1.4 + // 'math', // 1.18, but don't want to drop if math extension is enabled... + 'old', // 1.4 + 'oldwatchlist', // pre 1.1? + 'trackback', // 1.19 + 'user_rights', // 1.5 + 'validate', // 1.6 + ); + + foreach( $ancientTables as $table ) { + if ( $db->tableExists( $table, __METHOD__ ) ) { + $this->output( "Dropping table $table..." ); + $db->dropTable( $table, __METHOD__ ); + $this->output( "done.\n" ); + } + } + + $this->output( "Cleaning up text table\n" ); + + $oldIndexes = array( + 'old_namespace', + 'old_timestamp', + 'name_title_timestamp', + 'user_timestamp', + 'usertext_timestamp', + ); + foreach( $oldIndexes as $index ) { + if ( $db->indexExists( 'text', $index, __METHOD__ ) ) { + $this->output( "Dropping index $index from the text table..." ); + $db->query( "DROP INDEX " . $db->addIdentifierQuotes( $index ) + . " ON " . $db->tableName( 'text' ) ); + $this->output( "done.\n" ); + } + } + + $oldFields = array( + 'old_namespace', + 'old_title', + 'old_comment', + 'old_user', + 'old_user_text', + 'old_timestamp', + 'old_minor_edit', + 'inverse_timestamp', + ); + foreach( $oldFields as $field ) { + if ( $db->fieldExists( 'text', $field, __METHOD__ ) ) { + $this->output( "Dropping the $field field from the text table..." ); + $db->query( "ALTER TABLE " . $db->tableName( 'text' ) + . " DROP COLUMN " . $db->addIdentifierQuotes( $field ) ); + $this->output( "done.\n" ); + } + } + $this->output( "Done!\n" ); + } +} + +$maintClass = "CleanupAncientTables"; +require_once( RUN_MAINTENANCE_IF_MAIN ); -- cgit v1.2.2