r78042 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78041‎ | r78042 | r78043 >
Date:03:41, 8 December 2010
Author:aaron
Status:ok (Comments)
Tags:
Comment:
Converted addSchemaUpdates to new format
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -2075,53 +2075,61 @@
20762076 return true;
20772077 }
20782078
2079 - public static function addSchemaUpdates() {
2080 - global $wgDBtype, $wgExtNewFields, $wgExtPGNewFields, $wgExtNewIndexes, $wgExtNewTables;
 2079+ public static function addSchemaUpdates( DatabaseUpdater $du ) {
 2080+ global $wgDBtype;
20812081 $base = dirname( __FILE__ );
20822082 if ( $wgDBtype == 'mysql' ) {
20832083 // Initial install tables (current schema)
2084 - $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.sql" );
 2084+ $du->addExtensionUpdate( array( 'addTable',
 2085+ 'flaggedrevs', "$base/FlaggedRevs.sql" ) );
20852086 // 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" ) );
21052107 } elseif ( $wgDBtype == 'postgres' ) {
21062108 // Initial install tables (current schema)
2107 - $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.pg.sql" );
 2109+ $du->addExtensionUpdate( array( 'addTable',
 2110+ 'flaggedrevs', "$base/FlaggedRevs.pg.sql" ) );
21082111 // 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???
21242131 } elseif ( $wgDBtype == 'sqlite' ) {
2125 - $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.sql" );
 2132+ $du->addExtensionUpdate( array( 'addTable',
 2133+ 'flaggedrevs', "$base/FlaggedRevs.sql" ) );
21262134 }
21272135 return true;
21282136 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r78226Fix for r78042: add "true" after paths since they are full path and not relat...ialex18:42, 11 December 2010
r80733MFT first round of FlaggedRevs fixes r78517, r78346, r78319, r78293, r78226, ...demon23:56, 21 January 2011

Comments

#Comment by IAlex (talk | contribs)   15:04, 11 December 2010
#Comment by Aaron Schulz (talk | contribs)   18:31, 11 December 2010

Tests and update.php run fine on my box...odd.

#Comment by IAlex (talk | contribs)   18:42, 11 December 2010

Fixed in r78226.

#Comment by Aaron Schulz (talk | contribs)   02:02, 14 December 2010

Actually, it "worked" b/c there was nothing to update (thus no updates attempted)...

Status & tagging log