r77062 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77061‎ | r77062 | r77063 >
Date:18:29, 20 November 2010
Author:ialex
Status:ok
Tags:
Comment:
Converted SocialProfile extension to use the new version of the LoadExtensionSchemaUpdates hook
Modified paths:
  • /trunk/extensions/SocialProfile/SocialProfile.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/SocialProfile.php
@@ -199,21 +199,47 @@
200200 # Schema changes
201201 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efSocialProfileSchemaUpdates';
202202
203 -function efSocialProfileSchemaUpdates() {
204 - global $wgExtNewTables, $wgDBtype;
 203+function efSocialProfileSchemaUpdates( $updater = null ) {
205204 $dir = dirname( __FILE__ );
206 - if( $wgDBtype == 'mysql' ) {
207 - // Initial install tables
208 - $wgExtNewTables[] = array( 'user_board', "$dir/UserBoard/user_board.sql" );
209 - $wgExtNewTables[] = array( 'user_profile', "$dir/UserProfile/user_profile.sql" );
210 - $wgExtNewTables[] = array( 'user_stats', "$dir/UserStats/user_stats.sql" );
211 - $wgExtNewTables[] = array( 'user_relationship', "$dir/UserRelationship/user_relationship.sql" );
212 - $wgExtNewTables[] = array( 'user_relationship_request', "$dir/UserRelationship/user_relationship.sql" );
213 - $wgExtNewTables[] = array( 'user_system_gift', "$dir/SystemGifts/systemgifts.sql" );
214 - $wgExtNewTables[] = array( 'system_gift', "$dir/SystemGifts/systemgifts.sql" );
215 - $wgExtNewTables[] = array( 'user_gift', "$dir/UserGifts/usergifts.sql" );
216 - $wgExtNewTables[] = array( 'gift', "$dir/UserGifts/usergifts.sql" );
217 - $wgExtNewTables[] = array( 'user_system_messages', "$dir/UserSystemMessages/user_system_messages.sql" );
 205+ if ( $updater === null ) {
 206+ global $wgExtNewTables, $wgDBtype;
 207+ if ( $wgDBtype == 'mysql' ) {
 208+ // Initial install tables
 209+ $wgExtNewTables[] = array( 'user_board', "$dir/UserBoard/user_board.sql" );
 210+ $wgExtNewTables[] = array( 'user_profile', "$dir/UserProfile/user_profile.sql" );
 211+ $wgExtNewTables[] = array( 'user_stats', "$dir/UserStats/user_stats.sql" );
 212+ $wgExtNewTables[] = array( 'user_relationship', "$dir/UserRelationship/user_relationship.sql" );
 213+ $wgExtNewTables[] = array( 'user_relationship_request', "$dir/UserRelationship/user_relationship.sql" );
 214+ $wgExtNewTables[] = array( 'user_system_gift', "$dir/SystemGifts/systemgifts.sql" );
 215+ $wgExtNewTables[] = array( 'system_gift', "$dir/SystemGifts/systemgifts.sql" );
 216+ $wgExtNewTables[] = array( 'user_gift', "$dir/UserGifts/usergifts.sql" );
 217+ $wgExtNewTables[] = array( 'gift', "$dir/UserGifts/usergifts.sql" );
 218+ $wgExtNewTables[] = array( 'user_system_messages', "$dir/UserSystemMessages/user_system_messages.sql" );
 219+ }
 220+ } else {
 221+ if ( $updater->getDB()->getType() == 'mysql' ) {
 222+ // Initial install tables
 223+ $updater->addExtensionUpdate( array( 'addTable', 'user_board',
 224+ "$dir/UserBoard/user_board.sql", true ) );
 225+ $updater->addExtensionUpdate( array( 'addTable', 'user_profile',
 226+ "$dir/UserProfile/user_profile.sql", true ) );
 227+ $updater->addExtensionUpdate( array( 'addTable', 'user_stats',
 228+ "$dir/UserStats/user_stats.sql", true ) );
 229+ $updater->addExtensionUpdate( array( 'addTable', 'user_relationship',
 230+ "$dir/UserRelationship/user_relationship.sql", true ) );
 231+ $updater->addExtensionUpdate( array( 'addTable', 'user_relationship_request',
 232+ "$dir/UserRelationship/user_relationship.sql", true ) );
 233+ $updater->addExtensionUpdate( array( 'addTable', 'user_system_gift',
 234+ "$dir/SystemGifts/systemgifts.sql", true ) );
 235+ $updater->addExtensionUpdate( array( 'addTable', 'system_gift',
 236+ "$dir/SystemGifts/systemgifts.sql", true ) );
 237+ $updater->addExtensionUpdate( array( 'addTable', 'user_gift',
 238+ "$dir/UserGifts/usergifts.sql", true ) );
 239+ $updater->addExtensionUpdate( array( 'addTable', 'gift',
 240+ "$dir/UserGifts/usergifts.sql", true ) );
 241+ $updater->addExtensionUpdate( array( 'addTable', 'user_system_messages',
 242+ "$dir/UserSystemMessages/user_system_messages.sql", true ) );
 243+ }
218244 }
219245 return true;
220246 }

Status & tagging log