Skip to content

Commit

Permalink
MDL-34211 Use the $table_name argument to check against $metatables k…
Browse files Browse the repository at this point in the history
…ey values
  • Loading branch information
woolardfa authored and danpoltawski committed Jul 16, 2012
1 parent 30a3059 commit ce6ab1b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/ddl/mysql_sql_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,18 +364,14 @@ function getCommentSQL ($xmldb_table) {
*/
public function isNameInUse($object_name, $type, $table_name) {

// Calculate the real table name
$xmldb_table = new xmldb_table($table_name);
$tname = $this->getTableName($xmldb_table);

switch($type) {
case 'ix':
case 'uix':
// First of all, check table exists
$metatables = $this->mdb->get_tables();
if (isset($metatables[$tname])) {
if (isset($metatables[$table_name])) {
// Fetch all the indexes in the table
if ($indexes = $this->mdb->get_indexes($tname)) {
if ($indexes = $this->mdb->get_indexes($table_name)) {
// Look for existing index in array
if (isset($indexes[$object_name])) {
return true;
Expand Down

0 comments on commit ce6ab1b

Please sign in to comment.