mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-02-21 18:36:31 +00:00
Merge remote-tracking branch 'remotes/fusionpbx/master' into Enhance_Install
Conflicts: core/install/resources/classes/install_fusionpbx.php
This commit is contained in:
@@ -347,14 +347,18 @@ include "root.php";
|
||||
$schema->sql();
|
||||
$schema->exec();
|
||||
|
||||
//get the contents of the sql file
|
||||
if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql')){
|
||||
$filename = "/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql";
|
||||
}
|
||||
else {
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/pgsql.sql';
|
||||
}
|
||||
$file_contents = file_get_contents($filename);
|
||||
//if $this->db_create_username provided, attempt to create new PG role and database
|
||||
if (strlen($this->db_create_username) > 0) {
|
||||
try {
|
||||
if (strlen($this->db_port) == 0) { $this->db_port = "5432"; }
|
||||
if (strlen($this->db_host) > 0) {
|
||||
$this->dbh = new PDO("pgsql:host={$this->db_host} port={$this->db_port} user={$this->db_create_username} password={$this->db_create_password} dbname=template1");
|
||||
} else {
|
||||
$this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={$this->db_create_username} password={$this->db_create_password} dbname=template1");
|
||||
}
|
||||
} catch (PDOException $error) {
|
||||
throw new Exception("error connecting to database: " . $error->getMessage());
|
||||
}
|
||||
|
||||
//replace \r\n with \n then explode on \n
|
||||
$file_contents = str_replace("\r\n", "\n", $file_contents);
|
||||
|
||||
Reference in New Issue
Block a user