diff --git a/ChangeLog b/ChangeLog index 86fe356f7..a43a8263e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - ChangeLog $Id$ $HeadURL$ +2006-12-05 Michal Čihař + * server_privileges.php: Add IF NOT EXISTS to CREATE DATABASE query (RFE + #1608372), reload navigation after creating database. + 2006-12-04 Marc Delisle * db_structure.php, bug #1605985, missing HTML tag diff --git a/server_privileges.php b/server_privileges.php index b4f8dbb27..a1613dde5 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -836,9 +836,11 @@ if (!empty($adduser_submit) || !empty($change_copy)) { /* Create database for new user */ if (isset($createdb) && $createdb > 0) { if ($createdb == 1) { - $q = 'CREATE DATABASE ' . PMA_backquote(PMA_sqlAddslashes($username)) . ';'; + $q = 'CREATE DATABASE IF NOT EXISTS ' . PMA_backquote(PMA_sqlAddslashes($username)) . ';'; $sql_query .= $q; PMA_DBI_try_query($q) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query); + $GLOBALS['reload'] = TRUE; + PMA_reloadNavigation(); $q = 'GRANT ALL PRIVILEGES ON ' . PMA_backquote(PMA_sqlAddslashes($username)) . '.* TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\';'; $sql_query .= $q;