Fix: Quelques bugs dans l'install
This commit is contained in:
parent
6ae407113d
commit
80686cfd5c
@ -34,6 +34,7 @@ $langs->setDefaultLang($setuplang);
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("install");
|
||||
$langs->load("errors");
|
||||
|
||||
$error = 0;
|
||||
|
||||
@ -82,36 +83,45 @@ if (! isset($_POST["db_name"]) || ! $_POST["db_name"])
|
||||
|
||||
|
||||
/**
|
||||
* Si l'utilisateur n'est pas déjà créé, on se connecte à l'aide du login root'
|
||||
* Tentative de connexion a la base
|
||||
*/
|
||||
if (! $error)
|
||||
{
|
||||
require_once($main_dir."/lib/databases/".$_POST["db_type"].".lib.php");
|
||||
if (isset($_POST["db_create_user"]) && $_POST["db_create_user"] == "on")
|
||||
{
|
||||
$databasefortest=$conf->db->name;
|
||||
if ($_POST["db_type"] == 'mysql' ||$_POST["db_type"] == 'mysqli')
|
||||
{
|
||||
$databasefortest='mysql';
|
||||
}
|
||||
elseif ($_POST["db_type"] == 'pgsql')
|
||||
{
|
||||
$databasefortest='postgres';
|
||||
$result=include_once($main_dir."/lib/databases/".$_POST["db_type"].".lib.php");
|
||||
if ($result)
|
||||
{
|
||||
if (isset($_POST["db_create_user"]) && $_POST["db_create_user"] == "on")
|
||||
{
|
||||
$databasefortest=$conf->db->name;
|
||||
if ($_POST["db_type"] == 'mysql' ||$_POST["db_type"] == 'mysqli')
|
||||
{
|
||||
$databasefortest='mysql';
|
||||
}
|
||||
elseif ($_POST["db_type"] == 'pgsql')
|
||||
{
|
||||
$databasefortest='postgres';
|
||||
}
|
||||
else
|
||||
{
|
||||
$databasefortest='mssql';
|
||||
}
|
||||
$db = new DoliDb($_POST["db_type"],$_POST["db_host"],$userroot,$passroot,$databasefortest);
|
||||
}
|
||||
else
|
||||
{
|
||||
$databasefortest='mssql';
|
||||
{
|
||||
$db = new DoliDb($_POST["db_type"],$_POST["db_host"],$_POST["db_user"],$_POST["db_pass"],$_POST["db_name"]);
|
||||
}
|
||||
if ($db->error)
|
||||
{
|
||||
print '<div class="error">'.$db->error.'</div>';
|
||||
$error++;
|
||||
}
|
||||
$db = new DoliDb($_POST["db_type"],$_POST["db_host"],$userroot,$passroot,$databasefortest);
|
||||
}
|
||||
else
|
||||
{
|
||||
$db = new DoliDb($_POST["db_type"],$_POST["db_host"],$_POST["db_user"],$_POST["db_pass"],$_POST["db_name"]);
|
||||
}
|
||||
if ($db->error)
|
||||
{
|
||||
print '<div class="error">'.$db->error.'</div>';
|
||||
$error++;
|
||||
print "<br>\nFailed to include_once(\"".$main_dir."/lib/databases/".$_POST["db_type"].".lib.php\")<br>\n";
|
||||
print '<div class="error">'.$langs->trans("ErrorWrongValueForParameter",$langs->transnoentities("WebPagesDirectory")).'</div>';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -210,14 +210,14 @@ while (($file = readdir($handle))!==false)
|
||||
if ($type=='mysql') { $versionbasemin=array(3,1,0); $testfunction='mysql_connect'; }
|
||||
if ($type=='mysqli') { $versionbasemin=array(4,1,0); $testfunction='mysqli_connect'; }
|
||||
if ($type=='pgsql') { $versionbasemin=array(8,1,0); $testfunction='pg_connect'; }
|
||||
if ($type=='mssql') { $versionbasemin=array(2000); $testfunction='mssql_connect'; }
|
||||
if ($type=='mssql') { $versionbasemin=array(2000); $testfunction='mssql_connect'; }
|
||||
|
||||
// Remarques
|
||||
$note='';
|
||||
if ($type=='mysql') $note='(Mysql >= '.versiontostring($versionbasemin).')';
|
||||
if ($type=='mysqli') $note='(Mysql >= '.versiontostring($versionbasemin).')';
|
||||
if ($type=='pgsql') $note='(Postgresql >= '.versiontostring($versionbasemin).') '.$langs->trans("Experimental");
|
||||
if ($type=='mssql') $note='(SQL Server >= '.versiontostring($versionbasemin).') '.$langs->trans("Experimental");
|
||||
if ($type=='pgsql') $note='(Postgresql >= '.versiontostring($versionbasemin).')';
|
||||
if ($type=='mssql') $note='(SQL Server >= '.versiontostring($versionbasemin).')';
|
||||
|
||||
// Affiche ligne dans liste
|
||||
$option.='<option value="'.$type.'" '.($defaultype==$type?" selected":"");
|
||||
@ -225,7 +225,11 @@ while (($file = readdir($handle))!==false)
|
||||
$option.='>';
|
||||
$option.=$type.' ';
|
||||
if ($note) $option.=' '.$note;
|
||||
if (! function_exists($testfunction)) $option.=' - '.$langs->trans("FunctionNotAvailableInThisPHP");
|
||||
// Experimental
|
||||
if ($type=='pgsql') $option.=' '.$langs->trans("Experimental");
|
||||
elseif ($type=='mssql') $option.=' '.$langs->trans("Experimental");
|
||||
// No available
|
||||
elseif (! function_exists($testfunction)) $option.=' - '.$langs->trans("FunctionNotAvailableInThisPHP");
|
||||
$option.='</option>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,25 +38,48 @@ if (isset($_SERVER["DOCUMENT_URI"]) && $_SERVER["DOCUMENT_URI"])
|
||||
$_SERVER["PHP_SELF"]=$_SERVER["DOCUMENT_URI"];
|
||||
}
|
||||
|
||||
|
||||
$includeconferror='';
|
||||
$conffile = "../conf/conf.php";
|
||||
$charset="ISO-8859-1";
|
||||
if (file_exists($conffile))
|
||||
if (! defined('DONOTLOADCONF') && file_exists($conffile))
|
||||
{
|
||||
include_once($conffile); // Fichier conf chargé
|
||||
$result=include_once($conffile); // Load conf file
|
||||
if ($result)
|
||||
{
|
||||
// Remove last / or \ on directories or url value
|
||||
if (! empty($dolibarr_main_document_root) && ! ereg('^[\\\/]+$',$dolibarr_main_document_root)) $dolibarr_main_document_root=ereg_replace('[\\\/]+$','',$dolibarr_main_document_root);
|
||||
if (! empty($dolibarr_main_url_root) && ! ereg('^[\\\/]+$',$dolibarr_main_url_root)) $dolibarr_main_url_root=ereg_replace('[\\\/]+$','',$dolibarr_main_url_root);
|
||||
if (! empty($dolibarr_main_data_root) && ! ereg('^[\\\/]+$',$dolibarr_main_data_root)) $dolibarr_main_data_root=ereg_replace('[\\\/]+$','',$dolibarr_main_data_root);
|
||||
|
||||
// Remove last / or \ on directories or url value
|
||||
if (isset($dolibarr_main_document_root) && ! ereg('^[\\\/]+$',$dolibarr_main_document_root)) $dolibarr_main_document_root=ereg_replace('[\\\/]+$','',$dolibarr_main_document_root);
|
||||
if (isset($dolibarr_main_url_root) && ! ereg('^[\\\/]+$',$dolibarr_main_url_root)) $dolibarr_main_url_root=ereg_replace('[\\\/]+$','',$dolibarr_main_url_root);
|
||||
if (isset($dolibarr_main_data_root) && ! ereg('^[\\\/]+$',$dolibarr_main_data_root)) $dolibarr_main_data_root=ereg_replace('[\\\/]+$','',$dolibarr_main_data_root);
|
||||
|
||||
if (isset($dolibarr_main_document_root) && $dolibarr_main_document_root)
|
||||
{
|
||||
conf($dolibarr_main_document_root);
|
||||
// Create conf object
|
||||
if (! empty($dolibarr_main_document_root))
|
||||
{
|
||||
$result=conf($dolibarr_main_document_root);
|
||||
}
|
||||
// Load database driver
|
||||
if ($result)
|
||||
{
|
||||
if (! empty($dolibarr_main_document_root) && ! empty($dolibarr_main_db_type))
|
||||
{
|
||||
$result=include_once($dolibarr_main_document_root . "/lib/databases/".$dolibarr_main_db_type.".lib.php");
|
||||
if ($result)
|
||||
{
|
||||
// OK
|
||||
}
|
||||
else
|
||||
{
|
||||
$includeconferror='ErrorBadValueForDolibarrMainDBType';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$includeconferror='ErrorBadValueForDolibarrMainDocumentRoot';
|
||||
}
|
||||
}
|
||||
if (isset($dolibarr_main_document_root) && $dolibarr_main_document_root && $dolibarr_main_db_type && ! defined('DONOTLOADCONF'))
|
||||
else
|
||||
{
|
||||
require_once($dolibarr_main_document_root . "/lib/databases/".$dolibarr_main_db_type.".lib.php");
|
||||
$includeconferror='ErrorBadFormatForConfFile';
|
||||
}
|
||||
}
|
||||
if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user