modified the database code to allow custom pgsql password
This commit is contained in:
parent
d58468185c
commit
b89f159fe8
|
@ -7,9 +7,9 @@
|
||||||
* Wrapper class for validating and installing the Airtime database during the installation process
|
* Wrapper class for validating and installing the Airtime database during the installation process
|
||||||
*/
|
*/
|
||||||
class DatabaseSetup extends Setup {
|
class DatabaseSetup extends Setup {
|
||||||
|
|
||||||
// airtime.conf section header
|
// airtime.conf section header
|
||||||
protected static $_settings = "[database]";
|
protected static $_section = "[database]";
|
||||||
|
|
||||||
// Constant form field names for passing errors back to the front-end
|
// Constant form field names for passing errors back to the front-end
|
||||||
const DB_USER = "dbUser",
|
const DB_USER = "dbUser",
|
||||||
|
@ -51,6 +51,7 @@ class DatabaseSetup extends Setup {
|
||||||
* @throws AirtimeDatabaseException
|
* @throws AirtimeDatabaseException
|
||||||
*/
|
*/
|
||||||
public function runSetup() {
|
public function runSetup() {
|
||||||
|
$this->writeToTemp();
|
||||||
try {
|
try {
|
||||||
$this->setNewDatabaseConnection("postgres");
|
$this->setNewDatabaseConnection("postgres");
|
||||||
if ($this->checkDatabaseExists()) {
|
if ($this->checkDatabaseExists()) {
|
||||||
|
@ -61,14 +62,11 @@ class DatabaseSetup extends Setup {
|
||||||
$this->installDatabaseTables();
|
$this->installDatabaseTables();
|
||||||
}
|
}
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
throw new AirtimeDatabaseException("Couldn't establish a connection to the database! "
|
throw new AirtimeDatabaseException("Couldn't establish a connection to the database! ".
|
||||||
. "Please check your credentials and try again. "
|
"Please check your credentials and try again. "
|
||||||
. "PDO Exception: " . $e->getMessage(),
|
. "PDO Exception: " . $e->getMessage(),
|
||||||
array(self::DB_NAME, self::DB_USER, self::DB_PASS));
|
array(self::DB_NAME, self::DB_USER, self::DB_PASS));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->writeToTemp();
|
|
||||||
|
|
||||||
self::$dbh = null;
|
self::$dbh = null;
|
||||||
return array(
|
return array(
|
||||||
"message" => "Airtime database was created successfully!",
|
"message" => "Airtime database was created successfully!",
|
||||||
|
@ -178,4 +176,4 @@ class DatabaseSetup extends Setup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ class MediaSetup extends Setup {
|
||||||
function setupMusicDirectory() {
|
function setupMusicDirectory() {
|
||||||
try {
|
try {
|
||||||
$_SERVER['AIRTIME_CONF'] = AIRTIME_CONF_TEMP_PATH;
|
$_SERVER['AIRTIME_CONF'] = AIRTIME_CONF_TEMP_PATH;
|
||||||
Propel::init(CONFIG_PATH . "airtime-conf-production.php");
|
Propel::init(AIRTIME_CONF_TEMP_PATH);
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
self::$message = "Failed to insert media folder; database isn't configured properly!";
|
self::$message = "Failed to insert media folder; database isn't configured properly!";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
define("BUILD_PATH", dirname(dirname(__DIR__)) . "/build/");
|
define("BUILD_PATH", dirname(dirname(__DIR__)) . "/build/");
|
||||||
define("AIRTIME_CONF_TEMP_PATH", "/tmp/airtime.conf.temp");
|
define("AIRTIME_CONF_TEMP_PATH", "/etc/airtime/airtime.conf.temp");
|
||||||
define("RMQ_INI_TEMP_PATH", "/tmp/rabbitmq.ini.tmp");
|
define("RMQ_INI_TEMP_PATH", "/tmp/rabbitmq.ini.tmp");
|
||||||
|
|
||||||
// load autoloader since this files is an entry path see
|
// load autoloader since this files is an entry path see
|
||||||
|
@ -37,7 +37,7 @@ abstract class Setup {
|
||||||
if (!file_exists(AIRTIME_CONF_TEMP_PATH)) {
|
if (!file_exists(AIRTIME_CONF_TEMP_PATH)) {
|
||||||
copy(BUILD_PATH . "airtime.example.conf", AIRTIME_CONF_TEMP_PATH);
|
copy(BUILD_PATH . "airtime.example.conf", AIRTIME_CONF_TEMP_PATH);
|
||||||
}
|
}
|
||||||
|
//Logging::info(AIRTIME_CONF_TEMP_PATH);
|
||||||
$this->_write(AIRTIME_CONF_TEMP_PATH);
|
$this->_write(AIRTIME_CONF_TEMP_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue