r77570 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77569‎ | r77570 | r77571 >
Date:10:08, 2 December 2010
Author:ialex
Status:deferred
Tags:
Comment:
Converted METIS extension to use the new version of the LoadExtensionSchemaUpdates hook
Modified paths:
  • /trunk/extensions/METIS/METIS.php (modified) (history)

Diff [purge]

Index: trunk/extensions/METIS/METIS.php
@@ -50,13 +50,20 @@
5151 return true;
5252 }
5353
54 -function efMetisSchemaUpdate() {
55 - global $wgDBtype, $wgExtNewTables;
56 -
57 - if ( $wgDBtype == 'mysql' ) {
58 - $wgExtNewTables[] = array( 'metis', dirname( __FILE__ ) . '/METIS.sql' );
59 - } elseif( $wgDBtype == 'postgres' ) {
60 - $wgExtNewTables[] = array( 'metis', dirname( __FILE__ ) . '/METIS.pg.sql' );
 54+function efMetisSchemaUpdate( $updater = null ) {
 55+ if ( $updater === null ) {
 56+ global $wgDBtype, $wgExtNewTables;
 57+ if ( $wgDBtype == 'mysql' ) {
 58+ $wgExtNewTables[] = array( 'metis', dirname( __FILE__ ) . '/METIS.sql' );
 59+ } elseif ( $wgDBtype == 'postgres' ) {
 60+ $wgExtNewTables[] = array( 'metis', dirname( __FILE__ ) . '/METIS.pg.sql' );
 61+ }
 62+ } else {
 63+ if ( $updater->getDB()->getType() == 'mysql' ) {
 64+ $updater->addExtensionUpdate( array( 'addTable', 'metis', dirname( __FILE__ ) . '/METIS.sql', true ) );
 65+ } elseif ( $updater->getDB()->getType() == 'postgres' ) {
 66+ $updater->addExtensionUpdate( array( 'addTable', 'metis', dirname( __FILE__ ) . '/METIS.pg.sql', true ) );
 67+ }
6168 }
6269 return true;
6370 }

Status & tagging log