From 50831cba9a02d0d4663eaaad8a813b16dfc4b65f Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sat, 31 Oct 2009 00:38:38 +0000 Subject: [PATCH] BUGFIX #2476: Rename lowercase tables to correct casing if they have been transferred from a windows box. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@90548 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/MySQLDatabase.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/model/MySQLDatabase.php b/core/model/MySQLDatabase.php index 6a8b1c8ba..f2a91f504 100755 --- a/core/model/MySQLDatabase.php +++ b/core/model/MySQLDatabase.php @@ -281,6 +281,11 @@ class MySQLDatabase extends SS_Database { */ public function checkAndRepairTable($tableName) { if(!$this->runTableCheckCommand("CHECK TABLE \"$tableName\"")) { + if($this->runTableCheckCommand("CHECK TABLE \"".strtolower($tableName)."\"")){ + Database::alteration_message("Table $tableName: renamed from lowercase","repaired"); + return $this->renameTable(strtolower($tableName),$tableName); + } + DB::alteration_message("Table $tableName: repaired","repaired"); return $this->runTableCheckCommand("REPAIR TABLE \"$tableName\" USE_FRM"); } else {