Change to support more databases
This commit is contained in:
parent
154da1aee0
commit
839e0f8ba0
@ -125,7 +125,7 @@ if (! $error)
|
|||||||
$databasefortest=$_POST["db_name"];
|
$databasefortest=$_POST["db_name"];
|
||||||
if (! empty($_POST["db_create_database"]))
|
if (! empty($_POST["db_create_database"]))
|
||||||
{
|
{
|
||||||
if ($_POST["db_type"] == 'mysql' ||$_POST["db_type"] == 'mysqli')
|
if ($_POST["db_type"] == 'mysql' || $_POST["db_type"] == 'mysqli')
|
||||||
{
|
{
|
||||||
$databasefortest='mysql';
|
$databasefortest='mysql';
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ if (! $error && $db->connected)
|
|||||||
{
|
{
|
||||||
// We keep only utf8 and iso
|
// We keep only utf8 and iso
|
||||||
$linedisabled=false;
|
$linedisabled=false;
|
||||||
if (! eregi('(utf8|latin1)',$characterSet['charset'])) $linedisabled=true;
|
if (($_POST["db_type"] == 'mysql' ||$_POST["db_type"] == 'mysqli') && ! eregi('(utf8|latin1)',$characterSet['charset'])) $linedisabled=true;
|
||||||
|
|
||||||
if ($defaultCharacterSet == $characterSet['charset'] )
|
if ($defaultCharacterSet == $characterSet['charset'] )
|
||||||
{
|
{
|
||||||
@ -298,7 +298,7 @@ if (! $error && $db->connected)
|
|||||||
{
|
{
|
||||||
// We keep only utf8 and iso
|
// We keep only utf8 and iso
|
||||||
$linedisabled=false;
|
$linedisabled=false;
|
||||||
if (! eregi('(utf8_general|latin1_swedish)',$collation['collation'])) $linedisabled=true;
|
if (($_POST["db_type"] == 'mysql' ||$_POST["db_type"] == 'mysqli') && ! eregi('(utf8_general|latin1_swedish)',$collation['collation'])) $linedisabled=true;
|
||||||
|
|
||||||
if ($defaultCollationConnection == $collation['collation'])
|
if ($defaultCollationConnection == $collation['collation'])
|
||||||
{
|
{
|
||||||
|
|||||||
@ -321,7 +321,7 @@ if ($_POST["action"] == "set")
|
|||||||
|
|
||||||
if ($db->connected)
|
if ($db->connected)
|
||||||
{
|
{
|
||||||
if ($db->DDLCreateDb($dolibarr_main_db_name, $dolibarr_main_db_character_set, $dolibarr_main_db_collation))
|
if ($db->DDLCreateDb($dolibarr_main_db_name, $dolibarr_main_db_character_set, $dolibarr_main_db_collation, $dolibarr_main_db_user))
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $langs->trans("DatabaseCreation").' : ';
|
print $langs->trans("DatabaseCreation").' : ';
|
||||||
@ -378,7 +378,7 @@ if ($_POST["action"] == "set")
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On test maintenant l'acc<EFBFBD>s par le user admin dolibarr
|
* On test maintenant l'acces par le user admin dolibarr
|
||||||
*/
|
*/
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -749,11 +749,12 @@ class DoliDb
|
|||||||
* \param database Database name to create
|
* \param database Database name to create
|
||||||
* \param charset Charset used to store data
|
* \param charset Charset used to store data
|
||||||
* \param collation Charset used to sort data
|
* \param collation Charset used to sort data
|
||||||
* \return resource resource defined if OK, null if KO
|
* \param owner Username of database owner
|
||||||
|
* \return resource resource defined if OK, null if KO
|
||||||
* \remarks Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
|
* \remarks Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
|
||||||
* We force to create database with charset this->forcecharset and collate this->forcecollate
|
* We force to create database with charset this->forcecharset and collate this->forcecollate
|
||||||
*/
|
*/
|
||||||
function DDLCreateDb($database,$charset='',$collation='')
|
function DDLCreateDb($database,$charset='',$collation='',$owner='')
|
||||||
{
|
{
|
||||||
if (empty($charset)) $charset=$this->forcecharset;
|
if (empty($charset)) $charset=$this->forcecharset;
|
||||||
if (empty($collation)) $collation=$this->collation;
|
if (empty($collation)) $collation=$this->collation;
|
||||||
@ -963,12 +964,12 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Create a user
|
* \brief Create a user and privileges to connect to database (even if database does not exists yet)
|
||||||
* \param dolibarr_main_db_host Ip serveur
|
* \param dolibarr_main_db_host Ip server
|
||||||
* \param dolibarr_main_db_user Nom user a creer
|
* \param dolibarr_main_db_user Username to create
|
||||||
* \param dolibarr_main_db_pass Mot de passe user a creer
|
* \param dolibarr_main_db_pass Password
|
||||||
* \param dolibarr_main_db_name Database name where user must be granted
|
* \param dolibarr_main_db_name Database name where user must be granted
|
||||||
* \return int <0 si KO, >=0 si OK
|
* \return int <0 if KO, >=0 if OK
|
||||||
*/
|
*/
|
||||||
function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name)
|
function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -761,11 +761,12 @@ class DoliDb
|
|||||||
* \param database Database name to create
|
* \param database Database name to create
|
||||||
* \param charset Charset used to store data
|
* \param charset Charset used to store data
|
||||||
* \param collation Charset used to sort data
|
* \param collation Charset used to sort data
|
||||||
|
* \param owner Username of database owner
|
||||||
* \return resource resource defined if OK, null if KO
|
* \return resource resource defined if OK, null if KO
|
||||||
* \remarks Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
|
* \remarks Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
|
||||||
* We force to create database with charset this->forcecharset and collate this->forcecollate
|
* We force to create database with charset this->forcecharset and collate this->forcecollate
|
||||||
*/
|
*/
|
||||||
function DDLCreateDb($database,$charset='',$collation='')
|
function DDLCreateDb($database,$charset='',$collation='',$owner='')
|
||||||
{
|
{
|
||||||
if (empty($charset)) $charset=$this->forcecharset;
|
if (empty($charset)) $charset=$this->forcecharset;
|
||||||
if (empty($collation)) $collation=$this->collation;
|
if (empty($collation)) $collation=$this->collation;
|
||||||
@ -976,12 +977,12 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Create a user
|
* \brief Create a user and privileges to connect to database (even if database does not exists yet)
|
||||||
* \param dolibarr_main_db_host Ip serveur
|
* \param dolibarr_main_db_host Ip server
|
||||||
* \param dolibarr_main_db_user Nom user a creer
|
* \param dolibarr_main_db_user Username to create
|
||||||
* \param dolibarr_main_db_pass Mot de passe user a creer
|
* \param dolibarr_main_db_pass Password
|
||||||
* \param dolibarr_main_db_name Database name where user must be granted
|
* \param dolibarr_main_db_name Database name where user must be granted
|
||||||
* \return int <0 si KO, >=0 si OK
|
* \return int <0 if KO, >=0 if OK
|
||||||
*/
|
*/
|
||||||
function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name)
|
function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name)
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user