FIX If mysql server is distant, the creation of user must use % as host

with mysql.
This commit is contained in:
Laurent Destailleur 2016-12-23 00:23:57 +01:00
parent dcb14db10d
commit 1e1028605d
3 changed files with 102 additions and 76 deletions

View File

@ -810,7 +810,7 @@ class DoliDBMysqli extends DoliDB
/**
* Create a user and privileges to connect to database (even if database does not exists yet)
*
* @param string $dolibarr_main_db_host Ip serveur
* @param string $dolibarr_main_db_host Ip server or '%'
* @param string $dolibarr_main_db_user Nom user a creer
* @param string $dolibarr_main_db_pass Mot de passe user a creer
* @param string $dolibarr_main_db_name Database name where user must be granted

View File

@ -15,55 +15,31 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
.minwidth100 { min-width: 100px; }
.minwidth200 { min-width: 200px; }
.minwidth300 { min-width: 300px; }
.minwidth400 { min-width: 400px; }
.minwidth500 { min-width: 500px; }
.minwidth50imp { min-width: 50px !important; }
.minwidth100imp { min-width: 100px !important; }
.minwidth200imp { min-width: 200px !important; }
.minwidth300imp { min-width: 300px !important; }
.minwidth400imp { min-width: 400px !important; }
.minwidth500imp { min-width: 500px !important; }
/* Force values for small screen 570 */
@media only screen and (max-width: 570px)
{
input, input[type=text], input[type=password], select, textarea {
min-width: 20px;
min-height: 1.4em;
line-height: 1.4em;
padding: .4em .1em;
border: 1px solid #BBB;
/* max-width: inherit; why this ? */
}
.hideonsmartphone { display: none; }
.noenlargeonsmartphone { width : 50px !important; display: inline !important; }
.maxwidthonsmartphone { max-width: 100px; }
.maxwidth50onsmartphone { max-width: 40px; }
.maxwidth75onsmartphone { max-width: 50px; }
.maxwidth100onsmartphone { max-width: 70px; }
.maxwidth150onsmartphone { max-width: 120px; }
.maxwidth200onsmartphone { max-width: 200px; }
.maxwidth300onsmartphone { max-width: 300px; }
.maxwidth400onsmartphone { max-width: 400px; }
.minwidth50imp { min-width: 50px !important; }
.minwidth100imp { min-width: 50px !important; }
.minwidth200imp { min-width: 50px !important; }
.minwidth300imp { min-width: 50px !important; }
.minwidth400imp { min-width: 50px !important; }
.minwidth500imp { min-width: 50px !important; }
}
body {
font-size:13px;
font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif;
background: #fcfcfc;
font-size:14px;
font-family: roboto,arial,tahoma,verdana,helvetica;
/* background: #fcfcfc; */
margin: 15px 30px 10px;
}
table.main-inside {
padding-left: 10px;
padding-right: 10px;
margin-bottom: 10px;
margin-top: 10px;
color: #000000;
}
table.main {
padding-left: 6px;
padding-right: 6px;
padding-top: 12px;
padding-bottom: 12px;
background-color: #fff;
}
div.titre {
padding: 5px 5px 5px 5px;
margin: 0 0 0 0;
@ -90,6 +66,74 @@ div.soustitre {
text-align: right;
}
.minwidth100 { min-width: 100px; }
.minwidth200 { min-width: 200px; }
.minwidth300 { min-width: 300px; }
.minwidth400 { min-width: 400px; }
.minwidth500 { min-width: 500px; }
.minwidth50imp { min-width: 50px !important; }
.minwidth100imp { min-width: 100px !important; }
.minwidth200imp { min-width: 200px !important; }
.minwidth300imp { min-width: 300px !important; }
.minwidth400imp { min-width: 400px !important; }
.minwidth500imp { min-width: 500px !important; }
/* Force values for small screen 570 */
@media only screen and (max-width: 570px)
{
body {
margin: 15px 4px 4px;
}
input, input[type=text], input[type=password], select, textarea {
min-width: 20px;
min-height: 1.4em;
line-height: 1.4em;
padding: .4em .1em;
border: 1px solid #BBB;
/* max-width: inherit; why this ? */
}
.hideonsmartphone { display: none; }
.noenlargeonsmartphone { width : 50px !important; display: inline !important; }
.maxwidthonsmartphone { max-width: 100px; }
.maxwidth50onsmartphone { max-width: 40px; }
.maxwidth75onsmartphone { max-width: 50px; }
.maxwidth100onsmartphone { max-width: 70px; }
.maxwidth150onsmartphone { max-width: 120px; }
.maxwidth200onsmartphone { max-width: 200px; }
.maxwidth300onsmartphone { max-width: 300px; }
.maxwidth400onsmartphone { max-width: 400px; }
.minwidth50imp { min-width: 50px !important; }
.minwidth100imp { min-width: 50px !important; }
.minwidth200imp { min-width: 50px !important; }
.minwidth300imp { min-width: 50px !important; }
.minwidth400imp { min-width: 50px !important; }
.minwidth500imp { min-width: 50px !important; }
table.main {
padding-left: 0;
padding-right: 0;
}
table.main-inside {
padding-left: 1px;
padding-right: 1px;
}
span.titre {
font-size: 90%;
font-weight: normal;
background: #FFFFFF;
color: #444;
border: 1px solid #999;
padding: 5px 5px 5px 5px;
margin: 0 0 0 4px;
}
}
input:disabled
{
background: #FDFDFD;
@ -150,33 +194,12 @@ input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 50px #FBFFEA inset;
}
table.main {
padding-left: 6px;
padding-right: 6px;
padding-top: 12px;
padding-bottom: 12px;
border: 1px solid #A0A0A0;
border-radius: 8px;
border: solid 1px rgba(90,90,90,.4);
background-color: #fff;
-moz-box-shadow: 0px 1px 6px 2px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0px 1px 6px 2px rgba(0, 0, 0, 0.2);
box-shadow: 0px 1px 6px 2px rgba(0, 0, 0, 0.2);
}
table.main-inside {
padding-left: 10px;
padding-right: 10px;
margin-bottom: 10px;
margin-top: 10px;
color: #000000;
}
table.listofchoices, tr.listofchoices, td.listofchoices {
border-collapse: collapse;
padding: 4px;
color: #000000;
border: 1px solid #999 !important;
border: 1px solid #ccc !important;
line-height: 18px;
}
tr.listofchoices {
@ -257,7 +280,6 @@ a.titre {
div.comment {
text-decoration:none;
color:black;
font-size: 13px;
}
h3 {
@ -293,9 +315,6 @@ td.comment {
font-size: 12px;
border-bottom: 1px solid #CCCCDB;
}
table {
font-size: 13px;
}
.install
{
@ -319,8 +338,8 @@ ul {
.button {
background: #FFFFFF bottom;
border: 1px solid #C0C0C0;
background: #eee;
/*border: 1px solid #C0C0C0;*/
padding: 0.3em 0.7em;
margin: 0 0.5em;
-moz-border-radius:0 5px 0 5px;

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
@ -129,7 +129,6 @@ if (@file_exists($forcedfile)) {
}
}
dolibarr_install_syslog("--- step1: entering step1.php page");
$error = 0;
@ -138,6 +137,7 @@ $error = 0;
* View
*/
dolibarr_install_syslog("--- step1: entering step1.php page");
pHeader($langs->trans("ConfigurationFile"),"step2");
@ -541,7 +541,14 @@ if (! $error && $db->connected && $action == "set")
{
if ($db->connected)
{
$result=$db->DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name);
// Create user
$tmpdolibarr_main_db_host = $dolibarr_main_db_host;
if ($databasefortest == 'mysql')
{
if (! in_array($conf->db->host, array('127.0.0.1', 'localhost', 'localhost.local'))) $tmpdolibarr_main_db_host='%';
}
$result=$db->DDLCreateUser($tmpdolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
if ($result > 0)
{