r95254 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95253‎ | r95254 | r95255 >
Date:21:12, 22 August 2011
Author:khorn
Status:ok
Tags:
Comment:
r94809: This will now use the updater object for schema changes only if the extension's database matches the updater's database. Otherwise, we do the schema changes outside the updater. (Constructing a new updater from a main updater causes Problems)
Also related to r94771, r94720
Modified paths:
  • /trunk/extensions/ContributionTracking/ContributionTracking.php (modified) (history)
  • /trunk/extensions/ContributionTracking/patch-owa.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/ContributionTracking/patch-owa.sql
@@ -1,5 +1,5 @@
22 --
33 -- create contribution_tracking.owa_session and owa_ref
44 --
5 -ALTER TABLE /*_*/contribution_tracking ADD owa_session varbinary(255 default NULL);
 5+ALTER TABLE /*_*/contribution_tracking ADD owa_session varbinary(255) default NULL;
66 ALTER TABLE /*_*/contribution_tracking ADD owa_ref int(11) default NULL;
Index: trunk/extensions/ContributionTracking/ContributionTracking.php
@@ -107,10 +107,28 @@
108108 $dir . 'patch-owa.sql',
109109 );
110110 } else {
111 - $updater->addExtensionTable( 'contribution_tracking', $dir . 'ContributionTracking.sql' );
112 - $updater->addExtensionTable( 'contribution_tracking_owa_ref', $dir . 'ContributionTracking_OWA_ref.sql' );
113 - $updater->addExtensionUpdate( array( 'addField', 'contribution_tracking', 'owa_session',
114 - $dir . 'patch-owa.sql', true ) );
 111+ global $wgContributionTrackingDBname;
 112+
 113+ if($updater->getDB()->getDBName() === $wgContributionTrackingDBname) {
 114+ $updater->addExtensionTable( 'contribution_tracking', $dir . 'ContributionTracking.sql' );
 115+ $updater->addExtensionTable( 'contribution_tracking_owa_ref', $dir . 'ContributionTracking_OWA_ref.sql' );
 116+ $updater->addExtensionUpdate( array( 'addField', 'contribution_tracking', 'owa_session',
 117+ $dir . 'patch-owa.sql', true ) );
 118+ } else { //We are configured not to use the main mediawiki db.
 119+ //Unless the updater is modified not to run
 120+ //'LoadExtensionSchemaUpdates' hooks in its constructor (or do so
 121+ //conditionally), we're going to have to do these manually.
 122+ $ctDB = ContributionTrackingProcessor::contributionTrackingConnection();
 123+ if (!$ctDB->tableExists('contribution_tracking')){
 124+ $ctDB->sourceFile($dir . 'ContributionTracking.sql');
 125+ }
 126+ if (!$ctDB->tableExists('contribution_tracking_owa_ref')){
 127+ $ctDB->sourceFile($dir . 'ContributionTracking_OWA_ref.sql');
 128+ }
 129+ if (!$ctDB->fieldExists('contribution_tracking', 'owa_session')){
 130+ $ctDB->sourceFile($dir . 'patch-owa.sql');
 131+ }
 132+ }
115133 }
116134 return true;
117135

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r94720In the process of adding an API to ContributionTracking, I ended up refactori...khorn00:58, 17 August 2011
r94771Switch ContributionTracking to use newer updaterreedy16:33, 17 August 2011
r94809r94720 r94771...khorn20:09, 17 August 2011

Status & tagging log