made setup script compatible with postgres
This commit is contained in:
parent
a0b9470dcb
commit
fac80cf79d
24
db/qq/QI.php
24
db/qq/QI.php
@ -6,9 +6,21 @@ class QI {
|
|||||||
$dbinfo = \SYSTEM\system::getSystemDBInfo();}
|
$dbinfo = \SYSTEM\system::getSystemDBInfo();}
|
||||||
|
|
||||||
if($dbinfo instanceof \SYSTEM\DB\DBInfoPG){
|
if($dbinfo instanceof \SYSTEM\DB\DBInfoPG){
|
||||||
$files = static::files_pg();
|
$files = static::files_pgsql();
|
||||||
|
$command = 'psql'.
|
||||||
|
' -U ' . $dbinfo->m_user.
|
||||||
|
' -d ' . $dbinfo->m_database.
|
||||||
|
' -a '.
|
||||||
|
' -f ${file} 2>&1';
|
||||||
} else if ($dbinfo instanceof \SYSTEM\DB\DBInfoMYS){
|
} else if ($dbinfo instanceof \SYSTEM\DB\DBInfoMYS){
|
||||||
$files = static::files_mysql();
|
$files = static::files_mysql();
|
||||||
|
$command = 'mysql'.
|
||||||
|
' --host=' . $dbinfo->m_host.
|
||||||
|
' --user=' . $dbinfo->m_user.
|
||||||
|
' --password=' . $dbinfo->m_password.
|
||||||
|
' --database=' . $dbinfo->m_database.
|
||||||
|
' --default-character-set=utf8'.
|
||||||
|
' --execute="SOURCE ${file}" 2>&1';
|
||||||
} else if ($dbinfo instanceof \SYSTEM\DB\DBInfoAMQP){
|
} else if ($dbinfo instanceof \SYSTEM\DB\DBInfoAMQP){
|
||||||
$files = static::files_amqp();
|
$files = static::files_amqp();
|
||||||
} else if ($dbinfo instanceof \SYSTEM\DB\DBInfoSQLite){
|
} else if ($dbinfo instanceof \SYSTEM\DB\DBInfoSQLite){
|
||||||
@ -16,16 +28,10 @@ class QI {
|
|||||||
} else {
|
} else {
|
||||||
throw new \Exception(static::get_class().' Could not understand Database Settings. Check ur Database Settings');}
|
throw new \Exception(static::get_class().' Could not understand Database Settings. Check ur Database Settings');}
|
||||||
|
|
||||||
$command = 'mysql'.
|
|
||||||
' --host=' . $dbinfo->m_host.
|
|
||||||
' --user=' . $dbinfo->m_user.
|
|
||||||
' --password=' . $dbinfo->m_password.
|
|
||||||
' --database=' . $dbinfo->m_database.
|
|
||||||
' --default-character-set=utf8'.
|
|
||||||
' --execute="SOURCE ';
|
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach($files as $file){
|
foreach($files as $file){
|
||||||
$output = shell_exec($command .$file. '" 2>&1');
|
$output = shell_exec(str_replace('${file}', $file, $command));
|
||||||
$result[] = array($file,$output);}
|
$result[] = array($file,$output);}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user