r113789 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113788‎ | r113789 | r113790 >
Date:00:36, 14 March 2012
Author:saper
Status:ok
Tags:
Comment:
Cosmetic improvements to PostreSQL updater output

* Don't WARN on sequences already existing
* Align dots nicely to the rest
Modified paths:
  • /trunk/phase3/includes/installer/PostgresUpdater.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/PostgresUpdater.php
@@ -394,7 +394,7 @@
395395
396396 protected function renameSequence( $old, $new ) {
397397 if ( $this->db->sequenceExists( $new ) ) {
398 - $this->output( "WARNING sequence $new already exists\n" );
 398+ $this->output( "...sequence $new already exists.\n" );
399399 return;
400400 }
401401 if ( $this->db->sequenceExists( $old ) ) {
@@ -414,7 +414,7 @@
415415 protected function addPgField( $table, $field, $type ) {
416416 $fi = $this->db->fieldInfo( $table, $field );
417417 if ( !is_null( $fi ) ) {
418 - $this->output( "... column '$table.$field' already exists\n" );
 418+ $this->output( "...column '$table.$field' already exists\n" );
419419 return;
420420 } else {
421421 $this->output( "Adding column '$table.$field'\n" );
@@ -425,12 +425,12 @@
426426 protected function changeField( $table, $field, $newtype, $default ) {
427427 $fi = $this->db->fieldInfo( $table, $field );
428428 if ( is_null( $fi ) ) {
429 - $this->output( "... error: expected column $table.$field to exist\n" );
 429+ $this->output( "...ERROR: expected column $table.$field to exist\n" );
430430 exit( 1 );
431431 }
432432
433433 if ( $fi->type() === $newtype )
434 - $this->output( "... column '$table.$field' is already of type '$newtype'\n" );
 434+ $this->output( "...column '$table.$field' is already of type '$newtype'\n" );
435435 else {
436436 $this->output( "Changing column type of '$table.$field' from '{$fi->type()}' to '$newtype'\n" );
437437 $sql = "ALTER TABLE $table ALTER $field TYPE $newtype";
@@ -452,7 +452,7 @@
453453 protected function changeNullableField( $table, $field, $null ) {
454454 $fi = $this->db->fieldInfo( $table, $field );
455455 if ( is_null( $fi ) ) {
456 - $this->output( "... error: expected column $table.$field to exist\n" );
 456+ $this->output( "...ERROR: expected column $table.$field to exist\n" );
457457 exit( 1 );
458458 }
459459 if ( $fi->isNullable() ) {
@@ -461,7 +461,7 @@
462462 $this->output( "Changing '$table.$field' to not allow NULLs\n" );
463463 $this->db->query( "ALTER TABLE $table ALTER $field SET NOT NULL" );
464464 } else {
465 - $this->output( "... column '$table.$field' is already set as NULL\n" );
 465+ $this->output( "...column '$table.$field' is already set as NULL\n" );
466466 }
467467 } else {
468468 # # It's NOT NULL - does it need to be NULL?
@@ -470,14 +470,14 @@
471471 $this->db->query( "ALTER TABLE $table ALTER $field DROP NOT NULL" );
472472 }
473473 else {
474 - $this->output( "... column '$table.$field' is already set as NOT NULL\n" );
 474+ $this->output( "...column '$table.$field' is already set as NOT NULL\n" );
475475 }
476476 }
477477 }
478478
479479 public function addPgIndex( $table, $index, $type ) {
480480 if ( $this->db->indexExists( $table, $index ) ) {
481 - $this->output( "... index '$index' on table '$table' already exists\n" );
 481+ $this->output( "...index '$index' on table '$table' already exists\n" );
482482 } else {
483483 $this->output( "Creating index '$index' on table '$table' $type\n" );
484484 $this->db->query( "CREATE INDEX $index ON $table $type" );
@@ -486,7 +486,7 @@
487487
488488 public function addPgExtIndex( $table, $index, $type ) {
489489 if ( $this->db->indexExists( $table, $index ) ) {
490 - $this->output( "... index '$index' on table '$table' already exists\n" );
 490+ $this->output( "...index '$index' on table '$table' already exists\n" );
491491 } else {
492492 $this->output( "Creating index '$index' on table '$table'\n" );
493493 if ( preg_match( '/^\(/', $type ) ) {
@@ -527,7 +527,7 @@
528528 }
529529 $this->applyPatch( 'patch-remove-archive2.sql' );
530530 } else {
531 - $this->output( "... obsolete table 'archive2' does not exist\n" );
 531+ $this->output( "...obsolete table 'archive2' does not exist\n" );
532532 }
533533 }
534534
@@ -538,13 +538,13 @@
539539 $this->db->query( "ALTER TABLE oldimage ALTER oi_deleted TYPE SMALLINT USING (oi_deleted::smallint)" );
540540 $this->db->query( "ALTER TABLE oldimage ALTER oi_deleted SET DEFAULT 0" );
541541 } else {
542 - $this->output( "... column 'oldimage.oi_deleted' is already of type 'smallint'\n" );
 542+ $this->output( "...column 'oldimage.oi_deleted' is already of type 'smallint'\n" );
543543 }
544544 }
545545
546546 protected function checkOiNameConstraint() {
547547 if ( $this->db->hasConstraint( "oldimage_oi_name_fkey_cascaded" ) ) {
548 - $this->output( "... table 'oldimage' has correct cascading delete/update foreign key to image\n" );
 548+ $this->output( "...table 'oldimage' has correct cascading delete/update foreign key to image\n" );
549549 } else {
550550 if ( $this->db->hasConstraint( "oldimage_oi_name_fkey" ) ) {
551551 $this->db->query( "ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey" );
@@ -563,7 +563,7 @@
564564 $this->output( "Adding function and trigger 'page_deleted' to table 'page'\n" );
565565 $this->applyPatch( 'patch-page_deleted.sql' );
566566 } else {
567 - $this->output( "... table 'page' has 'page_deleted' trigger\n" );
 567+ $this->output( "...table 'page' has 'page_deleted' trigger\n" );
568568 }
569569 }
570570
@@ -573,7 +573,7 @@
574574 $this->output( "Removing NOT NULL constraint from 'recentchanges.rc_cur_id'\n" );
575575 $this->applyPatch( 'patch-rc_cur_id-not-null.sql' );
576576 } else {
577 - $this->output( "... column 'recentchanges.rc_cur_id' has a NOT NULL constraint\n" );
 577+ $this->output( "...column 'recentchanges.rc_cur_id' has a NOT NULL constraint\n" );
578578 }
579579 }
580580
@@ -584,20 +584,20 @@
585585 $this->db->query( 'DROP INDEX pagelink_unique' );
586586 $pu = null;
587587 } else {
588 - $this->output( "... obsolete version of index 'pagelink_unique index' does not exist\n" );
 588+ $this->output( "...obsolete version of index 'pagelink_unique index' does not exist\n" );
589589 }
590590
591591 if ( is_null( $pu ) ) {
592592 $this->output( "Creating index 'pagelink_unique index'\n" );
593593 $this->db->query( 'CREATE UNIQUE INDEX pagelink_unique ON pagelinks (pl_from,pl_namespace,pl_title)' );
594594 } else {
595 - $this->output( "... index 'pagelink_unique_index' already exists\n" );
 595+ $this->output( "...index 'pagelink_unique_index' already exists\n" );
596596 }
597597 }
598598
599599 protected function checkRevUserFkey() {
600600 if ( $this->fkeyDeltype( 'revision_rev_user_fkey' ) == 'r' ) {
601 - $this->output( "... constraint 'revision_rev_user_fkey' is ON DELETE RESTRICT\n" );
 601+ $this->output( "...constraint 'revision_rev_user_fkey' is ON DELETE RESTRICT\n" );
602602 } else {
603603 $this->output( "Changing constraint 'revision_rev_user_fkey' to ON DELETE RESTRICT\n" );
604604 $this->applyPatch( 'patch-revision_rev_user_fkey.sql' );
@@ -610,7 +610,7 @@
611611 $this->db->query( 'DROP INDEX ipb_address' );
612612 }
613613 if ( $this->db->indexExists( 'ipblocks', 'ipb_address_unique' ) ) {
614 - $this->output( "... have ipb_address_unique\n" );
 614+ $this->output( "...have ipb_address_unique\n" );
615615 } else {
616616 $this->output( "Adding ipb_address_unique index\n" );
617617 $this->applyPatch( 'patch-ipb_address_unique.sql' );

Status & tagging log