Made provisioning helper slightly more robust

This commit is contained in:
Duncan Sommerville 2015-03-03 15:29:34 -05:00
parent 52813045a6
commit 95db8533b5
2 changed files with 17 additions and 14 deletions

View File

@ -36,7 +36,7 @@ require_once (APPLICATION_PATH."/logging/Logging.php");
Logging::setLogPath('/var/log/airtime/zendphp.log'); Logging::setLogPath('/var/log/airtime/zendphp.log');
// We need to manually route because we can't load Zend without the database being initialized first. // We need to manually route because we can't load Zend without the database being initialized first.
if (array_key_exists("REQUEST_URI", $_SERVER) && (strpos($_SERVER["REQUEST_URI"], "/provisioning/create") !== false)) { if (array_key_exists("REQUEST_URI", $_SERVER) && (stripos($_SERVER["REQUEST_URI"], "/provisioning/create") !== false)) {
$provisioningHelper = new ProvisioningHelper($CC_CONFIG["apiKey"][0]); $provisioningHelper = new ProvisioningHelper($CC_CONFIG["apiKey"][0]);
$provisioningHelper->createAction(); $provisioningHelper->createAction();
die(); die();

View File

@ -37,6 +37,7 @@ class ProvisioningHelper
$this->parsePostParams(); $this->parsePostParams();
//For security, the Airtime Pro provisioning system creates the database for the user. //For security, the Airtime Pro provisioning system creates the database for the user.
if ($this->dbhost && !empty($this->dbhost)) {
$this->setNewDatabaseConnection(); $this->setNewDatabaseConnection();
//if ($this->checkDatabaseExists()) { //if ($this->checkDatabaseExists()) {
@ -53,12 +54,14 @@ class ProvisioningHelper
throw new Exception("ERROR: airtime tables already exists"); throw new Exception("ERROR: airtime tables already exists");
} }
$this->createDatabaseTables();
$this->initializeMusicDirsTable($this->instanceId);
}
//$this->createDatabase(); //$this->createDatabase();
//All we need to do is create the database tables. //All we need to do is create the database tables.
$this->createDatabaseTables();
$this->initializeMusicDirsTable($this->instanceId);
$this->initializePrefs(); $this->initializePrefs();
} catch (Exception $e) { } catch (Exception $e) {
http_response_code(400); http_response_code(400);