diff --git a/ChangeLog b/ChangeLog index 5b04110285..2f89328b61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -73,6 +73,7 @@ phpMyAdmin - ChangeLog - issue #12026 Fixed parsing of UNION SELECT with brackets - issue #12109 Fixed parsing of CREATE TABLE [AS] SELECT - issue #12105 Multi-server drap-and-drop import always fails +- issue #12116 Fulltext indexes are not copied when using copy database function 4.5.5.1 (2016-02-29) - issue #11971 CREATE UNIQUE INDEX index type is not recognized by parser. diff --git a/libraries/Table.php b/libraries/Table.php index d467c9c922..2860e3d258 100644 --- a/libraries/Table.php +++ b/libraries/Table.php @@ -940,30 +940,35 @@ class Table $parser = new Parser($GLOBALS['sql_indexes']); + $GLOBALS['sql_indexes'] = ''; /** * The ALTER statement that generates the indexes. * @var \SqlParser\Statements\AlterStatement $statement */ - $statement = $parser->statements[0]; + foreach ($parser->statements as $statement) { - // Changing the altered table to the destination. - $statement->table = $destination; + // Changing the altered table to the destination. + $statement->table = $destination; - // Removing the name of the constraints. - foreach ($statement->altered as $idx => $altered) { - // All constraint names are removed because they must be unique. - if ($altered->options->has('CONSTRAINT')) { - $altered->field = null; + // Removing the name of the constraints. + foreach ($statement->altered as $idx => $altered) { + // All constraint names are removed because they must be unique. + if ($altered->options->has('CONSTRAINT')) { + $altered->field = null; + } } + + // Building back the query. + $sql_index = $statement->build() . ';'; + + // Executing it. + if ($mode == 'one_table' || $mode == 'db_copy') { + $GLOBALS['dbi']->query($sql_index); + } + + $GLOBALS['sql_indexes'] .= $sql_index; } - // Building back the query. - $GLOBALS['sql_indexes'] = $statement->build() . ';'; - - // Executing it. - if ($mode == 'one_table' || $mode == 'db_copy') { - $GLOBALS['dbi']->query($GLOBALS['sql_indexes']); - } $GLOBALS['sql_query'] .= "\n" . $GLOBALS['sql_indexes']; if ($mode == 'one_table' || $mode == 'db_copy') { unset($GLOBALS['sql_indexes']);