http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73310
Revision: 73310
Author: ialex
Date: 2010-09-19 09:25:00 +0000 (Sun, 19 Sep 2010)
Log Message:
-----------
Coverted CentralNotice extension to use the new version of the
LoadExtensionSchemaUpdates hook
Modified Paths:
--------------
trunk/extensions/CentralNotice/CentralNotice.php
Modified: trunk/extensions/CentralNotice/CentralNotice.php
===================================================================
--- trunk/extensions/CentralNotice/CentralNotice.php 2010-09-19 09:13:18 UTC
(rev 73309)
+++ trunk/extensions/CentralNotice/CentralNotice.php 2010-09-19 09:25:00 UTC
(rev 73310)
@@ -112,16 +112,26 @@
}
}
-function efCentralNoticeSchema() {
- global $wgDBtype, $wgExtNewTables, $wgExtNewFields;
-
+function efCentralNoticeSchema( $updater = null ) {
$base = dirname( __FILE__ );
- if ( $wgDBtype == 'mysql' ) {
- $wgExtNewTables[] = array( 'cn_notices', $base .
'/CentralNotice.sql' );
- $wgExtNewFields[] = array( 'cn_notices', 'not_preferred', $base
. '/patches/patch-notice_preferred.sql' );
- $wgExtNewTables[] = array( 'cn_notice_languages', $base .
'/patches/patch-notice_languages.sql' );
- $wgExtNewFields[] = array( 'cn_templates', 'tmp_display_anon',
$base . '/patches/patch-template_settings.sql' );
- $wgExtNewTables[] = array( 'cn_notice_countries', $base .
'/patches/patch-notice_countries.sql' );
+ if ( $updater === null ) {
+ global $wgDBtype, $wgExtNewTables, $wgExtNewFields;
+
+ if ( $wgDBtype == 'mysql' ) {
+ $wgExtNewTables[] = array( 'cn_notices', $base .
'/CentralNotice.sql' );
+ $wgExtNewFields[] = array( 'cn_notices',
'not_preferred', $base . '/patches/patch-notice_preferred.sql' );
+ $wgExtNewTables[] = array( 'cn_notice_languages', $base
. '/patches/patch-notice_languages.sql' );
+ $wgExtNewFields[] = array( 'cn_templates',
'tmp_display_anon', $base . '/patches/patch-template_settings.sql' );
+ $wgExtNewTables[] = array( 'cn_notice_countries', $base
. '/patches/patch-notice_countries.sql' );
+ }
+ } else {
+ if ( $updater->getDB()->getType() == 'mysql' ) {
+ $updater->addExtensionUpdate( array( 'addTable',
'cn_notices', $base . '/CentralNotice.sql' ) );
+ $updater->addExtensionUpdate( array( 'addField',
'cn_notices', 'not_preferred', $base . '/patches/patch-notice_preferred.sql' )
);
+ $updater->addExtensionUpdate( array( 'addTable',
'cn_notice_languages', $base . '/patches/patch-notice_languages.sql' ) );
+ $updater->addExtensionUpdate( array( 'addField',
'cn_templates', 'tmp_display_anon', $base .
'/patches/patch-template_settings.sql' ) );
+ $updater->addExtensionUpdate( array( 'addTable',
'cn_notice_countries', $base . '/patches/patch-notice_countries.sql' ) );
+ }
}
return true;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs