mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Result of merge
This commit is contained in:
@@ -297,7 +297,7 @@ include "root.php";
|
|||||||
protected function create_database_pgsql() {
|
protected function create_database_pgsql() {
|
||||||
if ($this->db_create) {
|
if ($this->db_create) {
|
||||||
//Attempt to create new PG role and database
|
//Attempt to create new PG role and database
|
||||||
$this->write_progress("\tCreating database");
|
$this->write_progress("\tCreating database");
|
||||||
try {
|
try {
|
||||||
if (strlen($this->db_port) == 0) { $this->db_port = "5432"; }
|
if (strlen($this->db_port) == 0) { $this->db_port = "5432"; }
|
||||||
if (strlen($this->db_host) > 0) {
|
if (strlen($this->db_host) > 0) {
|
||||||
@@ -347,18 +347,14 @@ include "root.php";
|
|||||||
$schema->sql();
|
$schema->sql();
|
||||||
$schema->exec();
|
$schema->exec();
|
||||||
|
|
||||||
//if $this->db_create_username provided, attempt to create new PG role and database
|
//get the contents of the sql file
|
||||||
if (strlen($this->db_create_username) > 0) {
|
if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql')){
|
||||||
try {
|
$filename = "/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql";
|
||||||
if (strlen($this->db_port) == 0) { $this->db_port = "5432"; }
|
}
|
||||||
if (strlen($this->db_host) > 0) {
|
else {
|
||||||
$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");
|
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/pgsql.sql';
|
||||||
} else {
|
}
|
||||||
$this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={$this->db_create_username} password={$this->db_create_password} dbname=template1");
|
$file_contents = file_get_contents($filename);
|
||||||
}
|
|
||||||
} catch (PDOException $error) {
|
|
||||||
throw new Exception("error connecting to database: " . $error->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
//replace \r\n with \n then explode on \n
|
//replace \r\n with \n then explode on \n
|
||||||
$file_contents = str_replace("\r\n", "\n", $file_contents);
|
$file_contents = str_replace("\r\n", "\n", $file_contents);
|
||||||
|
|||||||
Reference in New Issue
Block a user