https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113789

Revision: 113789
Author:   saper
Date:     2012-03-14 00:36:11 +0000 (Wed, 14 Mar 2012)
Log Message:
-----------
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: trunk/phase3/includes/installer/PostgresUpdater.php
===================================================================
--- trunk/phase3/includes/installer/PostgresUpdater.php 2012-03-14 00:29:41 UTC 
(rev 113788)
+++ trunk/phase3/includes/installer/PostgresUpdater.php 2012-03-14 00:36:11 UTC 
(rev 113789)
@@ -394,7 +394,7 @@
 
        protected function renameSequence( $old, $new ) {
                if ( $this->db->sequenceExists( $new ) ) {
-                       $this->output( "WARNING sequence $new already exists\n" 
);
+                       $this->output( "...sequence $new already exists.\n" );
                        return;
                }
                if ( $this->db->sequenceExists( $old ) ) {
@@ -414,7 +414,7 @@
        protected function addPgField( $table, $field, $type ) {
                $fi = $this->db->fieldInfo( $table, $field );
                if ( !is_null( $fi ) ) {
-                       $this->output( "... column '$table.$field' already 
exists\n" );
+                       $this->output( "...column '$table.$field' already 
exists\n" );
                        return;
                } else {
                        $this->output( "Adding column '$table.$field'\n" );
@@ -425,12 +425,12 @@
        protected function changeField( $table, $field, $newtype, $default ) {
                $fi = $this->db->fieldInfo( $table, $field );
                if ( is_null( $fi ) ) {
-                       $this->output( "... error: expected column 
$table.$field to exist\n" );
+                       $this->output( "...ERROR: expected column $table.$field 
to exist\n" );
                        exit( 1 );
                }
 
                if ( $fi->type() === $newtype )
-                       $this->output( "... column '$table.$field' is already 
of type '$newtype'\n" );
+                       $this->output( "...column '$table.$field' is already of 
type '$newtype'\n" );
                else {
                        $this->output( "Changing column type of '$table.$field' 
from '{$fi->type()}' to '$newtype'\n" );
                        $sql = "ALTER TABLE $table ALTER $field TYPE $newtype";
@@ -452,7 +452,7 @@
        protected function changeNullableField( $table, $field, $null ) {
                $fi = $this->db->fieldInfo( $table, $field );
                if ( is_null( $fi ) ) {
-                       $this->output( "... error: expected column 
$table.$field to exist\n" );
+                       $this->output( "...ERROR: expected column $table.$field 
to exist\n" );
                        exit( 1 );
                }
                if ( $fi->isNullable() ) {
@@ -461,7 +461,7 @@
                                $this->output( "Changing '$table.$field' to not 
allow NULLs\n" );
                                $this->db->query( "ALTER TABLE $table ALTER 
$field SET NOT NULL" );
                        } else {
-                               $this->output( "... column '$table.$field' is 
already set as NULL\n" );
+                               $this->output( "...column '$table.$field' is 
already set as NULL\n" );
                        }
                } else {
                        # # It's NOT NULL - does it need to be NULL?
@@ -470,14 +470,14 @@
                                $this->db->query( "ALTER TABLE $table ALTER 
$field DROP NOT NULL" );
                        }
                        else {
-                               $this->output( "... column '$table.$field' is 
already set as NOT NULL\n" );
+                               $this->output( "...column '$table.$field' is 
already set as NOT NULL\n" );
                        }
                }
        }
 
        public function addPgIndex( $table, $index, $type ) {
                if ( $this->db->indexExists( $table, $index ) ) {
-                       $this->output( "... index '$index' on table '$table' 
already exists\n" );
+                       $this->output( "...index '$index' on table '$table' 
already exists\n" );
                } else {
                        $this->output( "Creating index '$index' on table 
'$table' $type\n" );
                        $this->db->query( "CREATE INDEX $index ON $table $type" 
);
@@ -486,7 +486,7 @@
 
        public function addPgExtIndex( $table, $index, $type ) {
                if ( $this->db->indexExists( $table, $index ) ) {
-                       $this->output( "... index '$index' on table '$table' 
already exists\n" );
+                       $this->output( "...index '$index' on table '$table' 
already exists\n" );
                } else {
                        $this->output( "Creating index '$index' on table 
'$table'\n" );
                        if ( preg_match( '/^\(/', $type ) ) {
@@ -527,7 +527,7 @@
                        }
                        $this->applyPatch( 'patch-remove-archive2.sql' );
                } else {
-                       $this->output( "... obsolete table 'archive2' does not 
exist\n" );
+                       $this->output( "...obsolete table 'archive2' does not 
exist\n" );
                }
        }
 
@@ -538,13 +538,13 @@
                        $this->db->query( "ALTER TABLE oldimage ALTER 
oi_deleted TYPE SMALLINT USING (oi_deleted::smallint)" );
                        $this->db->query( "ALTER TABLE oldimage ALTER 
oi_deleted SET DEFAULT 0" );
                } else {
-                       $this->output( "... column 'oldimage.oi_deleted' is 
already of type 'smallint'\n" );
+                       $this->output( "...column 'oldimage.oi_deleted' is 
already of type 'smallint'\n" );
                }
        }
 
        protected function checkOiNameConstraint() {
                if ( $this->db->hasConstraint( "oldimage_oi_name_fkey_cascaded" 
) ) {
-                       $this->output( "... table 'oldimage' has correct 
cascading delete/update foreign key to image\n" );
+                       $this->output( "...table 'oldimage' has correct 
cascading delete/update foreign key to image\n" );
                } else {
                        if ( $this->db->hasConstraint( "oldimage_oi_name_fkey" 
) ) {
                                $this->db->query( "ALTER TABLE oldimage DROP 
CONSTRAINT oldimage_oi_name_fkey" );
@@ -563,7 +563,7 @@
                        $this->output( "Adding function and trigger 
'page_deleted' to table 'page'\n" );
                        $this->applyPatch( 'patch-page_deleted.sql' );
                } else {
-                       $this->output( "... table 'page' has 'page_deleted' 
trigger\n" );
+                       $this->output( "...table 'page' has 'page_deleted' 
trigger\n" );
                }
        }
 
@@ -573,7 +573,7 @@
                        $this->output( "Removing NOT NULL constraint from 
'recentchanges.rc_cur_id'\n" );
                        $this->applyPatch( 'patch-rc_cur_id-not-null.sql' );
                } else {
-                       $this->output( "... column 'recentchanges.rc_cur_id' 
has a NOT NULL constraint\n" );
+                       $this->output( "...column 'recentchanges.rc_cur_id' has 
a NOT NULL constraint\n" );
                }
        }
 
@@ -584,20 +584,20 @@
                        $this->db->query( 'DROP INDEX pagelink_unique' );
                        $pu = null;
                } else {
-                       $this->output( "... obsolete version of index 
'pagelink_unique index' does not exist\n" );
+                       $this->output( "...obsolete version of index 
'pagelink_unique index' does not exist\n" );
                }
 
                if ( is_null( $pu ) ) {
                        $this->output( "Creating index 'pagelink_unique 
index'\n" );
                        $this->db->query( 'CREATE UNIQUE INDEX pagelink_unique 
ON pagelinks (pl_from,pl_namespace,pl_title)' );
                } else {
-                       $this->output( "... index 'pagelink_unique_index' 
already exists\n" );
+                       $this->output( "...index 'pagelink_unique_index' 
already exists\n" );
                }
        }
 
        protected function checkRevUserFkey() {
                if ( $this->fkeyDeltype( 'revision_rev_user_fkey' ) == 'r' ) {
-                       $this->output( "... constraint 'revision_rev_user_fkey' 
is ON DELETE RESTRICT\n" );
+                       $this->output( "...constraint 'revision_rev_user_fkey' 
is ON DELETE RESTRICT\n" );
                } else {
                        $this->output( "Changing constraint 
'revision_rev_user_fkey' to ON DELETE RESTRICT\n" );
                        $this->applyPatch( 'patch-revision_rev_user_fkey.sql' );
@@ -610,7 +610,7 @@
                        $this->db->query( 'DROP INDEX ipb_address' );
                }
                if ( $this->db->indexExists( 'ipblocks', 'ipb_address_unique' ) 
) {
-                       $this->output( "... have ipb_address_unique\n" );
+                       $this->output( "...have ipb_address_unique\n" );
                } else {
                        $this->output( "Adding ipb_address_unique index\n" );
                        $this->applyPatch( 'patch-ipb_address_unique.sql' );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to