Index: trunk/phase3/includes/installer/DatabaseUpdater.php |
— | — | @@ -31,12 +31,6 @@ |
32 | 32 | protected $extensionUpdates = array(); |
33 | 33 | |
34 | 34 | /** |
35 | | - * Used to hold schema files during installation process |
36 | | - * @var array |
37 | | - */ |
38 | | - protected $newExtensions = array(); |
39 | | - |
40 | | - /** |
41 | 35 | * Handle to the database subclass |
42 | 36 | * |
43 | 37 | * @var DatabaseBase |
— | — | @@ -177,23 +171,6 @@ |
178 | 172 | } |
179 | 173 | |
180 | 174 | /** |
181 | | - * Add a brand new extension to MediaWiki. Used during the initial install |
182 | | - * @param $ext String Name of extension |
183 | | - * @param $sqlPath String Full path to the schema file |
184 | | - */ |
185 | | - public function addNewExtension( $ext, $sqlPath ) { |
186 | | - $this->newExtensions[ strtolower( $ext ) ] = $sqlPath; |
187 | | - } |
188 | | - |
189 | | - /** |
190 | | - * Get the list of extensions that registered a schema with our DB type |
191 | | - * @return array |
192 | | - */ |
193 | | - public function getNewExtensions() { |
194 | | - return $this->newExtensions; |
195 | | - } |
196 | | - |
197 | | - /** |
198 | 175 | * Get the list of extension-defined updates |
199 | 176 | * |
200 | 177 | * @return Array |
Index: trunk/phase3/includes/installer/DatabaseInstaller.php |
— | — | @@ -183,26 +183,9 @@ |
184 | 184 | if ( !$status->isOK() ) { |
185 | 185 | return $status; |
186 | 186 | } |
187 | | - $updater = DatabaseUpdater::newForDB( $this->db ); |
188 | | - $extensionUpdates = $updater->getNewExtensions(); |
189 | 187 | |
190 | | - $ourExtensions = array_map( 'strtolower', $this->getVar( '_Extensions' ) ); |
191 | | - |
192 | | - foreach( $ourExtensions as $ext ) { |
193 | | - if( isset( $extensionUpdates[$ext] ) ) { |
194 | | - $this->db->begin( __METHOD__ ); |
195 | | - $error = $this->db->sourceFile( $extensionUpdates[$ext] ); |
196 | | - if( $error !== true ) { |
197 | | - $this->db->rollback( __METHOD__ ); |
198 | | - $status->warning( 'config-install-tables-failed', $error ); |
199 | | - } else { |
200 | | - $this->db->commit( __METHOD__ ); |
201 | | - } |
202 | | - } |
203 | | - } |
204 | | - |
205 | 188 | // Now run updates to create tables for old extensions |
206 | | - $updater->doUpdates( array( 'extensions' ) ); |
| 189 | + DatabaseUpdater::newForDB( $this->db )->doUpdates( array( 'extensions' ) ); |
207 | 190 | |
208 | 191 | return $status; |
209 | 192 | } |
Index: trunk/extensions/Math/Math.hooks.php |
— | — | @@ -104,7 +104,10 @@ |
105 | 105 | * @param $updater DatabaseUpdater |
106 | 106 | * @return bool |
107 | 107 | */ |
108 | | - static function onLoadExtensionSchemaUpdates( $updater ) { |
| 108 | + static function onLoadExtensionSchemaUpdates( $updater = null ) { |
| 109 | + if( is_null( $updater ) ) { |
| 110 | + throw new MWException( "Math extension is only necessary in 1.18 or above" ); |
| 111 | + } |
109 | 112 | $map = array( |
110 | 113 | 'mysql' => 'math.sql', |
111 | 114 | 'sqlite' => 'math.sql', |
— | — | @@ -115,10 +118,8 @@ |
116 | 119 | ); |
117 | 120 | $base = dirname( __FILE__ ); |
118 | 121 | $type = $updater->getDB()->getType(); |
119 | | - if ( array_key_exists( $type, $map ) ) { |
120 | | - $file = $map[$type]; |
121 | | - $sql = "$base/db/$file"; |
122 | | - $updater->addNewExtension( 'CodeReview', $sql ); |
| 122 | + if ( isset( $map[$type] ) ) { |
| 123 | + $sql = dirname( __FILE__ ) . '/db/' . $map[$type]; |
123 | 124 | $updater->addExtensionTable( 'math', $sql ); |
124 | 125 | } else { |
125 | 126 | throw new MWException( "Math extension does not currently support $type database." ); |
Index: trunk/extensions/CodeReview/CodeReview.php |
— | — | @@ -241,7 +241,6 @@ |
242 | 242 | $base = dirname( __FILE__ ); |
243 | 243 | switch ( $updater->getDB()->getType() ) { |
244 | 244 | case 'mysql': |
245 | | - $updater->addNewExtension( 'CodeReview', "$base/codereview.sql" ); |
246 | 245 | $updater->addExtensionUpdate( array( 'addTable', 'code_rev', |
247 | 246 | "$base/codereview.sql", true ) ); // Initial install tables |
248 | 247 | $updater->addExtensionUpdate( array( 'addField', 'code_rev', 'cr_diff', |
— | — | @@ -283,7 +282,6 @@ |
284 | 283 | "$base/archives/codereview-repopath.sql", true ) ); |
285 | 284 | break; |
286 | 285 | case 'sqlite': |
287 | | - $updater->addNewExtension( 'CodeReview', "$base/codereview.sql" ); |
288 | 286 | $updater->addExtensionUpdate( array( 'addTable', 'code_rev', "$base/codereview.sql", true ) ); |
289 | 287 | $updater->addExtensionUpdate( array( 'addTable', 'code_signoffs', "$base/archives/code_signoffs.sql", true ) ); |
290 | 288 | $updater->addExtensionUpdate( array( 'addField', 'code_signoffs', 'cs_user', |
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.php |
— | — | @@ -274,7 +274,7 @@ |
275 | 275 | } |
276 | 276 | } else { |
277 | 277 | if ( $updater->getDB()->getType() == 'mysql' ) { |
278 | | - $updater->addNewExtension( 'ConfirmAccount', "$base/ConfirmAccount.sql" ); |
| 278 | + $updater->addExtensionUpdate( array( 'addTable', 'account_requests', "$base/ConfirmAccount.sql", true ) ); |
279 | 279 | |
280 | 280 | $updater->addExtensionUpdate( array( 'addField', 'account_requests', 'acr_filename', |
281 | 281 | "$base/archives/patch-acr_filename.sql", true ) ); |
— | — | @@ -285,7 +285,7 @@ |
286 | 286 | |
287 | 287 | $updater->addExtensionUpdate( array( 'addIndex', 'account_requests', 'acr_email', "$base/archives/patch-email-index.sql", true ) ); |
288 | 288 | } else if ( $updater->getDB()->getType() == 'postgres' ) { |
289 | | - $updater->addNewExtension( 'ConfirmAccount', "$base/ConfirmAccount.pg.sql" ); |
| 289 | + $updater->addExtensionUpdate( array( 'addTable', 'account_requests', "$base/ConfirmAccount.pg.sql", true ) ); |
290 | 290 | |
291 | 291 | $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_held', "TIMESTAMPTZ" ) ); |
292 | 292 | $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_filename', "TEXT" ) ); |