call_user_func_array( $func, $params );
flush();
}
- $this->setAppliedUpdates( $version, $updates );
+ // some updates don't get recorded :(
+ if( $version !== 'always' ) {
+ $this->setAppliedUpdates( $version, $updates );
+ }
}
}
// style of recording our steps. Run all to be safe
if( !$this->canUseNewUpdatelog() ) {
$this->updates = $this->updater->getUpdates();
- return;
- }
- foreach( $this->updater->getUpdates() as $version => $updates ) {
- $appliedUpdates = $this->getAppliedUpdates( $version );
- if( !$appliedUpdates || $appliedUpdates != $updates ) {
- $this->updates[ $version ] = $updates;
+ } else {
+ foreach( $this->updater->getUpdates() as $version => $updates ) {
+ $appliedUpdates = $this->getAppliedUpdates( $version );
+ if( !$appliedUpdates || $appliedUpdates != $updates ) {
+ $this->updates[ $version ] = $updates;
+ }
}
}
+ $this->getOldGlobalUpdates();
}
protected function getAppliedUpdates( $version ) {
return $this->db->tableExists( 'updatelog' ) &&
$this->db->fieldExists( 'updatelog', 'ul_value' );
}
+
+ /**
+ * Before 1.17, we used to handle updates via stuff like $wgUpdates,
+ * $wgExtNewTables/Fields/Indexes. This is nasty :) We refactored a lot
+ * of this in 1.17 but we want to remain back-compatible for awhile. So
+ * load up these old global-based things into our update list. We can't
+ * version these like we do with our core updates, so they have to go
+ * in 'always'
+ */
+ private function getOldGlobalUpdates() {
+ global $wgUpdates, $wgExtNewFields, $wgExtNewTables,
+ $wgExtModifiedFields, $wgExtNewIndexes;
+
+ if( isset( $wgUpdates[ $this->db->getType() ] ) ) {
+ foreach( $wgUpdates[ $this->db->getType() ] as $upd ) {
+ $this->updates['always'][] = $upd;
+ }
+ }
+
+ foreach ( $wgExtNewTables as $tableRecord ) {
+ $this->updates['always'][] = array(
+ 'add_table', $tableRecord[0], $tableRecord[1], true
+ );
+ }
+
+ foreach ( $wgExtNewFields as $fieldRecord ) {
+ if ( $fieldRecord[0] != 'user' || $doUser ) {
+ $this->updates['always'][] = array(
+ 'add_field', $fieldRecord[0], $fieldRecord[1],
+ $fieldRecord[2], true
+ );
+ }
+ }
+
+ foreach ( $wgExtNewIndexes as $fieldRecord ) {
+ $this->updates['always'][] = array(
+ 'add_index', $fieldRecord[0], $fieldRecord[1],
+ $fieldRecord[2], true
+ );
+ }
+
+ foreach ( $wgExtModifiedFields as $fieldRecord ) {
+ $this->updates['always'][] = array(
+ 'modify_field', $fieldRecord[0], $fieldRecord[1],
+ $fieldRecord[2], true
+ );
+ }
+ }
}
$up = new Update( $wgDatabase );
$up->doUpdates();
- // OpenID is still using this stupid thing, or we could kill this too
- global $wgUpdates;
- if ( isset( $wgUpdates[$wgDBtype] ) ) {
- foreach ( $wgUpdates[$wgDBtype] as $params ) {
- $func = array_shift( $params );
- call_user_func_array( $func, $params );
- flush();
- }
- }
-
- // / @fixme clean up this mess too!
- global $wgExtNewTables, $wgExtNewFields, $wgExtNewIndexes;
- # Add missing extension tables
- foreach ( $wgExtNewTables as $tableRecord ) {
- add_table( $tableRecord[0], $tableRecord[1], true );
- flush();
- }
- # Add missing extension fields
- foreach ( $wgExtNewFields as $fieldRecord ) {
- if ( $fieldRecord[0] != 'user' || $doUser ) {
- add_field( $fieldRecord[0], $fieldRecord[1], $fieldRecord[2], true );
- }
- flush();
- }
- # Add missing extension indexes
- foreach ( $wgExtNewIndexes as $fieldRecord ) {
- add_index( $fieldRecord[0], $fieldRecord[1], $fieldRecord[2], true );
- flush();
- }
- # Add modified extension fields
- foreach ( $wgExtModifiedFields as $fieldRecord ) {
- modify_field( $fieldRecord[0], $fieldRecord[1], $fieldRecord[2], true );
- flush();
- }
-
wfOut( "Deleting old default messages (this may take a long time!)..." );
if ( !defined( 'MW_NO_SETUP' ) ) {
define( 'MW_NO_SETUP', true );