http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72798
Revision: 72798
Author: ialex
Date: 2010-09-11 10:39:08 +0000 (Sat, 11 Sep 2010)
Log Message:
-----------
Converted OpenID's LoadExtensionSchemaUpdates hook to use the DatabaseUpdater
instance (b/c kept)
Modified Paths:
--------------
trunk/extensions/OpenID/OpenID.hooks.php
Modified: trunk/extensions/OpenID/OpenID.hooks.php
===================================================================
--- trunk/extensions/OpenID/OpenID.hooks.php 2010-09-11 10:20:26 UTC (rev
72797)
+++ trunk/extensions/OpenID/OpenID.hooks.php 2010-09-11 10:39:08 UTC (rev
72798)
@@ -278,26 +278,35 @@
return true;
}
- public static function onLoadExtensionSchemaUpdates() {
- global $wgDBtype, $wgUpdates, $wgExtNewTables;
-
+ public static function onLoadExtensionSchemaUpdates( $updater = null ) {
$base = dirname( __FILE__ );
-
- if ( $wgDBtype == 'mysql' ) {
- $wgExtNewTables[] = array( 'user_openid',
"$base/openid_table.sql" );
- $wgUpdates['mysql'][] = array( array( __CLASS__,
'makeUoiUserNotUnique' ) );
- } else if ( $wgDBtype == 'postgres' ) {
- $wgExtNewTables[] = array( 'user_openid',
"$base/openid_table.pg.sql" );
- # This doesn't work since MediaWiki doesn't use
$wgUpdates when
- # updating a PostgreSQL database
- #$wgUpdates['postgres'][] = array( array( __CLASS__,
'makeUoiUserNotUnique' ) );
+ if ( $updater === null ) { // < 1.17
+ global $wgDBtype, $wgUpdates, $wgExtNewTables;
+ if ( $wgDBtype == 'mysql' ) {
+ $wgExtNewTables[] = array( 'user_openid',
"$base/openid_table.sql" );
+ $wgUpdates['mysql'][] = array( array(
__CLASS__, 'makeUoiUserNotUnique' ) );
+ } else if ( $wgDBtype == 'postgres' ) {
+ $wgExtNewTables[] = array( 'user_openid',
"$base/openid_table.pg.sql" );
+ # This doesn't work since MediaWiki doesn't use
$wgUpdates when
+ # updating a PostgreSQL database
+ #$wgUpdates['postgres'][] = array( array(
__CLASS__, 'makeUoiUserNotUnique' ) );
+ }
+ } else {
+ $dbPatch = "$base/" . ( $updater->getDB()->getType() ==
'postgres' ?
+ 'openid_table.pg.sql' : 'openid_table.sql' );
+ $updater->addExtensionUpdate( array( 'addTable',
'user_openid', $dbPatch ) );
+ $updater->addExtensionUpdate( array( array( __CLASS__,
'makeUoiUserNotUnique' ) ) );
}
return true;
}
- public static function makeUoiUserNotUnique() {
- $db = wfGetDB( DB_MASTER );
+ public static function makeUoiUserNotUnique( $updater = null ) {
+ if ( $updater === null ) {
+ $db = wfGetDB( DB_MASTER );
+ } else {
+ $db = $updater->getDB();
+ }
if ( !$db->tableExists( 'user_openid' ) )
return;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs