Index: trunk/extensions/ConfirmAccount/ConfirmAccount.php |
— | — | @@ -252,34 +252,64 @@ |
253 | 253 | # Status header like "new messages" bar |
254 | 254 | $wgHooks['SiteNoticeAfter'][] = 'efConfirmAccountsNotice'; |
255 | 255 | |
256 | | -function efConfirmAccountSchemaUpdates() { |
257 | | - global $wgDBtype, $wgExtNewFields, $wgExtPGNewFields, $wgExtNewTables, $wgExtNewIndexes; |
| 256 | +function efConfirmAccountSchemaUpdates( $updater = null ) { |
258 | 257 | $base = dirname( __FILE__ ); |
259 | | - if ( $wgDBtype == 'mysql' ) { |
260 | | - $wgExtNewTables[] = array( 'account_requests', "$base/ConfirmAccount.sql" ); |
| 258 | + if ( $updater === null ) { |
| 259 | + global $wgDBtype, $wgExtNewFields, $wgExtPGNewFields, $wgExtNewTables, $wgExtNewIndexes; |
261 | 260 | |
262 | | - $wgExtNewFields[] = array( 'account_requests', 'acr_filename', |
263 | | - "$base/archives/patch-acr_filename.sql" ); |
| 261 | + if ( $wgDBtype == 'mysql' ) { |
| 262 | + $wgExtNewTables[] = array( 'account_requests', "$base/ConfirmAccount.sql" ); |
264 | 263 | |
265 | | - $wgExtNewTables[] = array( 'account_credentials', "$base/archives/patch-account_credentials.sql" ); |
| 264 | + $wgExtNewFields[] = array( 'account_requests', 'acr_filename', |
| 265 | + "$base/archives/patch-acr_filename.sql" ); |
266 | 266 | |
267 | | - $wgExtNewFields[] = array( 'account_requests', 'acr_areas', "$base/archives/patch-acr_areas.sql" ); |
| 267 | + $wgExtNewTables[] = array( 'account_credentials', "$base/archives/patch-account_credentials.sql" ); |
268 | 268 | |
269 | | - $wgExtNewIndexes[] = array( 'account_requests', 'acr_email', "$base/archives/patch-email-index.sql" ); |
270 | | - } else if ( $wgDBtype == 'postgres' ) { |
271 | | - $wgExtNewTables[] = array( 'account_requests', "$base/ConfirmAccount.pg.sql" ); |
| 269 | + $wgExtNewFields[] = array( 'account_requests', 'acr_areas', "$base/archives/patch-acr_areas.sql" ); |
272 | 270 | |
273 | | - $wgExtPGNewFields[] = array( 'account_requests', 'acr_held', "TIMESTAMPTZ" ); |
274 | | - $wgExtPGNewFields[] = array( 'account_requests', 'acr_filename', "TEXT" ); |
275 | | - $wgExtPGNewFields[] = array( 'account_requests', 'acr_storage_key', "TEXT" ); |
276 | | - $wgExtPGNewFields[] = array( 'account_requests', 'acr_comment', "TEXT NOT NULL DEFAULT ''" ); |
| 271 | + $wgExtNewIndexes[] = array( 'account_requests', 'acr_email', "$base/archives/patch-email-index.sql" ); |
| 272 | + } else if ( $wgDBtype == 'postgres' ) { |
| 273 | + $wgExtNewTables[] = array( 'account_requests', "$base/ConfirmAccount.pg.sql" ); |
277 | 274 | |
278 | | - $wgExtPGNewFields[] = array( 'account_requests', 'acr_type', "INTEGER NOT NULL DEFAULT 0" ); |
279 | | - $wgExtNewTables[] = array( 'account_credentials', "$base/postgres/patch-account_credentials.sql" ); |
280 | | - $wgExtPGNewFields[] = array( 'account_requests', 'acr_areas', "TEXT" ); |
281 | | - $wgExtPGNewFields[] = array( 'account_credentials', 'acd_areas', "TEXT" ); |
| 275 | + $wgExtPGNewFields[] = array( 'account_requests', 'acr_held', "TIMESTAMPTZ" ); |
| 276 | + $wgExtPGNewFields[] = array( 'account_requests', 'acr_filename', "TEXT" ); |
| 277 | + $wgExtPGNewFields[] = array( 'account_requests', 'acr_storage_key', "TEXT" ); |
| 278 | + $wgExtPGNewFields[] = array( 'account_requests', 'acr_comment', "TEXT NOT NULL DEFAULT ''" ); |
282 | 279 | |
283 | | - $wgExtNewIndexes[] = array( 'account_requests', 'acr_email', "$base/postgres/patch-email-index.sql" ); |
| 280 | + $wgExtPGNewFields[] = array( 'account_requests', 'acr_type', "INTEGER NOT NULL DEFAULT 0" ); |
| 281 | + $wgExtNewTables[] = array( 'account_credentials', "$base/postgres/patch-account_credentials.sql" ); |
| 282 | + $wgExtPGNewFields[] = array( 'account_requests', 'acr_areas', "TEXT" ); |
| 283 | + $wgExtPGNewFields[] = array( 'account_credentials', 'acd_areas', "TEXT" ); |
| 284 | + |
| 285 | + $wgExtNewIndexes[] = array( 'account_requests', 'acr_email', "$base/postgres/patch-email-index.sql" ); |
| 286 | + } |
| 287 | + } else { |
| 288 | + if ( $updater->getDB()->getType() == 'mysql' ) { |
| 289 | + $updater->addExtensionUpdate( array( 'addTable', 'account_requests', "$base/ConfirmAccount.sql", true ) ); |
| 290 | + |
| 291 | + $updater->addExtensionUpdate( array( 'addField', 'account_requests', 'acr_filename', |
| 292 | + "$base/archives/patch-acr_filename.sql", true ) ); |
| 293 | + |
| 294 | + $updater->addExtensionUpdate( array( 'addTable', 'account_credentials', "$base/archives/patch-account_credentials.sql", true ) ); |
| 295 | + |
| 296 | + $updater->addExtensionUpdate( array( 'addField', 'account_requests', 'acr_areas', "$base/archives/patch-acr_areas.sql", true ) ); |
| 297 | + |
| 298 | + $updater->addExtensionUpdate( array( 'addIndex', 'account_requests', 'acr_email', "$base/archives/patch-email-index.sql", true ) ); |
| 299 | + } else if ( $updater->getDB()->getType() == 'postgres' ) { |
| 300 | + $updater->addExtensionUpdate( array( 'addTable', 'account_requests', "$base/ConfirmAccount.pg.sql", true ); |
| 301 | + |
| 302 | + $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_held', "TIMESTAMPTZ" ) ); |
| 303 | + $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_filename', "TEXT" ) ); |
| 304 | + $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_storage_key', "TEXT" ) ); |
| 305 | + $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_comment', "TEXT NOT NULL DEFAULT ''" ) ); |
| 306 | + |
| 307 | + $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_type', "INTEGER NOT NULL DEFAULT 0" ) ); |
| 308 | + $updater->addExtensionUpdate( array( 'addTable', 'account_credentials', "$base/postgres/patch-account_credentials.sql", true ) ); |
| 309 | + $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_areas', "TEXT" ) ); |
| 310 | + $updater->addExtensionUpdate( array( 'addPgField', 'account_credentials', 'acd_areas', "TEXT" ) ); |
| 311 | + |
| 312 | + $updater->addExtensionUpdate( array( 'addIndex', 'account_requests', 'acr_email', "$base/postgres/patch-email-index.sql", true ) ); |
| 313 | + } |
284 | 314 | } |
285 | 315 | return true; |
286 | 316 | } |