r103917 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103916‎ | r103917 | r103918 >
Date:16:28, 22 November 2011
Author:reedy
Status:ok
Tags:
Comment:
Partial revert of r103697 for bug 32508
Modified paths:
  • /trunk/phase3/includes/installer/DatabaseUpdater.php (modified) (history)
  • /trunk/phase3/includes/installer/MysqlUpdater.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/DatabaseUpdater.php
@@ -453,7 +453,7 @@
454454 } else {
455455 $this->output( "Adding $index key to table $table... " );
456456 $this->applyPatch( $patch, $fullpath );
457 - $this->output( "done.\n" );
 457+ $this->output( "ok\n" );
458458 }
459459 }
460460
@@ -469,7 +469,7 @@
470470 if ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
471471 $this->output( "Table $table contains $field field. Dropping... " );
472472 $this->applyPatch( $patch, $fullpath );
473 - $this->output( "done.\n" );
 473+ $this->output( "ok\n" );
474474 } else {
475475 $this->output( "...$table table does not contain $field field.\n" );
476476 }
@@ -487,7 +487,7 @@
488488 if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
489489 $this->output( "Dropping $index key from table $table... " );
490490 $this->applyPatch( $patch, $fullpath );
491 - $this->output( "done.\n" );
 491+ $this->output( "ok\n" );
492492 } else {
493493 $this->output( "...$index key doesn't exist.\n" );
494494 }
@@ -502,7 +502,7 @@
503503 if ( $this->db->tableExists( $table, __METHOD__ ) ) {
504504 $this->output( "Dropping table $table... " );
505505 $this->applyPatch( $patch, $fullpath );
506 - $this->output( "done.\n" );
 506+ $this->output( "ok\n" );
507507 } else {
508508 $this->output( "...$table doesn't exist.\n" );
509509 }
@@ -528,7 +528,7 @@
529529 $this->output( "Modifying $field field of table $table..." );
530530 $this->applyPatch( $patch, $fullpath );
531531 $this->insertUpdateRow( $updateKey );
532 - $this->output( "done.\n" );
 532+ $this->output( "ok\n" );
533533 }
534534 }
535535
@@ -588,7 +588,7 @@
589589 $this->output(
590590 "Populating log_user_text field, printing progress markers. For large\n" .
591591 "databases, you may want to hit Ctrl-C and do this manually with\n" .
592 - "maintenance/populateLogUsertext.php..." );
 592+ "maintenance/populateLogUsertext.php.\n" );
