From: Brion Vibber Date: Sat, 25 Jun 2005 11:04:40 +0000 (+0000) Subject: ipblocks, recentchanges conversion X-Git-Tag: 1.5.0beta1~35 X-Git-Url: http://git.cyclocoop.org//%22javascript:ModifierStyle%28%27%22.%24id.%22%27%29/%22?a=commitdiff_plain;h=74d80b7eadee35037e209e6b5102d70265868cbc;p=lhc%2Fweb%2Fwiklou.git ipblocks, recentchanges conversion some code consolidation --- diff --git a/maintenance/upgrade1_5.php b/maintenance/upgrade1_5.php index 4474829905..1637469252 100644 --- a/maintenance/upgrade1_5.php +++ b/maintenance/upgrade1_5.php @@ -42,29 +42,30 @@ class FiveUpgrade { function upgrade( $step ) { $this->step = $step; - if( $this->doing( 'page' ) ) - $this->upgradePage(); - if( $this->doing( 'links' ) ) - $this->upgradeLinks(); - if( $this->doing( 'user' ) ) - $this->upgradeUser(); - if( $this->doing( 'image' ) ) - $this->upgradeImage(); - if( $this->doing( 'oldimage' ) ) - $this->upgradeOldImage(); - if( $this->doing( 'watchlist' ) ) - $this->upgradeWatchlist(); - if( $this->doing( 'logging' ) ) - $this->upgradeLogging(); - if( $this->doing( 'archive' ) ) - $this->upgradeArchive(); - if( $this->doing( 'imagelinks' ) ) - $this->upgradeImagelinks(); - if( $this->doing( 'categorylinks' ) ) - $this->upgradeCategorylinks(); - if( $this->doing( 'cleanup' ) ) + $tables = array( + 'page', + 'links', + 'user', + 'image', + 'oldimage', + 'watchlist', + 'logging', + 'archive', + 'imagelinks', + 'categorylinks', + 'ipblocks', + 'recentchanges' ); + foreach( $tables as $table ) { + if( $this->doing( $table ) ) { + $method = 'upgrade' . ucfirst( $table ); + $this->$method(); + } + } + + if( $this->doing( 'cleanup' ) ) { $this->upgradeCleanup(); + } } @@ -1031,6 +1032,103 @@ END; } } + function upgradeIpblocks() { + global $wgUseLatin1; + if( $wgUseLatin1 ) { + $tabledef = << MW_UPGRADE_COPY, + 'ipb_address' => MW_UPGRADE_COPY, + 'ipb_user' => MW_UPGRADE_COPY, + 'ipb_by' => MW_UPGRADE_COPY, + 'ipb_reason' => MW_UPGRADE_ENCODE, + 'ipb_timestamp' => MW_UPGRADE_COPY, + 'ipb_auto' => MW_UPGRADE_COPY, + 'ipb_expiry' => MW_UPGRADE_COPY ); + $this->copyTable( 'ipblocks', $tabledef, $fields ); + } + } + + function upgradeRecentchanges() { + // There's a format change in the namespace field + $tabledef = << MW_UPGRADE_COPY, + 'rc_timestamp' => MW_UPGRADE_COPY, + 'rc_cur_time' => MW_UPGRADE_COPY, + 'rc_user' => MW_UPGRADE_COPY, + 'rc_user_text' => MW_UPGRADE_ENCODE, + 'rc_namespace' => MW_UPGRADE_COPY, + 'rc_title' => MW_UPGRADE_ENCODE, + 'rc_comment' => MW_UPGRADE_ENCODE, + 'rc_minor' => MW_UPGRADE_COPY, + 'rc_bot' => MW_UPGRADE_COPY, + 'rc_new' => MW_UPGRADE_COPY, + 'rc_cur_id' => MW_UPGRADE_COPY, + 'rc_this_oldid' => MW_UPGRADE_COPY, + 'rc_last_oldid' => MW_UPGRADE_COPY, + 'rc_type' => MW_UPGRADE_COPY, + 'rc_moved_to_ns' => MW_UPGRADE_COPY, + 'rc_moved_to_title' => MW_UPGRADE_ENCODE, + 'rc_patrolled' => MW_UPGRADE_COPY, + 'rc_ip' => MW_UPGRADE_COPY ); + $this->copyTable( 'recentchanges', $tabledef, $fields ); + } + /** * Rename all our temporary tables into final place. * We've left things in place so a read-only wiki can continue running