Browse Source

fix : La création des bases était cassée. Merci Philippe

cfhttps://discuter.spip.net/t/mutualisation-erreur-a-la-creation-de-la-base/162310/7
master
RealET 2 months ago
parent
commit
3f50621b32
  1. 13
      mutualiser_creer.php

13
mutualiser_creer.php

@ -199,6 +199,7 @@ function mutu_etape_creer_base($e, $options) {
// on le fait en local et en POST, donc pas de trou de secu
// curl indispensable pour le https... devrait aller dans inc/distant
if (isset($options['url_creer_base'])
and $options['url_creer_base'] !== ''
and defined('_INSTALL_NAME_DB')
) {
$url = str_replace('%x', _INSTALL_NAME_DB, $options['url_creer_base']);
@ -256,16 +257,8 @@ function mutu_etape_creer_base($e, $options) {
case 'mysql':
default:
// creer user
// Commencer par le supprimer s'il existe déjà
// cf https://bugs.mysql.com/bug.php?id=19166
// A good workaround is to grant a harmless privilege to the user before dropping it.
// This will create the user if it doesn't exist, so that it can be dropped safely
$req[] = "GRANT USAGE ON *.* TO '" . _INSTALL_USER_DB . "'@'" . _INSTALL_HOST_DB_LOCALNAME . "'";
$err[] = "GRANT USAGE ON *.* TO '" . _INSTALL_USER_DB . "'@'" . _INSTALL_HOST_DB_LOCALNAME . "'";
$req[] = "DROP USER '" . _INSTALL_USER_DB . "'@'" . _INSTALL_HOST_DB_LOCALNAME . "'";
$err[] = "DROP USER '" . _INSTALL_USER_DB . "'@'" . _INSTALL_HOST_DB_LOCALNAME . "'";
$req[] = "CREATE user '" . _INSTALL_USER_DB . "'@'" . _INSTALL_HOST_DB_LOCALNAME . "' IDENTIFIED BY '" . _INSTALL_PASS_DB . "'";
$err[] = "CREATE user '" . _INSTALL_USER_DB . "'@'" . _INSTALL_HOST_DB_LOCALNAME . "' IDENTIFIED BY 'xxx'";
$req[] = "CREATE USER IF NOT EXISTS '" . _INSTALL_USER_DB . "'@'" . _INSTALL_HOST_DB_LOCALNAME . "' IDENTIFIED BY '" . _INSTALL_PASS_DB . "'";
$err[] = "CREATE USER IF NOT EXISTS '" . _INSTALL_USER_DB . "'@'" . _INSTALL_HOST_DB_LOCALNAME . "' IDENTIFIED BY 'xxx'";
// affecter a sa base
$req[] = 'GRANT ' . _PRIVILEGES_MYSQL_USER_BASE . ' ON '
. _INSTALL_NAME_DB . ".* TO '"

Loading…
Cancel
Save