Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -952,41 +952,6 @@ |
953 | 953 | $up = new Update( $wgDatabase ); |
954 | 954 | $up->doUpdates(); |
955 | 955 | |
956 | | - // OpenID is still using this stupid thing, or we could kill this too |
957 | | - global $wgUpdates; |
958 | | - if ( isset( $wgUpdates[$wgDBtype] ) ) { |
959 | | - foreach ( $wgUpdates[$wgDBtype] as $params ) { |
960 | | - $func = array_shift( $params ); |
961 | | - call_user_func_array( $func, $params ); |
962 | | - flush(); |
963 | | - } |
964 | | - } |
965 | | - |
966 | | - // / @fixme clean up this mess too! |
967 | | - global $wgExtNewTables, $wgExtNewFields, $wgExtNewIndexes; |
968 | | - # Add missing extension tables |
969 | | - foreach ( $wgExtNewTables as $tableRecord ) { |
970 | | - add_table( $tableRecord[0], $tableRecord[1], true ); |
971 | | - flush(); |
972 | | - } |
973 | | - # Add missing extension fields |
974 | | - foreach ( $wgExtNewFields as $fieldRecord ) { |
975 | | - if ( $fieldRecord[0] != 'user' || $doUser ) { |
976 | | - add_field( $fieldRecord[0], $fieldRecord[1], $fieldRecord[2], true ); |
977 | | - } |
978 | | - flush(); |
979 | | - } |
980 | | - # Add missing extension indexes |
981 | | - foreach ( $wgExtNewIndexes as $fieldRecord ) { |
982 | | - add_index( $fieldRecord[0], $fieldRecord[1], $fieldRecord[2], true ); |
983 | | - flush(); |
984 | | - } |
985 | | - # Add modified extension fields |
986 | | - foreach ( $wgExtModifiedFields as $fieldRecord ) { |
987 | | - modify_field( $fieldRecord[0], $fieldRecord[1], $fieldRecord[2], true ); |
988 | | - flush(); |
989 | | - } |
990 | | - |
991 | 956 | wfOut( "Deleting old default messages (this may take a long time!)..." ); |
992 | 957 | if ( !defined( 'MW_NO_SETUP' ) ) { |
993 | 958 | define( 'MW_NO_SETUP', true ); |
Index: trunk/phase3/includes/installer/Update.php |
— | — | @@ -39,7 +39,10 @@ |
40 | 40 | call_user_func_array( $func, $params ); |
41 | 41 | flush(); |
42 | 42 | } |
43 | | - $this->setAppliedUpdates( $version, $updates ); |
| 43 | + // some updates don't get recorded :( |
| 44 | + if( $version !== 'always' ) { |
| 45 | + $this->setAppliedUpdates( $version, $updates ); |
| 46 | + } |
44 | 47 | } |
45 | 48 | } |
46 | 49 | |
— | — | @@ -48,14 +51,15 @@ |
49 | 52 | // style of recording our steps. Run all to be safe |
50 | 53 | if( !$this->canUseNewUpdatelog() ) { |
51 | 54 | $this->updates = $this->updater->getUpdates(); |
52 | | - return; |
53 | | - } |
54 | | - foreach( $this->updater->getUpdates() as $version => $updates ) { |
55 | | - $appliedUpdates = $this->getAppliedUpdates( $version ); |
56 | | - if( !$appliedUpdates || $appliedUpdates != $updates ) { |
57 | | - $this->updates[ $version ] = $updates; |
| 55 | + } else { |
| 56 | + foreach( $this->updater->getUpdates() as $version => $updates ) { |
| 57 | + $appliedUpdates = $this->getAppliedUpdates( $version ); |
| 58 | + if( !$appliedUpdates || $appliedUpdates != $updates ) { |
| 59 | + $this->updates[ $version ] = $updates; |
| 60 | + } |
58 | 61 | } |
59 | 62 | } |
| 63 | + $this->getOldGlobalUpdates(); |
60 | 64 | } |
61 | 65 | |
62 | 66 | protected function getAppliedUpdates( $version ) { |
— | — | @@ -92,4 +96,52 @@ |
93 | 97 | return $this->db->tableExists( 'updatelog' ) && |
94 | 98 | $this->db->fieldExists( 'updatelog', 'ul_value' ); |
95 | 99 | } |
| 100 | + |
| 101 | + /** |
| 102 | + * Before 1.17, we used to handle updates via stuff like $wgUpdates, |
| 103 | + * $wgExtNewTables/Fields/Indexes. This is nasty :) We refactored a lot |
| 104 | + * of this in 1.17 but we want to remain back-compatible for awhile. So |
| 105 | + * load up these old global-based things into our update list. We can't |
| 106 | + * version these like we do with our core updates, so they have to go |
| 107 | + * in 'always' |
| 108 | + */ |
| 109 | + private function getOldGlobalUpdates() { |
| 110 | + global $wgUpdates, $wgExtNewFields, $wgExtNewTables, |
| 111 | + $wgExtModifiedFields, $wgExtNewIndexes; |
| 112 | + |
| 113 | + if( isset( $wgUpdates[ $this->db->getType() ] ) ) { |
| 114 | + foreach( $wgUpdates[ $this->db->getType() ] as $upd ) { |
| 115 | + $this->updates['always'][] = $upd; |
| 116 | + } |
| 117 | + } |
| 118 | + |
| 119 | + foreach ( $wgExtNewTables as $tableRecord ) { |
| 120 | + $this->updates['always'][] = array( |
| 121 | + 'add_table', $tableRecord[0], $tableRecord[1], true |
| 122 | + ); |
| 123 | + } |
| 124 | + |
| 125 | + foreach ( $wgExtNewFields as $fieldRecord ) { |
| 126 | + if ( $fieldRecord[0] != 'user' || $doUser ) { |
| 127 | + $this->updates['always'][] = array( |
| 128 | + 'add_field', $fieldRecord[0], $fieldRecord[1], |
| 129 | + $fieldRecord[2], true |
| 130 | + ); |
| 131 | + } |
| 132 | + } |
| 133 | + |
| 134 | + foreach ( $wgExtNewIndexes as $fieldRecord ) { |
| 135 | + $this->updates['always'][] = array( |
| 136 | + 'add_index', $fieldRecord[0], $fieldRecord[1], |
| 137 | + $fieldRecord[2], true |
| 138 | + ); |
| 139 | + } |
| 140 | + |
| 141 | + foreach ( $wgExtModifiedFields as $fieldRecord ) { |
| 142 | + $this->updates['always'][] = array( |
| 143 | + 'modify_field', $fieldRecord[0], $fieldRecord[1], |
| 144 | + $fieldRecord[2], true |
| 145 | + ); |
| 146 | + } |
| 147 | + } |
96 | 148 | } |