From 10bf22cb005e3a12922a9b4c6a45d88c1259905c Mon Sep 17 00:00:00 2001 From: Andreas Piening Date: Wed, 27 Jan 2010 03:04:37 +0000 Subject: [PATCH] MINOR: look up tables through DB::tableList() --- code/migration/UserFormsMigrationTask.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/code/migration/UserFormsMigrationTask.php b/code/migration/UserFormsMigrationTask.php index f2e181f..aa1fd47 100644 --- a/code/migration/UserFormsMigrationTask.php +++ b/code/migration/UserFormsMigrationTask.php @@ -191,14 +191,16 @@ class UserFormsMigrationTask extends MigrationTask { * */ function findDatabaseTableName($tableName) { - $table = DB::query("SHOW TABLES LIKE '$tableName'")->value(); - if(!$table) { - $table = DB::query("SHOW TABLES LIKE '_obsolete_$tableName'")->value(); - - if(!$table) echo '!! Could Not Find '.$tableName; + $exist = DB::tableList(); + if(!empty($exist)) { + if(array_search($tableName, $exist) !== false) return $tableName; + $tableName = "_obsolete_$tableName"; + if(array_search($tableName, $exist) !== false) return $tableName; } - return $table; + echo '!! Could Not Find '.$tableName; + return; } + /** * Create a EditableOption from a whatever type of multi * form field it is coming from