From bfd03697a80a1c6478e88a0caf8e0f43fcbf1c0d Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Tue, 1 Dec 2015 16:29:14 +0000 Subject: [PATCH] Deal with create_username don't create the db_username if it is the same as the db_create_username --- core/install/resources/classes/install_fusionpbx.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 19bcf70eef..c0a7c22d7b 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -313,11 +313,13 @@ include "root.php"; if($this->dbh->exec("CREATE DATABASE {$this->db_name}") === false) { throw new Exception("Failed to create database {$this->db_name}: " . join(":", $this->dbh->errorInfo())); } - if($this->dbh->exec("CREATE USER {$this->db_username} WITH PASSWORD '{$this->db_password}'") === false){ - throw new Exception("Failed to create user {$this->db_name}: " . join(":", $this->dbh->errorInfo())); - } - if($this->dbh->exec("GRANT ALL ON {$this->db_name} TO {$this->db_username}") === false){ - throw new Exception("Failed to create user {$this->db_name}: " . join(":", $this->dbh->errorInfo())); + if($this->db_username != $this->db_create_username){ + if($this->dbh->exec("CREATE USER {$this->db_username} WITH PASSWORD '{$this->db_password}'") === false){ + throw new Exception("Failed to create user {$this->db_name}: " . join(":", $this->dbh->errorInfo())); + } + if($this->dbh->exec("GRANT ALL ON {$this->db_name} TO {$this->db_username}") === false){ + throw new Exception("Failed to create user {$this->db_name}: " . join(":", $this->dbh->errorInfo())); + } } //close database connection_aborted