r72798 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72797‎ | r72798 | r72799 >
Date:10:39, 11 September 2010
Author:ialex
Status:ok
Tags:
Comment:
Converted OpenID's LoadExtensionSchemaUpdates hook to use the DatabaseUpdater instance (b/c kept)
Modified paths:
  • /trunk/extensions/OpenID/OpenID.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenID/OpenID.hooks.php
@@ -278,26 +278,35 @@
279279 return true;
280280 }
281281
282 - public static function onLoadExtensionSchemaUpdates() {
283 - global $wgDBtype, $wgUpdates, $wgExtNewTables;
284 -
 282+ public static function onLoadExtensionSchemaUpdates( $updater = null ) {
285283 $base = dirname( __FILE__ );
286 -
287 - if ( $wgDBtype == 'mysql' ) {
288 - $wgExtNewTables[] = array( 'user_openid', "$base/openid_table.sql" );
289 - $wgUpdates['mysql'][] = array( array( __CLASS__, 'makeUoiUserNotUnique' ) );
290 - } else if ( $wgDBtype == 'postgres' ) {
291 - $wgExtNewTables[] = array( 'user_openid', "$base/openid_table.pg.sql" );
292 - # This doesn't work since MediaWiki doesn't use $wgUpdates when
293 - # updating a PostgreSQL database
294 - #$wgUpdates['postgres'][] = array( array( __CLASS__, 'makeUoiUserNotUnique' ) );
 284+ if ( $updater === null ) { // < 1.17
 285+ global $wgDBtype, $wgUpdates, $wgExtNewTables;
 286+ if ( $wgDBtype == 'mysql' ) {
 287+ $wgExtNewTables[] = array( 'user_openid', "$base/openid_table.sql" );
 288+ $wgUpdates['mysql'][] = array( array( __CLASS__, 'makeUoiUserNotUnique' ) );
 289+ } else if ( $wgDBtype == 'postgres' ) {
 290+ $wgExtNewTables[] = array( 'user_openid', "$base/openid_table.pg.sql" );
 291+ # This doesn't work since MediaWiki doesn't use $wgUpdates when
 292+ # updating a PostgreSQL database
 293+ #$wgUpdates['postgres'][] = array( array( __CLASS__, 'makeUoiUserNotUnique' ) );
 294+ }
 295+ } else {
 296+ $dbPatch = "$base/" . ( $updater->getDB()->getType() == 'postgres' ?
 297+ 'openid_table.pg.sql' : 'openid_table.sql' );
 298+ $updater->addExtensionUpdate( array( 'addTable', 'user_openid', $dbPatch ) );
 299+ $updater->addExtensionUpdate( array( array( __CLASS__, 'makeUoiUserNotUnique' ) ) );
295300 }
296301
297302 return true;
298303 }
299304
300 - public static function makeUoiUserNotUnique() {
301 - $db = wfGetDB( DB_MASTER );
 305+ public static function makeUoiUserNotUnique( $updater = null ) {
 306+ if ( $updater === null ) {
 307+ $db = wfGetDB( DB_MASTER );
 308+ } else {
 309+ $db = $updater->getDB();
 310+ }
302311 if ( !$db->tableExists( 'user_openid' ) )
303312 return;
304313

Follow-up revisions

RevisionCommit summaryAuthorDate
r72817Fix for r72798: forgot that it was already a full path :)ialex15:50, 11 September 2010
r72872Let's just kill $wgUpdates since OpenID was converted in r72798....ialex16:48, 12 September 2010

Status & tagging log