r81395 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81394‎ | r81395 | r81396 >
Date:15:43, 2 February 2011
Author:ialex
Status:ok
Tags:
Comment:
Converted ReaderFeedback extension to use the new version of the LoadExtensionSchemaUpdates hook
Modified paths:
  • /trunk/extensions/ReaderFeedback/ReaderFeedback.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ReaderFeedback/ReaderFeedback.php
@@ -140,13 +140,23 @@
141141 # Schema changes
142142 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efReaderFeedbackSchemaUpdates';
143143
144 -function efReaderFeedbackSchemaUpdates() {
145 - global $wgDBtype, $wgExtNewTables;
146 - $base = dirname(__FILE__);
147 - if( $wgDBtype == 'mysql' ) {
148 - $wgExtNewTables[] = array( 'reader_feedback', "$base/ReaderFeedback.sql" ); // Initial install tables
149 - } elseif( $wgDBtype == 'postgres' ) {
150 - $wgExtNewTables[] = array( 'reader_feedback', "$base/ReaderFeedback.pg.sql" ); // Initial install tables
 144+function efReaderFeedbackSchemaUpdates( $updater = null ) {
 145+ $base = dirname( __FILE__ );
 146+ if ( $updater === null ) {
 147+ global $wgDBtype, $wgExtNewTables;
 148+ if( $wgDBtype == 'mysql' ) {
 149+ $wgExtNewTables[] = array( 'reader_feedback', "$base/ReaderFeedback.sql" ); // Initial install tables
 150+ } elseif( $wgDBtype == 'postgres' ) {
 151+ $wgExtNewTables[] = array( 'reader_feedback', "$base/ReaderFeedback.pg.sql" ); // Initial install tables
 152+ }
 153+ } else {
 154+ if( $updater->getDB()->getType() == 'mysql' ) {
 155+ $updater->addExtensionUpdate( array( 'addTable', 'reader_feedback',
 156+ "$base/ReaderFeedback.sql", true ) ); // Initial install tables
 157+ } elseif( $updater->getDB()->getType() == 'postgres' ) {
 158+ $updater->addExtensionUpdate( array( 'addTable', 'reader_feedback',
 159+ "$base/ReaderFeedback.pg.sql", true ) ); // Initial install tables
 160+ }
151161 }
152162 return true;
153163 }

Status & tagging log