Index: trunk/extensions/ContributionTracking/patch-owa.sql |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | -- |
3 | 3 | -- create contribution_tracking.owa_session and owa_ref |
4 | 4 | -- |
5 | | -ALTER TABLE /*_*/contribution_tracking ADD owa_session varbinary(255 default NULL); |
| 5 | +ALTER TABLE /*_*/contribution_tracking ADD owa_session varbinary(255) default NULL; |
6 | 6 | ALTER TABLE /*_*/contribution_tracking ADD owa_ref int(11) default NULL; |
Index: trunk/extensions/ContributionTracking/ContributionTracking.php |
— | — | @@ -107,10 +107,28 @@ |
108 | 108 | $dir . 'patch-owa.sql', |
109 | 109 | ); |
110 | 110 | } 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 | + } |
115 | 133 | } |
116 | 134 | return true; |
117 | 135 | |