Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2017-02-21 07:31:33 +01:00
commit f6786406ef
2 changed files with 18 additions and 1 deletions

View File

@ -37,6 +37,10 @@ if (!file_exists("create_tables-sqlite3.sql")) {
echo "Can't install SeedDMS, 'create_tables-sqlite3.sql' missing";
exit;
}
if (!file_exists("create_tables-postgres.sql")) {
echo "Can't install SeedDMS, 'create_tables-postgres.sql' missing";
exit;
}
if (!file_exists("settings.xml.template_install")) {
echo "Can't install SeedDMS, 'settings.xml.template_install' missing";
exit;
@ -50,6 +54,7 @@ function openDBConnection($settings) { /* {{{ */
case 'mysql':
case 'mysqli':
case 'mysqlnd':
case 'pgsql':
$tmp = explode(":", $settings->_dbHostname);
$dsn = $settings->_dbDriver.":dbname=".$settings->_dbDatabase.";host=".$tmp[0];
if(isset($tmp[1]))
@ -297,6 +302,8 @@ if ($action=="setSettings") {
$queries = file_get_contents("create_tables-innodb.sql");
elseif($settings->_dbDriver=="sqlite")
$queries = file_get_contents("create_tables-sqlite3.sql");
elseif($settings->_dbDriver=="pgsql")
$queries = file_get_contents("create_tables-postgres.sql");
else
die();

View File

@ -49,13 +49,23 @@ switch($settings->_dbDriver) {
case 'mysql':
case 'mysqli':
case 'mysqlnd':
$dsn = $settings->_dbDriver.":dbname=".$settings->_dbDatabase.";host=".$settings->_dbHostname;
$tmp = explode(":", $settings->_dbHostname);
$dsn = $settings->_dbDriver.":dbname=".$settings->_dbDatabase.";host=".$tmp[0];
if(isset($tmp[1]))
$dsn .= ";port=".$tmp[1];
break;
case 'sqlite':
$dsn = $settings->_dbDriver.":".$settings->_dbDatabase;
if(file_exists('update-'.$_GET['version'].'/update-sqlite3.sql'))
$sqlfile = "update-sqlite3.sql";
break;
case 'pgsql':
$tmp = explode(":", $settings->_dbHostname);
$dsn = $settings->_dbDriver.":dbname=".$settings->_dbDatabase.";host=".$tmp[0];
if(isset($tmp[1]))
$dsn .= ";port=".$tmp[1];
if(file_exists('update-'.$_GET['version'].'/update-postgres.sql'))
$sqlfile = "update-postgres.sql";
}
$db = new PDO($dsn, $settings->_dbUser, $settings->_dbPass);
if (!$db) {