r79432 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79431‎ | r79432 | r79433 >
Date:17:07, 1 January 2011
Author:ialex
Status:deferred
Tags:
Comment:
Converted PrefSwitch extension to use the new version of the LoadExtensionSchemaUpdates hook
Modified paths:
  • /trunk/extensions/PrefSwitch/PrefSwitch.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PrefSwitch/PrefSwitch.hooks.php
@@ -23,12 +23,18 @@
2424 /*
2525 * LoadExtensionSchemaUpdates hook
2626 */
27 - public static function loadExtensionSchemaUpdates() {
28 - global $wgExtNewTables, $wgExtNewFields;
29 -
 27+ public static function loadExtensionSchemaUpdates( $updater = null ) {
3028 $dir = dirname( __FILE__ ) . '/patches';
31 - $wgExtNewTables[] = array( 'prefswitch_survey', $dir . '/PrefSwitch.sql' );
32 - $wgExtNewFields[] = array( 'prefswitch_survey', 'pss_user_text', $dir . '/PrefSwitch-addusertext.sql' );
 29+ if ( $updater === null ) {
 30+ global $wgExtNewTables, $wgExtNewFields;
 31+ $wgExtNewTables[] = array( 'prefswitch_survey', $dir . '/PrefSwitch.sql' );
 32+ $wgExtNewFields[] = array( 'prefswitch_survey', 'pss_user_text', $dir . '/PrefSwitch-addusertext.sql' );
 33+ } else {
 34+ $updater->addExtensionUpdate( array( 'addTable', 'prefswitch_survey',
 35+ $dir . '/PrefSwitch.sql', true ) );
 36+ $updater->addExtensionUpdate( array( 'addField', 'prefswitch_survey',
 37+ 'pss_user_text', $dir . '/PrefSwitch-addusertext.sql', true ) );
 38+ }
3339 return true;
3440 }
3541

Status & tagging log