r76687 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76686‎ | r76687 | r76688 >
Date:17:15, 15 November 2010
Author:ialex
Status:reverted
Tags:
Comment:
Convert FBConnect extension to use the new version of the LoadExtensionSchemaUpdates hook
Modified paths:
  • /trunk/extensions/FBConnect/FBConnectHooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FBConnect/FBConnectHooks.php
@@ -154,13 +154,23 @@
155155 * is set, then the table 'user_fbconnect' will be prefixed accordingly. Make
156156 * sure that fbconnect_table.sql is updated with the database prefix beforehand.
157157 */
158 - static function LoadExtensionSchemaUpdates() {
159 - global $wgDBtype, $wgDBprefix, $wgExtNewTables;
 158+ static function LoadExtensionSchemaUpdates( $updater = null ) {
160159 $base = dirname( __FILE__ );
161 - if ( $wgDBtype == 'mysql' ) {
162 - $wgExtNewTables[] = array( "{$wgDBprefix}user_fbconnect", "$base/fbconnect_table.sql" );
163 - } elseif ( $wgDBtype == 'postgres' ) {
164 - $wgExtNewTables[] = array( "{$wgDBprefix}user_fbconnect", "$base/fbconnect_table.pg.sql" );
 160+ if ( $updater === null ) {
 161+ global $wgDBtype, $wgDBprefix, $wgExtNewTables;
 162+ if ( $wgDBtype == 'mysql' ) {
 163+ $wgExtNewTables[] = array( "{$wgDBprefix}user_fbconnect", "$base/fbconnect_table.sql" );
 164+ } elseif ( $wgDBtype == 'postgres' ) {
 165+ $wgExtNewTables[] = array( "{$wgDBprefix}user_fbconnect", "$base/fbconnect_table.pg.sql" );
 166+ }
 167+ } else {
 168+ if ( $updater->getDB()->getType() == 'mysql' ) {
 169+ $updater->addExtensionUpdate( array( 'addTable', 'user_fbconnect',
 170+ "$base/fbconnect_table.sql", true ) );
 171+ } elseif ( $updater->getDB()->getType() == 'postgres' ) {
 172+ $updater->addExtensionUpdate( array( 'addTable', 'user_fbconnect',
 173+ "$base/fbconnect_table.pg.sql", true ) );
 174+ }
165175 }
166176 return true;
167177 }

Status & tagging log