r73310 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73309‎ | r73310 | r73311 >
Date:09:25, 19 September 2010
Author:ialex
Status:ok
Tags:
Comment:
Coverted CentralNotice extension to use the new version of the LoadExtensionSchemaUpdates hook
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/CentralNotice.php
@@ -112,16 +112,26 @@
113113 }
114114 }
115115
116 -function efCentralNoticeSchema() {
117 - global $wgDBtype, $wgExtNewTables, $wgExtNewFields;
118 -
 116+function efCentralNoticeSchema( $updater = null ) {
119117 $base = dirname( __FILE__ );
120 - if ( $wgDBtype == 'mysql' ) {
121 - $wgExtNewTables[] = array( 'cn_notices', $base . '/CentralNotice.sql' );
122 - $wgExtNewFields[] = array( 'cn_notices', 'not_preferred', $base . '/patches/patch-notice_preferred.sql' );
123 - $wgExtNewTables[] = array( 'cn_notice_languages', $base . '/patches/patch-notice_languages.sql' );
124 - $wgExtNewFields[] = array( 'cn_templates', 'tmp_display_anon', $base . '/patches/patch-template_settings.sql' );
125 - $wgExtNewTables[] = array( 'cn_notice_countries', $base . '/patches/patch-notice_countries.sql' );
 118+ if ( $updater === null ) {
 119+ global $wgDBtype, $wgExtNewTables, $wgExtNewFields;
 120+
 121+ if ( $wgDBtype == 'mysql' ) {
 122+ $wgExtNewTables[] = array( 'cn_notices', $base . '/CentralNotice.sql' );
 123+ $wgExtNewFields[] = array( 'cn_notices', 'not_preferred', $base . '/patches/patch-notice_preferred.sql' );
 124+ $wgExtNewTables[] = array( 'cn_notice_languages', $base . '/patches/patch-notice_languages.sql' );
 125+ $wgExtNewFields[] = array( 'cn_templates', 'tmp_display_anon', $base . '/patches/patch-template_settings.sql' );
 126+ $wgExtNewTables[] = array( 'cn_notice_countries', $base . '/patches/patch-notice_countries.sql' );
 127+ }
 128+ } else {
 129+ if ( $updater->getDB()->getType() == 'mysql' ) {
 130+ $updater->addExtensionUpdate( array( 'addTable', 'cn_notices', $base . '/CentralNotice.sql' ) );
 131+ $updater->addExtensionUpdate( array( 'addField', 'cn_notices', 'not_preferred', $base . '/patches/patch-notice_preferred.sql' ) );
 132+ $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_languages', $base . '/patches/patch-notice_languages.sql' ) );
 133+ $updater->addExtensionUpdate( array( 'addField', 'cn_templates', 'tmp_display_anon', $base . '/patches/patch-template_settings.sql' ) );
 134+ $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_countries', $base . '/patches/patch-notice_countries.sql' ) );
 135+ }
126136 }
127137 return true;
128138 }

Status & tagging log