Index: trunk/extensions/Wikilog/WikilogHooks.php |
— | — | @@ -322,19 +322,32 @@ |
323 | 323 | * |
324 | 324 | * @todo Add support for PostgreSQL and SQLite databases. |
325 | 325 | */ |
326 | | - static function ExtensionSchemaUpdates() { |
327 | | - global $wgDBtype, $wgExtNewFields, $wgExtPGNewFields, $wgExtNewIndexes, $wgExtNewTables; |
328 | | - |
| 326 | + static function ExtensionSchemaUpdates( $updater = null ) { |
329 | 327 | $dir = dirname( __FILE__ ) . '/'; |
330 | 328 | |
331 | | - if ( $wgDBtype == 'mysql' ) { |
332 | | - $wgExtNewTables[] = array( "wikilog_wikilogs", "{$dir}wikilog-tables.sql" ); |
333 | | - $wgExtNewIndexes[] = array( "wikilog_comments", "wlc_timestamp", "{$dir}archives/patch-comments-indexes.sql" ); |
| 329 | + if ( $updater === null ) { |
| 330 | + global $wgDBtype, $wgExtNewIndexes, $wgExtNewTables; |
| 331 | + if ( $wgDBtype == 'mysql' ) { |
| 332 | + $wgExtNewTables[] = array( "wikilog_wikilogs", "{$dir}wikilog-tables.sql" ); |
| 333 | + $wgExtNewIndexes[] = array( "wikilog_comments", "wlc_timestamp", "{$dir}archives/patch-comments-indexes.sql" ); |
| 334 | + } else { |
| 335 | + // TODO: PostgreSQL, SQLite, etc... |
| 336 | + print "\n" . |
| 337 | + "Warning: There are no table structures for the Wikilog\n" . |
| 338 | + "extension other than for MySQL at this moment.\n\n"; |
| 339 | + } |
334 | 340 | } else { |
335 | | - // TODO: PostgreSQL, SQLite, etc... |
336 | | - print "\n" . |
337 | | - "Warning: There are no table structures for the Wikilog\n" . |
338 | | - "extension other than for MySQL at this moment.\n\n"; |
| 341 | + if ( $updater->getDB()->getType() == 'mysql' ) { |
| 342 | + $updater->addExtensionUpdate( array( 'addTable', "wikilog_wikilogs", |
| 343 | + "{$dir}wikilog-tables.sql", true ) ); |
| 344 | + $updater->addExtensionUpdate( array( 'addIndex', "wikilog_comments", |
| 345 | + "wlc_timestamp", "{$dir}archives/patch-comments-indexes.sql", true ) ); |
| 346 | + } else { |
| 347 | + // TODO: PostgreSQL, SQLite, etc... |
| 348 | + print "\n" . |
| 349 | + "Warning: There are no table structures for the Wikilog\n" . |
| 350 | + "extension other than for MySQL at this moment.\n\n"; |
| 351 | + } |
339 | 352 | } |
340 | 353 | return true; |
341 | 354 | } |