Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -519,6 +519,9 @@ |
520 | 520 | |
521 | 521 | # Duplicate flagged* tables in parserTests.php |
522 | 522 | $wgHooks['ParserTestTables'][] = 'FlaggedRevsHooks::onParserTestTables'; |
| 523 | + |
| 524 | +# Database schema changes |
| 525 | +$wgHooks['LoadExtensionSchemaUpdates'][] = 'FlaggedRevsHooks::addSchemaUpdates'; |
523 | 526 | # ######## |
524 | 527 | |
525 | 528 | function efSetFlaggedRevsConditionalHooks() { |
— | — | @@ -603,34 +606,3 @@ |
604 | 607 | # B/C ... |
605 | 608 | $wgLogActions['rights/erevoke'] = 'rights-editor-revoke'; |
606 | 609 | |
607 | | -# Schema changes |
608 | | -$wgHooks['LoadExtensionSchemaUpdates'][] = 'efFlaggedRevsSchemaUpdates'; |
609 | | - |
610 | | -function efFlaggedRevsSchemaUpdates() { |
611 | | - global $wgDBtype, $wgExtNewFields, $wgExtPGNewFields, $wgExtNewIndexes, $wgExtNewTables; |
612 | | - $base = dirname( __FILE__ ); |
613 | | - if ( $wgDBtype == 'mysql' ) { |
614 | | - $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.sql" ); // Initial install tables |
615 | | - $wgExtNewFields[] = array( 'flaggedpage_config', 'fpc_expiry', "$base/archives/patch-fpc_expiry.sql" ); |
616 | | - $wgExtNewIndexes[] = array( 'flaggedpage_config', 'fpc_expiry', "$base/archives/patch-expiry-index.sql" ); |
617 | | - $wgExtNewTables[] = array( 'flaggedrevs_promote', "$base/archives/patch-flaggedrevs_promote.sql" ); |
618 | | - $wgExtNewTables[] = array( 'flaggedpages', "$base/archives/patch-flaggedpages.sql" ); |
619 | | - $wgExtNewFields[] = array( 'flaggedrevs', 'fr_img_name', "$base/archives/patch-fr_img_name.sql" ); |
620 | | - $wgExtNewTables[] = array( 'flaggedrevs_tracking', "$base/archives/patch-flaggedrevs_tracking.sql" ); |
621 | | - $wgExtNewFields[] = array( 'flaggedpages', 'fp_pending_since', "$base/archives/patch-fp_pending_since.sql" ); |
622 | | - $wgExtNewFields[] = array( 'flaggedpage_config', 'fpc_level', "$base/archives/patch-fpc_level.sql" ); |
623 | | - $wgExtNewTables[] = array( 'flaggedpage_pending', "$base/archives/patch-flaggedpage_pending.sql" ); |
624 | | - } elseif ( $wgDBtype == 'postgres' ) { |
625 | | - $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.pg.sql" ); // Initial install tables |
626 | | - $wgExtPGNewFields[] = array( 'flaggedpage_config', 'fpc_expiry', "TIMESTAMPTZ NULL" ); |
627 | | - $wgExtNewIndexes[] = array( 'flaggedpage_config', 'fpc_expiry', "$base/postgres/patch-expiry-index.sql" ); |
628 | | - $wgExtNewTables[] = array( 'flaggedrevs_promote', "$base/postgres/patch-flaggedrevs_promote.sql" ); |
629 | | - $wgExtNewTables[] = array( 'flaggedpages', "$base/postgres/patch-flaggedpages.sql" ); |
630 | | - $wgExtNewIndexes[] = array( 'flaggedrevs', 'fr_img_sha1', "$base/postgres/patch-fr_img_name.sql" ); |
631 | | - $wgExtNewTables[] = array( 'flaggedrevs_tracking', "$base/postgres/patch-flaggedrevs_tracking.sql" ); |
632 | | - $wgExtNewIndexes[] = array( 'flaggedpages', 'fp_pending_since', "$base/postgres/patch-fp_pending_since.sql" ); |
633 | | - $wgExtPGNewFields[] = array( 'flaggedpage_config', 'fpc_level', "TEXT NULL" ); |
634 | | - $wgExtNewTables[] = array( 'flaggedpage_pending', "$base/postgres/patch-flaggedpage_pending.sql" ); |
635 | | - } |
636 | | - return true; |
637 | | -} |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -2212,4 +2212,51 @@ |
2213 | 2213 | $tables[] = 'flaggedrevs_tracking'; |
2214 | 2214 | return true; |
2215 | 2215 | } |
| 2216 | + |
| 2217 | + public static function addSchemaUpdates() { |
| 2218 | + global $wgDBtype, $wgExtNewFields, $wgExtPGNewFields, $wgExtNewIndexes, $wgExtNewTables; |
| 2219 | + $base = dirname( __FILE__ ); |
| 2220 | + if ( $wgDBtype == 'mysql' ) { |
| 2221 | + // Initial install tables (current schema) |
| 2222 | + $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.sql" ); |
| 2223 | + // Updates (in order)... |
| 2224 | + $wgExtNewFields[] = array( 'flaggedpage_config', |
| 2225 | + 'fpc_expiry', "$base/archives/patch-fpc_expiry.sql" ); |
| 2226 | + $wgExtNewIndexes[] = array( 'flaggedpage_config', |
| 2227 | + 'fpc_expiry', "$base/archives/patch-expiry-index.sql" ); |
| 2228 | + $wgExtNewTables[] = array( 'flaggedrevs_promote', |
| 2229 | + "$base/archives/patch-flaggedrevs_promote.sql" ); |
| 2230 | + $wgExtNewTables[] = array( 'flaggedpages', "$base/archives/patch-flaggedpages.sql" ); |
| 2231 | + $wgExtNewFields[] = array( 'flaggedrevs', |
| 2232 | + 'fr_img_name', "$base/archives/patch-fr_img_name.sql" ); |
| 2233 | + $wgExtNewTables[] = array( 'flaggedrevs_tracking', |
| 2234 | + "$base/archives/patch-flaggedrevs_tracking.sql" ); |
| 2235 | + $wgExtNewFields[] = array( 'flaggedpages', 'fp_pending_since', |
| 2236 | + "$base/archives/patch-fp_pending_since.sql" ); |
| 2237 | + $wgExtNewFields[] = array( 'flaggedpage_config', 'fpc_level', |
| 2238 | + "$base/archives/patch-fpc_level.sql" ); |
| 2239 | + $wgExtNewTables[] = array( 'flaggedpage_pending', |
| 2240 | + "$base/archives/patch-flaggedpage_pending.sql" ); |
| 2241 | + } elseif ( $wgDBtype == 'postgres' ) { |
| 2242 | + // Initial install tables (current schema) |
| 2243 | + $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.pg.sql" ); |
| 2244 | + // Updates (in order)... |
| 2245 | + $wgExtPGNewFields[] = array( 'flaggedpage_config', 'fpc_expiry', "TIMESTAMPTZ NULL" ); |
| 2246 | + $wgExtNewIndexes[] = array( 'flaggedpage_config', |
| 2247 | + 'fpc_expiry', "$base/postgres/patch-expiry-index.sql" ); |
| 2248 | + $wgExtNewTables[] = array( 'flaggedrevs_promote', |
| 2249 | + "$base/postgres/patch-flaggedrevs_promote.sql" ); |
| 2250 | + $wgExtNewTables[] = array( 'flaggedpages', "$base/postgres/patch-flaggedpages.sql" ); |
| 2251 | + $wgExtNewIndexes[] = array( 'flaggedrevs', 'fr_img_sha1', |
| 2252 | + "$base/postgres/patch-fr_img_name.sql" ); |
| 2253 | + $wgExtNewTables[] = array( 'flaggedrevs_tracking', |
| 2254 | + "$base/postgres/patch-flaggedrevs_tracking.sql" ); |
| 2255 | + $wgExtNewIndexes[] = array( 'flaggedpages', 'fp_pending_since', |
| 2256 | + "$base/postgres/patch-fp_pending_since.sql" ); |
| 2257 | + $wgExtPGNewFields[] = array( 'flaggedpage_config', 'fpc_level', "TEXT NULL" ); |
| 2258 | + $wgExtNewTables[] = array( 'flaggedpage_pending', |
| 2259 | + "$base/postgres/patch-flaggedpage_pending.sql" ); |
| 2260 | + } |
| 2261 | + return true; |
| 2262 | + } |
2216 | 2263 | } |