modified the database code to allow custom pgsql password

This commit is contained in:
Robb Ebright 2017-11-13 15:03:15 -05:00
parent d58468185c
commit b89f159fe8
3 changed files with 9 additions and 11 deletions

View file

@ -7,9 +7,9 @@
* Wrapper class for validating and installing the Airtime database during the installation process
*/
class DatabaseSetup extends Setup {
// airtime.conf section header
protected static $_settings = "[database]";
protected static $_section = "[database]";
// Constant form field names for passing errors back to the front-end
const DB_USER = "dbUser",
@ -51,6 +51,7 @@ class DatabaseSetup extends Setup {
* @throws AirtimeDatabaseException
*/
public function runSetup() {
$this->writeToTemp();
try {
$this->setNewDatabaseConnection("postgres");
if ($this->checkDatabaseExists()) {
@ -61,14 +62,11 @@ class DatabaseSetup extends Setup {
$this->installDatabaseTables();
}
} catch (PDOException $e) {
throw new AirtimeDatabaseException("Couldn't establish a connection to the database! "
. "Please check your credentials and try again. "
throw new AirtimeDatabaseException("Couldn't establish a connection to the database! ".
"Please check your credentials and try again. "
. "PDO Exception: " . $e->getMessage(),
array(self::DB_NAME, self::DB_USER, self::DB_PASS));
}
$this->writeToTemp();
self::$dbh = null;
return array(
"message" => "Airtime database was created successfully!",
@ -178,4 +176,4 @@ class DatabaseSetup extends Setup {
}
}
}
}