593593
594594 $task = $this->maintenance->runChild( 'PopulateLogUsertext' );
595595 $task->execute();
@@ -616,12 +616,12 @@
617617 * Updates the timestamps in the transcache table
618618 */
619619 protected function doUpdateTranscacheField() {
620 - $this->output( "Converting tc_time from UNIX epoch to MediaWiki timestamp... " );
621620 if ( $this->updateRowExists( 'convert transcache field' ) ) {
622621 $this->output( "...transcache tc_time already converted.\n" );
623622 return;
624623 }
625624
 625+ $this->output( "Converting tc_time from UNIX epoch to MediaWiki timestamp... " );
626626 $this->applyPatch( 'patch-tc-timestamp.sql' );
627627 $this->output( "done.\n" );
628628 }
@@ -630,7 +630,6 @@
631631 * Update CategoryLinks collation
632632 */
633633 protected function doCollationUpdate() {
634 - $this->output( "Updating category collations..." );
635634 global $wgCategoryCollation;
636635 if ( $this->db->selectField(
637636 'categorylinks',
@@ -642,6 +641,7 @@
643642 return;
644643 }
645644
 645+ $this->output( "Updating category collations..." );
646646 $task = $this->maintenance->runChild( 'UpdateCollation' );
647647 $task->execute();
648648 $this->output( "...done.\n" );
Index: trunk/phase3/includes/installer/MysqlUpdater.php
@@ -203,7 +203,6 @@
204204 * @param $patchFile String: path to the patch to correct the field
205205 */
206206 protected function checkBin( $table, $field, $patchFile ) {
207 - $this->output( "Fixing $field encoding on $table table... " );
208207 $tableName = $this->db->tableName( $table );
209208 $res = $this->db->query( "SELECT $field FROM $tableName LIMIT 0", __METHOD__ );
210209 $flags = explode( ' ', mysql_field_flags( $res->result, 0 ) );
@@ -211,6 +210,7 @@
212211 if ( in_array( 'binary', $flags ) ) {
213212 $this->output( "...$table table has correct $field encoding.\n" );
214213 } else {
 214+ $this->output( "Fixing $field encoding on $table table... " );
215215 $this->applyPatch( $patchFile );
216216 $this->output( "done.\n" );
217217 }
@@ -225,7 +225,6 @@
226226 * @return Boolean
227227 */
228228 protected function indexHasField( $table, $index, $field ) {
229 - $this->output( "Checking whether the $index index on the $table table has the $field field..." );
230229 $info = $this->db->indexInfo( $table, $index, __METHOD__ );
231230 if ( $info ) {
232231 foreach ( $info as $row ) {
@@ -244,12 +243,13 @@
245244 */
246245 protected function doInterwikiUpdate() {
247246 global $IP;
248 - $this->output( 'Creating interwiki table...' );
 247+
249248 if ( $this->db->tableExists( "interwiki", __METHOD__ ) ) {
250249 $this->output( "...already have interwiki table\n" );
251250 return;
252251 }
253252
 253+ $this->output( 'Creating interwiki table...' );
254254 $this->applyPatch( 'patch-interwiki.sql' );
255255 $this->output( "done.\n" );
256256 $this->output( 'Adding default interwiki definitions...' );
@@ -261,7 +261,6 @@
262262 * Check that proper indexes are in place
263263 */
264264 protected function doIndexUpdate() {
265 - $this->output( "Updating indexes to 20031107..." );
266265 $meta = $this->db->fieldInfo( 'recentchanges', 'rc_timestamp' );
267266 if ( $meta === false ) {
268267 throw new MWException( 'Missing rc_timestamp field of recentchanges table. Should not happen.' );
@@ -271,6 +270,7 @@
272271 return;
273272 }
274273
 274+ $this->output( "Updating indexes to 20031107..." );
275275 $this->applyPatch( 'patch-indexes.sql', true );
276276 $this->output( "done.\n" );
277277 }
@@ -281,14 +281,14 @@
282282 }
283283
284284 protected function doFixAncientImagelinks() {
285 - $this->output( "Fixing ancient broken imagelinks table..." );
286285 $info = $this->db->fieldInfo( 'imagelinks', 'il_from' );
287286 if ( !$info || $info->type() !== 'string' ) {
288287 $this->output( "...il_from OK\n" );
289288 return;
290289 }
291290
292 - $this->output( "\nNOTE: you will have to run maintenance/refreshLinks.php after this..." );
 291+ $this->output( "Fixing ancient broken imagelinks table.\n" );
 292+ $this->output( "NOTE: you will have to run maintenance/refreshLinks.php after this.\n" );
293293 $this->applyPatch( 'patch-fix-il_from.sql' );
294294 $this->output( "done.\n" );
295295 }
@@ -297,14 +297,14 @@
298298 * Check if we need to add talk page rows to the watchlist
299299 */
300300 function doWatchlistUpdate() {
301 - $this->output( "Adding missing watchlist talk page rows... " );
302301 $talk = $this->db->selectField( 'watchlist', 'count(*)', 'wl_namespace & 1', __METHOD__ );
303302 $nontalk = $this->db->selectField( 'watchlist', 'count(*)', 'NOT (wl_namespace & 1)', __METHOD__ );
304303 if ( $talk == $nontalk ) {
305 - $this->output( "watchlist talk page rows already present.\n" );
 304+ $this->output( "...watchlist talk page rows already present.\n" );
306305 return;
307306 }
308307
 308+ $this->output( "Adding missing watchlist talk page rows... " );
309309 $this->db->insertSelect( 'watchlist', 'watchlist',
310310 array(
311311 'wl_user' => 'wl_user',
@@ -507,12 +507,12 @@
508508 }
509509
510510 protected function doPagelinksUpdate() {
511 - $this->output( "Converting links and brokenlinks tables to pagelinks... " );
512511 if ( $this->db->tableExists( 'pagelinks', __METHOD__ ) ) {
513512 $this->output( "...already have pagelinks table.\n" );
514513 return;
515514 }
516515
 516+ $this->output( "Converting links and brokenlinks tables to pagelinks... " );
517517 $this->applyPatch( 'patch-pagelinks.sql' );
518518 $this->output( "done.\n" );
519519
@@ -541,16 +541,16 @@
542542 }
543543
544544 protected function doUserUniqueUpdate() {
545 - $this->output( "Adding unique index on user_name... " );
546545 $duper = new UserDupes( $this->db, array( $this, 'output' ) );
547546 if ( $duper->hasUniqueIndex() ) {
548 - $this->output( "already had unique user_name index.\n" );
 547+ $this->output( "...already have unique user_name index.\n" );
549548 return;
550549 }
551550
552551 if ( !$duper->clearDupes() ) {
553552 $this->output( "WARNING: This next step will probably fail due to unfixed duplicates...\n" );
554553 }
 554+ $this->output( "Adding unique index on user_name... " );
555555 $this->applyPatch( 'patch-user_nameindex.sql' );
556556 $this->output( "done.\n" );
557557 }
@@ -581,13 +581,13 @@
582582
583583 $this->output( "Adding user_groups table... " );
584584 $this->applyPatch( 'patch-user_groups.sql' );
585 - $this->output( "ok.\n" );
 585+ $this->output( "done.\n" );
586586
587587 if ( !$this->db->tableExists( 'user_rights', __METHOD__ ) ) {
588588 if ( $this->db->fieldExists( 'user', 'user_rights', __METHOD__ ) ) {
589589 $this->output( "Upgrading from a 1.3 or older database? Breaking out user_rights for conversion..." );
590 - $this->applyPatch( 'patch-user_rights.sql' );
591 - $this->output( "ok.\n" );
 590+ $this->db->applyPatch( 'patch-user_rights.sql' );
 591+ $this->output( done.\n" );
592592 } else {
593593 $this->output( "*** WARNING: couldn't locate user_rights table or field for upgrade.\n" );
594594 $this->output( "*** You may need to manually configure some sysops by manipulating\n" );
@@ -623,13 +623,13 @@
624624 * and update old broken items.
625625 */
626626 protected function doWatchlistNull() {
627 - $this->output( "Making wl_notificationtimestamp nullable... " );
628627 $info = $this->db->fieldInfo( 'watchlist', 'wl_notificationtimestamp' );
629628 if ( $info->isNullable() ) {
630 - $this->output( "wl_notificationtimestamp is already nullable.\n" );
 629+ $this->output( "...wl_notificationtimestamp is already nullable.\n" );
631630 return;
632631 }
633632
 633+ $this->output( "Making wl_notificationtimestamp nullable... " );
634634 $this->applyPatch( 'patch-watchlist-null.sql' );
635635 $this->output( "done.\n" );
636636 }
@@ -640,27 +640,26 @@
641641 * @see bug 3946
642642 */
643643 protected function doPageRandomUpdate() {
644 - $this->output( 'Set page_random to a random value...' );
645644 $page = $this->db->tableName( 'page' );
646645 $this->db->query( "UPDATE $page SET page_random = RAND() WHERE page_random = 0", __METHOD__ );
647646 $rows = $this->db->affectedRows();
648647
649648 if( $rows ) {
650 - $this->output( " set on $rows rows where it was 0.\n" );
 649+ $this->output( "Set page_random to a random value on $rows rows where it was set to 0\n" );
651650 } else {
652 - $this->output( "not needed.\n" );
 651+ $this->output( "...no page_random rows needed to be set\n" );
653652 }
654653 }
655654
656655 protected function doTemplatelinksUpdate() {
657 - $this->output( "Creating templatelinks table...\n" );
658656 if ( $this->db->tableExists( 'templatelinks', __METHOD__ ) ) {
659 - $this->output( "templatelinks table already exists.\n" );
 657+ $this->output( "...templatelinks table already exists\n" );
660658 return;
661659 }
662660
 661+ $this->output( "Creating templatelinks table...\n" );
663662 $this->applyPatch( 'patch-templatelinks.sql' );
664 - $this->output( "Populating templatelinks...\n" );
 663+ $this->output( "Populating...\n" );
665664 if ( wfGetLB()->getServerCount() > 1 ) {
666665 // Slow, replication-friendly update
667666 $res = $this->db->select( 'pagelinks', array( 'pl_from', 'pl_namespace', 'pl_title' ),
@@ -696,15 +695,12 @@
697696 }
698697
699698 protected function doBacklinkingIndicesUpdate() {
700 - $this->output( 'Updating backlinking indexes...' );
701699 if ( !$this->indexHasField( 'pagelinks', 'pl_namespace', 'pl_from' ) ||
702700 !$this->indexHasField( 'templatelinks', 'tl_namespace', 'tl_from' ) ||
703701 !$this->indexHasField( 'imagelinks', 'il_to', 'il_from' ) )
704702 {
705703 $this->applyPatch( 'patch-backlinkindexes.sql' );
706 - $this->output( "done\n" );
707 - } else {
708 - $this->output( "already done.\n" );
 704+ $this->output( "...backlinking indices updated\n" );
709705 }
710706 }
711707
@@ -714,47 +710,43 @@
715711 * -- Andrew Garrett, January 2007.
716712 */
717713 protected function doRestrictionsUpdate() {
718 - $this->output( "Creating page_restrictions table..." );
719714 if ( $this->db->tableExists( 'page_restrictions', __METHOD__ ) ) {
720715 $this->output( "...page_restrictions table already exists.\n" );
721716 return;
722717 }
723718
 719+ $this->output( "Creating page_restrictions table..." );
724720 $this->applyPatch( 'patch-page_restrictions.sql' );
725721 $this->applyPatch( 'patch-page_restrictions_sortkey.sql' );
726722 $this->output( "done.\n" );
727723
728 - $this->output( "Migrating old restrictions to new table..." );
 724+ $this->output( "Migrating old restrictions to new table...\n" );
729725 $task = $this->maintenance->runChild( 'UpdateRestrictions' );
730726 $task->execute();
731 - $this->output( "done.\n" );
732727 }
733728
734729 protected function doCategorylinksIndicesUpdate() {
735 - $this->output( 'Updating categorylinks indexes...' );
736730 if ( !$this->indexHasField( 'categorylinks', 'cl_sortkey', 'cl_from' ) ) {
737731 $this->applyPatch( 'patch-categorylinksindex.sql' );
738 - $this->output( "done.\n" );
739 - } else {
740 - $this->output( "already done.\n" );
 732+ $this->output( "...categorylinks indices updated\n" );
741733 }
742734 }
743735
744736 protected function doCategoryPopulation() {
745 - $this->output(
746 - "Populating category table, printing progress markers. " .
747 - "For large databases, you\n" .
748 - "may want to hit Ctrl-C and do this manually with maintenance/\n" .
749 - "populateCategory.php..."
750 - );
751737 if ( $this->updateRowExists( 'populate category' ) ) {
752738 $this->output( "...category table already populated.\n" );
753739 return;
754740 }
755741
 742+ $this->output(
 743+ "Populating category table, printing progress markers. " .
 744+ "For large databases, you\n" .
 745+ "may want to hit Ctrl-C and do this manually with maintenance/\n" .
 746+ "populateCategory.php.\n"
 747+ );
756748 $task = $this->maintenance->runChild( 'PopulateCategory' );
757749 $task->execute();
758 - $this->output( "done.\n" );
 750+ $this->output( "Done populating category table.\n" );
759751 }
760752
761753 protected function doPopulateParentId() {
@@ -762,21 +754,20 @@
763755 $this->output(
764756 "Populating rev_parent_id fields, printing progress markers. For large\n" .
765757 "databases, you may want to hit Ctrl-C and do this manually with\n" .
766 - "maintenance/populateParentId.php..." );
 758+ "maintenance/populateParentId.php.\n" );
767759
768760 $task = $this->maintenance->runChild( 'PopulateParentId' );
769761 $task->execute();
770 - $this->output( "done.\n" );
771762 }
772763 }
773764
774765 protected function doMaybeProfilingMemoryUpdate() {
775 - $this->output( "Adding pf_memory field to table profiling..." );
776766 if ( !$this->db->tableExists( 'profiling', __METHOD__ ) ) {
777767 // Simply ignore
778768 } elseif ( $this->db->fieldExists( 'profiling', 'pf_memory', __METHOD__ ) ) {
779769 $this->output( "...profiling table has pf_memory field.\n" );
780770 } else {
 771+ $this->output( "Adding pf_memory field to table profiling..." );
781772 $this->applyPatch( 'patch-profiling-memory.sql' );
782773 $this->output( "done.\n" );
783774 }
@@ -792,57 +783,57 @@
793784 }
794785
795786 protected function doUniquePlTlIl() {
796 - $this->output( "Making pl_namespace, tl_namespace and il_to indices UNIQUE... " );
797787 $info = $this->db->indexInfo( 'pagelinks', 'pl_namespace' );
798788 if ( is_array( $info ) && !$info[0]->Non_unique ) {
799789 $this->output( "...pl_namespace, tl_namespace, il_to indices are already UNIQUE.\n" );
800790 return;
801791 }
802792
 793+ $this->output( "Making pl_namespace, tl_namespace and il_to indices UNIQUE... " );
803794 $this->applyPatch( 'patch-pl-tl-il-unique.sql' );
804795 $this->output( "done.\n" );
805796 }
806797
807798 protected function renameEuWikiId() {
808 - $this->output( "Renaming eu_wiki_id -> eu_local_id... " );
809799 if ( $this->db->fieldExists( 'external_user', 'eu_local_id', __METHOD__ ) ) {
810800 $this->output( "...eu_wiki_id already renamed to eu_local_id.\n" );
811801 return;
812802 }
813803
 804+ $this->output( "Renaming eu_wiki_id -> eu_local_id... " );
814805 $this->applyPatch( 'patch-eu_local_id.sql' );
815806 $this->output( "done.\n" );
816807 }
817808
818809 protected function doUpdateMimeMinorField() {
819 - $this->output( "Altering all *_mime_minor fields to 100 bytes in size ... " );
820810 if ( $this->updateRowExists( 'mime_minor_length' ) ) {
821811 $this->output( "...*_mime_minor fields are already long enough.\n" );
822812 return;
823813 }
824814
 815+ $this->output( "Altering all *_mime_minor fields to 100 bytes in size ... " );
825816 $this->applyPatch( 'patch-mime_minor_length.sql' );
826817 $this->output( "done.\n" );
827818 }
828819
829820 protected function doClFieldsUpdate() {
830 - $this->output( 'Updating categorylinks (again)...' );
831821 if ( $this->updateRowExists( 'cl_fields_update' ) ) {
832822 $this->output( "...categorylinks up-to-date.\n" );
833823 return;
834824 }
835825
 826+ $this->output( 'Updating categorylinks (again)...' );
836827 $this->applyPatch( 'patch-categorylinks-better-collation2.sql' );
837828 $this->output( "done.\n" );
838829 }
839830
840831 protected function doLangLinksLengthUpdate() {
841 - $this->output( 'Updating length of ll_lang in langlinks...' );
842832 $langlinks = $this->db->tableName( 'langlinks' );
843833 $res = $this->db->query( "SHOW COLUMNS FROM $langlinks LIKE 'll_lang'" );
844834 $row = $this->db->fetchObject( $res );
845835
846836 if ( $row && $row->Type == "varbinary(10)" ) {
 837+ $this->output( 'Updating length of ll_lang in langlinks...' );
847838 $this->applyPatch( 'patch-langlinks-ll_lang-20.sql' );
848839 $this->output( "done.\n" );
849840 } else {
@@ -851,13 +842,13 @@
852843 }
853844
854845 protected function doUserNewTalkTimestampNotNull() {
855 - $this->output( "Making user_last_timestamp nullable... " );
856846 $info = $this->db->fieldInfo( 'user_newtalk', 'user_last_timestamp' );
857847 if ( $info->isNullable() ) {
858848 $this->output( "...user_last_timestamp is already nullable.\n" );
859849 return;
860850 }
861851
 852+ $this->output( "Making user_last_timestamp nullable... " );
862853 $this->applyPatch( 'patch-user-newtalk-timestamp-null.sql' );
863854 $this->output( "done.\n" );
864855 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r105531(bug 32508) clean up update.php messages...hashar10:04, 8 December 2011
r108716(bug 32508) Fix updater output...hashar10:59, 12 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103697More updater message updates and normalisation...reedy17:39, 19 November 2011
r103892revert r103691 that makes update.php output garbage...hashar13:28, 22 November 2011

Status & tagging log