Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -2075,53 +2075,61 @@ |
2076 | 2076 | return true; |
2077 | 2077 | } |
2078 | 2078 | |
2079 | | - public static function addSchemaUpdates() { |
2080 | | - global $wgDBtype, $wgExtNewFields, $wgExtPGNewFields, $wgExtNewIndexes, $wgExtNewTables; |
| 2079 | + public static function addSchemaUpdates( DatabaseUpdater $du ) { |
| 2080 | + global $wgDBtype; |
2081 | 2081 | $base = dirname( __FILE__ ); |
2082 | 2082 | if ( $wgDBtype == 'mysql' ) { |
2083 | 2083 | // Initial install tables (current schema) |
2084 | | - $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.sql" ); |
| 2084 | + $du->addExtensionUpdate( array( 'addTable', |
| 2085 | + 'flaggedrevs', "$base/FlaggedRevs.sql" ) ); |
2085 | 2086 | // Updates (in order)... |
2086 | | - $wgExtNewFields[] = array( 'flaggedpage_config', |
2087 | | - 'fpc_expiry', "$base/mysql/patch-fpc_expiry.sql" ); |
2088 | | - $wgExtNewIndexes[] = array( 'flaggedpage_config', |
2089 | | - 'fpc_expiry', "$base/mysql/patch-expiry-index.sql" ); |
2090 | | - $wgExtNewTables[] = array( 'flaggedrevs_promote', |
2091 | | - "$base/mysql/patch-flaggedrevs_promote.sql" ); |
2092 | | - $wgExtNewTables[] = array( 'flaggedpages', "$base/mysql/patch-flaggedpages.sql" ); |
2093 | | - $wgExtNewFields[] = array( 'flaggedrevs', |
2094 | | - 'fr_img_name', "$base/mysql/patch-fr_img_name.sql" ); |
2095 | | - $wgExtNewTables[] = array( 'flaggedrevs_tracking', |
2096 | | - "$base/mysql/patch-flaggedrevs_tracking.sql" ); |
2097 | | - $wgExtNewFields[] = array( 'flaggedpages', 'fp_pending_since', |
2098 | | - "$base/mysql/patch-fp_pending_since.sql" ); |
2099 | | - $wgExtNewFields[] = array( 'flaggedpage_config', 'fpc_level', |
2100 | | - "$base/mysql/patch-fpc_level.sql" ); |
2101 | | - $wgExtNewTables[] = array( 'flaggedpage_pending', |
2102 | | - "$base/mysql/patch-flaggedpage_pending.sql" ); |
2103 | | - $wgExtNewTables[] = array( 'flaggedrevs_stats', |
2104 | | - "$base/mysql/patch-flaggedrevs_stats.sql" ); |
| 2087 | + $du->addExtensionUpdate( array( 'addField', |
| 2088 | + 'flaggedpage_config', 'fpc_expiry', "$base/mysql/patch-fpc_expiry.sql" ) ); |
| 2089 | + $du->addExtensionUpdate( array( 'addIndex', |
| 2090 | + 'flaggedpage_config', 'fpc_expiry', "$base/mysql/patch-expiry-index.sql" ) ); |
| 2091 | + $du->addExtensionUpdate( array( 'addTable', |
| 2092 | + 'flaggedrevs_promote', "$base/mysql/patch-flaggedrevs_promote.sql" ) ); |
| 2093 | + $du->addExtensionUpdate( array( 'addTable', |
| 2094 | + 'flaggedpages', "$base/mysql/patch-flaggedpages.sql" ) ); |
| 2095 | + $du->addExtensionUpdate( array( 'addField', |
| 2096 | + 'flaggedrevs', 'fr_img_name', "$base/mysql/patch-fr_img_name.sql" ) ); |
| 2097 | + $du->addExtensionUpdate( array( 'addTable', |
| 2098 | + 'flaggedrevs_tracking', "$base/mysql/patch-flaggedrevs_tracking.sql" ) ); |
| 2099 | + $du->addExtensionUpdate( array( 'addField', |
| 2100 | + 'flaggedpages', 'fp_pending_since', "$base/mysql/patch-fp_pending_since.sql" ) ); |
| 2101 | + $du->addExtensionUpdate( array( 'addField', |
| 2102 | + 'flaggedpage_config', 'fpc_level', "$base/mysql/patch-fpc_level.sql" ) ); |
| 2103 | + $du->addExtensionUpdate( array( 'addTable', |
| 2104 | + 'flaggedpage_pending', "$base/mysql/patch-flaggedpage_pending.sql" ) ); |
| 2105 | + $du->addExtensionUpdate( array( 'addTable', |
| 2106 | + 'flaggedrevs_stats', "$base/mysql/patch-flaggedrevs_stats.sql" ) ); |
2105 | 2107 | } elseif ( $wgDBtype == 'postgres' ) { |
2106 | 2108 | // Initial install tables (current schema) |
2107 | | - $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.pg.sql" ); |
| 2109 | + $du->addExtensionUpdate( array( 'addTable', |
| 2110 | + 'flaggedrevs', "$base/FlaggedRevs.pg.sql" ) ); |
2108 | 2111 | // Updates (in order)... |
2109 | | - $wgExtPGNewFields[] = array( 'flaggedpage_config', 'fpc_expiry', "TIMESTAMPTZ NULL" ); |
2110 | | - $wgExtNewIndexes[] = array( 'flaggedpage_config', |
2111 | | - 'fpc_expiry', "$base/postgres/patch-expiry-index.sql" ); |
2112 | | - $wgExtNewTables[] = array( 'flaggedrevs_promote', |
2113 | | - "$base/postgres/patch-flaggedrevs_promote.sql" ); |
2114 | | - $wgExtNewTables[] = array( 'flaggedpages', "$base/postgres/patch-flaggedpages.sql" ); |
2115 | | - $wgExtNewIndexes[] = array( 'flaggedrevs', 'fr_img_sha1', |
2116 | | - "$base/postgres/patch-fr_img_name.sql" ); |
2117 | | - $wgExtNewTables[] = array( 'flaggedrevs_tracking', |
2118 | | - "$base/postgres/patch-flaggedrevs_tracking.sql" ); |
2119 | | - $wgExtNewIndexes[] = array( 'flaggedpages', 'fp_pending_since', |
2120 | | - "$base/postgres/patch-fp_pending_since.sql" ); |
2121 | | - $wgExtPGNewFields[] = array( 'flaggedpage_config', 'fpc_level', "TEXT NULL" ); |
2122 | | - $wgExtNewTables[] = array( 'flaggedpage_pending', |
2123 | | - "$base/postgres/patch-flaggedpage_pending.sql" ); |
| 2112 | + $du->addExtensionUpdate( array( 'addField', |
| 2113 | + 'flaggedpage_config', 'fpc_expiry', "TIMESTAMPTZ NULL" ) ); |
| 2114 | + $du->addExtensionUpdate( array( 'addIndex', |
| 2115 | + 'flaggedpage_config', 'fpc_expiry', "$base/postgres/patch-expiry-index.sql" ) ); |
| 2116 | + $du->addExtensionUpdate( array( 'addTable', |
| 2117 | + 'flaggedrevs_promote', "$base/postgres/patch-flaggedrevs_promote.sql" ) ); |
| 2118 | + $du->addExtensionUpdate( array( 'addTable', |
| 2119 | + 'flaggedpages', "$base/postgres/patch-flaggedpages.sql" ) ); |
| 2120 | + $du->addExtensionUpdate( array( 'addIndex', |
| 2121 | + 'flaggedrevs', 'fr_img_sha1', "$base/postgres/patch-fr_img_name.sql" ) ); |
| 2122 | + $du->addExtensionUpdate( array( 'addTable', |
| 2123 | + 'flaggedrevs_tracking', "$base/postgres/patch-flaggedrevs_tracking.sql" ) ); |
| 2124 | + $du->addExtensionUpdate( array( 'addIndex', |
| 2125 | + 'flaggedpages', 'fp_pending_since', "$base/postgres/patch-fp_pending_since.sql" ) ); |
| 2126 | + $du->addExtensionUpdate( array( 'addField', |
| 2127 | + 'flaggedpage_config', 'fpc_level', "TEXT NULL" ) ); |
| 2128 | + $du->addExtensionUpdate( array( 'addTable', |
| 2129 | + 'flaggedpage_pending', "$base/postgres/patch-flaggedpage_pending.sql" ) ); |
| 2130 | + // @TODO: PG stats table??? |
2124 | 2131 | } elseif ( $wgDBtype == 'sqlite' ) { |
2125 | | - $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.sql" ); |
| 2132 | + $du->addExtensionUpdate( array( 'addTable', |
| 2133 | + 'flaggedrevs', "$base/FlaggedRevs.sql" ) ); |
2126 | 2134 | } |
2127 | 2135 | return true; |
2128 | 2136 | } |