r72871 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72870‎ | r72871 | r72872 >
Date:16:28, 12 September 2010
Author:ialex
Status:ok (Comments)
Tags:
Comment:
Follow-up r72870: converted CodeReview's LoadExtensionSchemaUpdates hook to new DatabaseUpdater (specifically for the update_row_exists() method)
Modified paths:
  • /trunk/extensions/CodeReview/CodeReview.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeReview.php
@@ -165,25 +165,28 @@
166166 # Schema changes
167167 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efCodeReviewSchemaUpdates';
168168
169 -function efCodeReviewSchemaUpdates() {
170 - global $wgDBtype, $wgExtNewFields, /*$wgExtPGNewFields,*/ $wgExtNewIndexes, $wgExtNewTables, $wgExtModifiedFields;
 169+function efCodeReviewSchemaUpdates( $updater ) {
171170 $base = dirname( __FILE__ );
172 - if ( $wgDBtype == 'mysql' ) {
173 - $wgExtNewTables[] = array( 'code_rev', "$base/codereview.sql" ); // Initial install tables
174 - $wgExtNewFields[] = array( 'code_rev', 'cr_diff', "$base/archives/codereview-cr_diff.sql" );
175 - $wgExtNewIndexes[] = array( 'code_relations', 'repo_to_from', "$base/archives/code_relations_index.sql" );
 171+ switch ( $updater->getDB()->getType() ) {
 172+ case 'mysql':
 173+ $updater->addExtensionUpdate( array( 'addTable', 'code_rev', "$base/codereview.sql", true ) ); // Initial install tables
 174+ $updater->addExtensionUpdate( array( 'addField', 'code_rev', 'cr_diff', "$base/archives/codereview-cr_diff.sql", true ) );
 175+ $updater->addExtensionUpdate( array( 'addIndex', 'code_relations', 'repo_to_from', "$base/archives/code_relations_index.sql", true ) );
176176
177 - // $wgExtNewFields[] = array( 'code_rev', "$base/archives/codereview-cr_status.sql" ); // FIXME FIXME this is a change to options... don't know how
 177+ // $updater->addExtensionUpdate( array( 'addField', 'code_rev', 'cr_status', "$base/archives/codereview-cr_status.sql", true ) ); // FIXME FIXME this is a change to options... don't know how
178178
179 - if ( !update_row_exists( 'add old to code_rev enum' ) ) {
180 - $wgExtModifiedFields[] = array( 'code_rev', 'cr_status', "$base/archives/codereview-cr_old_status.sql" );
 179+ if ( !$updater->updateRowExists( 'add old to code_rev enum' ) ) {
 180+ $updater->addExtensionUpdate( array( 'modifyField', 'code_rev', 'cr_status', "$base/archives/codereview-cr_old_status.sql", true ) );
181181 }
182182
183 - $wgExtNewTables[] = array( 'code_bugs', "$base/archives/code_bugs.sql" );
184 - } elseif ( $wgDBtype == 'sqlite' ) {
185 - $wgExtNewTables[] = array( 'code_rev', "$base/codereview.sql" );
186 - } elseif ( $wgDBtype == 'postgres' ) {
 183+ $updater->addExtensionUpdate( array( 'addTable', 'code_bugs', "$base/archives/code_bugs.sql", true ) );
 184+ break;
 185+ case 'sqlite':
 186+ $updater->addExtensionUpdate( array( 'addTable', 'code_rev', "$base/codereview.sql", true ) );
 187+ break;
 188+ case 'postgres':
187189 // TODO
 190+ break;
188191 }
189192 return true;
190193 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r72870GOOD BYE, dear old updaters.inc!...ialex16:24, 12 September 2010

Comments

#Comment by Aaron Schulz (talk | contribs)   18:40, 12 September 2010

Are you doing the other extensions?

#Comment by IAlex (talk | contribs)   18:55, 12 September 2010

I will update them slowly if nobody does that before.

Status & tagging log