Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -165,50 +165,6 @@ |
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | | -function do_logging_timestamp_index() { |
170 | | - global $wgDatabase; |
171 | | - if ( $wgDatabase->indexExists( 'logging', 'times' ) ) { |
172 | | - wfOut( "...timestamp key on logging already exists.\n" ); |
173 | | - } else { |
174 | | - wfOut( "Adding timestamp key on logging table... " ); |
175 | | - $wgDatabase->sourceFile( archive( "patch-logging-times-index.sql" ) ); |
176 | | - wfOut( "ok\n" ); |
177 | | - } |
178 | | -} |
179 | | - |
180 | | -function do_archive_user_index() { |
181 | | - global $wgDatabase; |
182 | | - if ( $wgDatabase->indexExists( 'archive', 'usertext_timestamp' ) ) { |
183 | | - wfOut( "...usertext,timestamp key on archive already exists.\n" ); |
184 | | - } else { |
185 | | - wfOut( "Adding usertext,timestamp key on archive table... " ); |
186 | | - $wgDatabase->sourceFile( archive( "patch-archive-user-index.sql" ) ); |
187 | | - wfOut( "ok\n" ); |
188 | | - } |
189 | | -} |
190 | | - |
191 | | -function do_image_user_index() { |
192 | | - global $wgDatabase; |
193 | | - if ( $wgDatabase->indexExists( 'image', 'img_usertext_timestamp' ) ) { |
194 | | - wfOut( "...usertext,timestamp key on image already exists.\n" ); |
195 | | - } else { |
196 | | - wfOut( "Adding usertext,timestamp key on image table... " ); |
197 | | - $wgDatabase->sourceFile( archive( "patch-image-user-index.sql" ) ); |
198 | | - wfOut( "ok\n" ); |
199 | | - } |
200 | | -} |
201 | | - |
202 | | -function do_oldimage_user_index() { |
203 | | - global $wgDatabase; |
204 | | - if ( $wgDatabase->indexExists( 'oldimage', 'oi_usertext_timestamp' ) ) { |
205 | | - wfOut( "...usertext,timestamp key on oldimage already exists.\n" ); |
206 | | - } else { |
207 | | - wfOut( "Adding usertext,timestamp key on oldimage table... " ); |
208 | | - $wgDatabase->sourceFile( archive( "patch-oldimage-user-index.sql" ) ); |
209 | | - wfOut( "ok\n" ); |
210 | | - } |
211 | | -} |
212 | | - |
213 | 169 | function do_watchlist_update() { |
214 | 170 | global $wgDatabase; |
215 | 171 | $fname = 'do_watchlist_update'; |
— | — | @@ -277,17 +233,6 @@ |
278 | 234 | wfOut( "Done.\n" ); |
279 | 235 | } |
280 | 236 | |
281 | | -function do_user_update() { |
282 | | - global $wgDatabase; |
283 | | - if ( $wgDatabase->fieldExists( 'user', 'user_emailauthenticationtimestamp' ) ) { |
284 | | - wfOut( "User table contains old email authentication field. Dropping... " ); |
285 | | - $wgDatabase->sourceFile( archive( 'patch-email-authentication.sql' ) ); |
286 | | - wfOut( "ok\n" ); |
287 | | - } else { |
288 | | - wfOut( "...user table does not contain old email authentication field.\n" ); |
289 | | - } |
290 | | -} |
291 | | - |
292 | 237 | /** |
293 | 238 | * 1.4 betas were missing the 'binary' marker from logging.log_title, |
294 | 239 | * which causes a collation mismatch error on joins in MySQL 4.1. |
— | — | @@ -475,28 +420,6 @@ |
476 | 421 | } |
477 | 422 | } |
478 | 423 | |
479 | | -function do_inverse_timestamp() { |
480 | | - global $wgDatabase; |
481 | | - if ( $wgDatabase->fieldExists( 'revision', 'inverse_timestamp' ) ) { |
482 | | - wfOut( "Removing revision.inverse_timestamp and fixing indexes... " ); |
483 | | - $wgDatabase->sourceFile( archive( 'patch-inverse_timestamp.sql' ) ); |
484 | | - wfOut( "ok\n" ); |
485 | | - } else { |
486 | | - wfOut( "...revision timestamp indexes already up to 2005-03-13\n" ); |
487 | | - } |
488 | | -} |
489 | | - |
490 | | -function do_text_id() { |
491 | | - global $wgDatabase; |
492 | | - if ( $wgDatabase->fieldExists( 'revision', 'rev_text_id' ) ) { |
493 | | - wfOut( "...rev_text_id already in place.\n" ); |
494 | | - } else { |
495 | | - wfOut( "Adding rev_text_id field... " ); |
496 | | - $wgDatabase->sourceFile( archive( 'patch-rev_text_id.sql' ) ); |
497 | | - wfOut( "ok\n" ); |
498 | | - } |
499 | | -} |
500 | | - |
501 | 424 | function do_pagelinks_update() { |
502 | 425 | global $wgDatabase; |
503 | 426 | if ( $wgDatabase->tableExists( 'pagelinks' ) ) { |
— | — | @@ -537,18 +460,6 @@ |
538 | 461 | wfOut( "ok\n" ); |
539 | 462 | } |
540 | 463 | |
541 | | -function do_drop_img_type() { |
542 | | - global $wgDatabase; |
543 | | - |
544 | | - if ( $wgDatabase->fieldExists( 'image', 'img_type' ) ) { |
545 | | - wfOut( "Dropping unused img_type field in image table... " ); |
546 | | - $wgDatabase->sourceFile( archive( 'patch-drop_img_type.sql' ) ); |
547 | | - wfOut( "ok\n" ); |
548 | | - } else { |
549 | | - wfOut( "...no img_type field in image table; Good.\n" ); |
550 | | - } |
551 | | -} |
552 | | - |
553 | 464 | function do_old_links_update() { |
554 | 465 | if( !defined( 'MW_NO_SETUP' ) ) { |
555 | 466 | define( 'MW_NO_SETUP', true ); |
Index: trunk/phase3/includes/installer/DatabaseUpdater.php |
— | — | @@ -220,6 +220,24 @@ |
221 | 221 | wfOut( "ok\n" ); |
222 | 222 | } |
223 | 223 | } |
| 224 | + |
| 225 | + /** |
| 226 | + * Drop a field from an existing table |
| 227 | + * |
| 228 | + * @param $table String Name of the table to modify |
| 229 | + * @param $field String Name of the old field |
| 230 | + * @param $patch String Path to the patch file |
| 231 | + * @param $fullpath Boolean Whether to treat $patch path as a relative or not |
| 232 | + */ |
| 233 | + function dropField( $table, $field, $patch, $fullpath = false ) { |
| 234 | + if ( $this->db->fieldExists( $table, $field ) ) { |
| 235 | + wfOut( "Table $table contains $field field. Dropping... " ); |
| 236 | + $this->applyPatch( $patch, $fullpath ); |
| 237 | + wfOut( "ok\n" ); |
| 238 | + } else { |
| 239 | + wfOut( "...$table table does not contain $field field.\n" ); |
| 240 | + } |
| 241 | + } |
224 | 242 | } |
225 | 243 | |
226 | 244 | class OracleUpdater extends DatabaseUpdater { |
Index: trunk/phase3/includes/installer/MysqlUpdater.php |
— | — | @@ -40,16 +40,16 @@ |
41 | 41 | array( 'addTable', 'logging', 'patch-logging.sql' ), |
42 | 42 | array( 'addField', 'user', 'user_token', 'patch-user_token.sql' ), |
43 | 43 | array( 'do_watchlist_update' ), |
44 | | - array( 'do_user_update' ), |
| 44 | + array( 'dropField', 'user', 'user_emailauthenticationtimestamp', 'patch-email-authentication.sql' ), |
45 | 45 | |
46 | 46 | // 1.5 |
47 | 47 | array( 'do_schema_restructuring' ), |
48 | 48 | array( 'addField', 'logging', 'log_params', 'patch-log_params.sql' ), |
49 | | - array( 'check_bin', 'logging', 'log_title', 'patch-logging-title.sql', ), |
| 49 | + array( 'check_bin', 'logging', 'log_title', 'patch-logging-title.sql', ), |
50 | 50 | array( 'addField', 'archive', 'ar_rev_id', 'patch-archive-rev_id.sql' ), |
51 | 51 | array( 'addField', 'page', 'page_len', 'patch-page_len.sql' ), |
52 | | - array( 'do_inverse_timestamp' ), |
53 | | - array( 'do_text_id' ), |
| 52 | + array( 'dropField', 'revision', 'inverse_timestamp', 'patch-inverse_timestamp.sql' ), |
| 53 | + array( 'addField', 'revision', 'rev_text_id', 'patch-rev_text_id.sql' ), |
54 | 54 | array( 'addField', 'revision', 'rev_deleted', 'patch-rev_deleted.sql' ), |
55 | 55 | array( 'addField', 'image', 'img_width', 'patch-img_width.sql' ), |
56 | 56 | array( 'addField', 'image', 'img_metadata', 'patch-img_metadata.sql' ), |
— | — | @@ -58,7 +58,7 @@ |
59 | 59 | array( 'doNamespaceSize' ), |
60 | 60 | array( 'addField', 'image', 'img_media_type', 'patch-img_media_type.sql' ), |
61 | 61 | array( 'do_pagelinks_update' ), |
62 | | - array( 'do_drop_img_type' ), |
| 62 | + array( 'dropField', 'image', 'img_type', 'patch-drop_img_type.sql' ), |
63 | 63 | array( 'do_user_unique_update' ), |
64 | 64 | array( 'do_user_groups_update' ), |
65 | 65 | array( 'addField', 'site_stats', 'ss_total_pages', 'patch-ss_total_articles.sql' ), |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | |
71 | 71 | // 1.6 |
72 | 72 | array( 'do_watchlist_null' ), |
73 | | - array( 'do_logging_timestamp_index' ), |
| 73 | + array( 'addIndex', 'logging', 'times', 'patch-logging-times-index.sql' ), |
74 | 74 | array( 'addField', 'ipblocks', 'ipb_range_start', 'patch-ipb_range_start.sql' ), |
75 | 75 | array( 'do_page_random_update' ), |
76 | 76 | array( 'addField', 'user', 'user_registration', 'patch-user_registration.sql' ), |
— | — | @@ -109,9 +109,9 @@ |
110 | 110 | array( 'addField', 'ipblocks', 'ipb_block_email', 'patch-ipb_emailban.sql' ), |
111 | 111 | array( 'do_categorylinks_indices_update' ), |
112 | 112 | array( 'addField', 'oldimage', 'oi_metadata', 'patch-oi_metadata.sql' ), |
113 | | - array( 'do_archive_user_index' ), |
114 | | - array( 'do_image_user_index' ), |
115 | | - array( 'do_oldimage_user_index' ), |
| 113 | + array( 'addIndex', 'archive', 'usertext_timestamp', 'patch-archive-user-index.sql' ), |
| 114 | + array( 'addIndex', 'image', 'img_usertext_timestamp', 'patch-image-user-index.sql' ), |
| 115 | + array( 'addIndex', 'oldimage', 'oi_usertext_timestamp', 'patch-oldimage-user-index.sql' ), |
116 | 116 | array( 'addField', 'archive', 'ar_page_id', 'patch-archive-page_id.sql' ), |
117 | 117 | array( 'addField', 'image', 'img_sha1', 'patch-img_sha1.sql' ), |
118 | 118 | |