http://www.mediawiki.org/wiki/Special:Code/MediaWiki/76216
Revision: 76216
Author: ialex
Date: 2010-11-06 20:25:18 +0000 (Sat, 06 Nov 2010)
Log Message:
-----------
Converted CreateAccount extension to use the new version of the
LoadExtensionSchemaUpdates hook
Modified Paths:
--------------
trunk/extensions/ConfirmAccount/ConfirmAccount.php
Modified: trunk/extensions/ConfirmAccount/ConfirmAccount.php
===================================================================
--- trunk/extensions/ConfirmAccount/ConfirmAccount.php 2010-11-06 20:19:22 UTC
(rev 76215)
+++ trunk/extensions/ConfirmAccount/ConfirmAccount.php 2010-11-06 20:25:18 UTC
(rev 76216)
@@ -252,34 +252,64 @@
# Status header like "new messages" bar
$wgHooks['SiteNoticeAfter'][] = 'efConfirmAccountsNotice';
-function efConfirmAccountSchemaUpdates() {
- global $wgDBtype, $wgExtNewFields, $wgExtPGNewFields, $wgExtNewTables,
$wgExtNewIndexes;
+function efConfirmAccountSchemaUpdates( $updater = null ) {
$base = dirname( __FILE__ );
- if ( $wgDBtype == 'mysql' ) {
- $wgExtNewTables[] = array( 'account_requests',
"$base/ConfirmAccount.sql" );
+ if ( $updater === null ) {
+ global $wgDBtype, $wgExtNewFields, $wgExtPGNewFields,
$wgExtNewTables, $wgExtNewIndexes;
- $wgExtNewFields[] = array( 'account_requests', 'acr_filename',
- "$base/archives/patch-acr_filename.sql" );
+ if ( $wgDBtype == 'mysql' ) {
+ $wgExtNewTables[] = array( 'account_requests',
"$base/ConfirmAccount.sql" );
- $wgExtNewTables[] = array( 'account_credentials',
"$base/archives/patch-account_credentials.sql" );
+ $wgExtNewFields[] = array( 'account_requests',
'acr_filename',
+ "$base/archives/patch-acr_filename.sql" );
- $wgExtNewFields[] = array( 'account_requests', 'acr_areas',
"$base/archives/patch-acr_areas.sql" );
+ $wgExtNewTables[] = array( 'account_credentials',
"$base/archives/patch-account_credentials.sql" );
- $wgExtNewIndexes[] = array( 'account_requests', 'acr_email',
"$base/archives/patch-email-index.sql" );
- } else if ( $wgDBtype == 'postgres' ) {
- $wgExtNewTables[] = array( 'account_requests',
"$base/ConfirmAccount.pg.sql" );
+ $wgExtNewFields[] = array( 'account_requests',
'acr_areas', "$base/archives/patch-acr_areas.sql" );
- $wgExtPGNewFields[] = array( 'account_requests', 'acr_held',
"TIMESTAMPTZ" );
- $wgExtPGNewFields[] = array( 'account_requests',
'acr_filename', "TEXT" );
- $wgExtPGNewFields[] = array( 'account_requests',
'acr_storage_key', "TEXT" );
- $wgExtPGNewFields[] = array( 'account_requests', 'acr_comment',
"TEXT NOT NULL DEFAULT ''" );
+ $wgExtNewIndexes[] = array( 'account_requests',
'acr_email', "$base/archives/patch-email-index.sql" );
+ } else if ( $wgDBtype == 'postgres' ) {
+ $wgExtNewTables[] = array( 'account_requests',
"$base/ConfirmAccount.pg.sql" );
- $wgExtPGNewFields[] = array( 'account_requests', 'acr_type',
"INTEGER NOT NULL DEFAULT 0" );
- $wgExtNewTables[] = array( 'account_credentials',
"$base/postgres/patch-account_credentials.sql" );
- $wgExtPGNewFields[] = array( 'account_requests', 'acr_areas',
"TEXT" );
- $wgExtPGNewFields[] = array( 'account_credentials',
'acd_areas', "TEXT" );
+ $wgExtPGNewFields[] = array( 'account_requests',
'acr_held', "TIMESTAMPTZ" );
+ $wgExtPGNewFields[] = array( 'account_requests',
'acr_filename', "TEXT" );
+ $wgExtPGNewFields[] = array( 'account_requests',
'acr_storage_key', "TEXT" );
+ $wgExtPGNewFields[] = array( 'account_requests',
'acr_comment', "TEXT NOT NULL DEFAULT ''" );
- $wgExtNewIndexes[] = array( 'account_requests', 'acr_email',
"$base/postgres/patch-email-index.sql" );
+ $wgExtPGNewFields[] = array( 'account_requests',
'acr_type', "INTEGER NOT NULL DEFAULT 0" );
+ $wgExtNewTables[] = array( 'account_credentials',
"$base/postgres/patch-account_credentials.sql" );
+ $wgExtPGNewFields[] = array( 'account_requests',
'acr_areas', "TEXT" );
+ $wgExtPGNewFields[] = array( 'account_credentials',
'acd_areas', "TEXT" );
+
+ $wgExtNewIndexes[] = array( 'account_requests',
'acr_email', "$base/postgres/patch-email-index.sql" );
+ }
+ } else {
+ if ( $updater->getDB()->getType() == 'mysql' ) {
+ $updater->addExtensionUpdate( array( 'addTable',
'account_requests', "$base/ConfirmAccount.sql", true ) );
+
+ $updater->addExtensionUpdate( array( 'addField',
'account_requests', 'acr_filename',
+ "$base/archives/patch-acr_filename.sql", true )
);
+
+ $updater->addExtensionUpdate( array( 'addTable',
'account_credentials', "$base/archives/patch-account_credentials.sql", true ) );
+
+ $updater->addExtensionUpdate( array( 'addField',
'account_requests', 'acr_areas', "$base/archives/patch-acr_areas.sql", true ) );
+
+ $updater->addExtensionUpdate( array( 'addIndex',
'account_requests', 'acr_email', "$base/archives/patch-email-index.sql", true )
);
+ } else if ( $updater->getDB()->getType() == 'postgres' ) {
+ $updater->addExtensionUpdate( array( 'addTable',
'account_requests', "$base/ConfirmAccount.pg.sql", true );
+
+ $updater->addExtensionUpdate( array( 'addPgField',
'account_requests', 'acr_held', "TIMESTAMPTZ" ) );
+ $updater->addExtensionUpdate( array( 'addPgField',
'account_requests', 'acr_filename', "TEXT" ) );
+ $updater->addExtensionUpdate( array( 'addPgField',
'account_requests', 'acr_storage_key', "TEXT" ) );
+ $updater->addExtensionUpdate( array( 'addPgField',
'account_requests', 'acr_comment', "TEXT NOT NULL DEFAULT ''" ) );
+
+ $updater->addExtensionUpdate( array( 'addPgField',
'account_requests', 'acr_type', "INTEGER NOT NULL DEFAULT 0" ) );
+ $updater->addExtensionUpdate( array( 'addTable',
'account_credentials', "$base/postgres/patch-account_credentials.sql", true ) );
+ $updater->addExtensionUpdate( array( 'addPgField',
'account_requests', 'acr_areas', "TEXT" ) );
+ $updater->addExtensionUpdate( array( 'addPgField',
'account_credentials', 'acd_areas', "TEXT" ) );
+
+ $updater->addExtensionUpdate( array( 'addIndex',
'account_requests', 'acr_email', "$base/postgres/patch-email-index.sql", true )
);
+ }
}
return true;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs