From 692a5d16f5478b11172e556c120286923209fa5f Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 5 Jan 2013 20:31:35 +0100 Subject: [PATCH] Some fixes for Ia2782d64 (2f60cd2) - Add doTable() check at the top of renameIndex() - Return true instead of false when aborting an update due to unfulfilled condition; false is only to be used for updates that will be written to a schema update file to be run later Also removed the return false from addIndex() for consistency - Break long line Change-Id: I2efb6e3af4703ed8afeb315e8cda774d9a6c4a32 --- includes/installer/DatabaseUpdater.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index cd5f90b952..73574828ee 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -687,7 +687,6 @@ abstract class DatabaseUpdater { if ( !$this->db->tableExists( $table, __METHOD__ ) ) { $this->output( "...skipping: '$table' table doesn't exist yet.\n" ); - return false; } else if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) { $this->output( "...index $index already set on $table table.\n" ); } else { @@ -752,17 +751,22 @@ abstract class DatabaseUpdater { * @return Boolean false if this was skipped because schema changes are skipped */ protected function renameIndex( $table, $oldIndex, $newIndex, $skipBothIndexExistWarning, $patch, $fullpath = false ) { + if ( !$this->doTable( $table ) ) { + return true; + } + // First requirement: the table must exist if ( !$this->db->tableExists( $table, __METHOD__ ) ) { $this->output( "...skipping: '$table' table doesn't exist yet.\n" ); - return false; + return true; } // Second requirement: the new index must be missing if ( $this->db->indexExists( $table, $newIndex, __METHOD__ ) ) { $this->output( "...index $newIndex already set on $table table.\n" ); if ( !$skipBothIndexExistWarning && $this->db->indexExists( $table, $oldIndex, __METHOD__ ) ) { - $this->output( "...WARNING: $oldIndex still exists, despite it has been renamed into $newIndex (which also exists).\n $oldIndex should be manually removed if not needed anymore.\n" ); + $this->output( "...WARNING: $oldIndex still exists, despite it has been renamed into $newIndex (which also exists).\n" . + " $oldIndex should be manually removed if not needed anymore.\n" ); } return true; } @@ -770,7 +774,7 @@ abstract class DatabaseUpdater { // Third requirement: the old index must exist if ( !$this->db->indexExists( $table, $oldIndex, __METHOD__ ) ) { $this->output( "...skipping: index $oldIndex doesn't exist.\n" ); - return false; + return true; } // Requirements have been satisfied, patch can be applied -- 2.20.1