Cleanup and comments

This commit is contained in:
Albert Santoni 2015-02-17 12:13:37 -05:00
parent ad5536dedd
commit e603597101
3 changed files with 15 additions and 12 deletions

View File

@ -34,9 +34,11 @@ require_once __DIR__.'/modules/rest/controllers/MediaController.php';
require_once (APPLICATION_PATH."/logging/Logging.php"); require_once (APPLICATION_PATH."/logging/Logging.php");
Logging::setLogPath('/var/log/airtime/zendphp.log'); Logging::setLogPath('/var/log/airtime/zendphp.log');
if (strpos("/provisioning/create-database", $_SERVER["REDIRECT_URL"]) !== false) { // We need to manually route because we can't load Zend without the database being initialized first.
(new ProvisioningHelper($CC_CONFIG["apiKey"][0]))->createDatabaseAction(); if (strpos("/provisioning/create", $_SERVER["REDIRECT_URL"]) !== false) {
die; $provisioningHelper = new ProvisioningHelper($CC_CONFIG["apiKey"][0]);
$provisioningHelper->createAction();
die();
} }
Config::setAirtimeVersion(); Config::setAirtimeVersion();

View File

@ -19,18 +19,12 @@ class ProvisioningHelper {
} }
/** /**
* Endpoint for setting up and installing the Airtime database * Endpoint for setting up and installing the Airtime database. This all has to be done without Zend
* which is why the code looks so old school (eg. http_response_code).
*/ */
public function createDatabaseAction() { public function createAction() {
Logging::info("Create Database action received");
$this->getParams(); $this->getParams();
Logging::info("Parameters: "
. "\nUser: " . $this->dbuser
. "\nPass: " . $this->dbpass
. "\nName: " . $this->dbname
. "\nHost: " . $this->dbhost
. "\nOwner: " . $this->dbowner);
$apikey = $_SERVER['PHP_AUTH_USER']; $apikey = $_SERVER['PHP_AUTH_USER'];
if (!isset($apikey) || $apikey != $this->apikey) { if (!isset($apikey) || $apikey != $this->apikey) {

View File

@ -11,6 +11,13 @@ class ProvisioningController extends Zend_Controller_Action
{ {
} }
/**
*
* The "create action" is in ProvisioningHelper because it needs to have no dependency on Zend,
* since when we bootstrap Zend, we already need the database set up and working (Bootstrap.php is a mess).
*
*/
/** /**
* Delete the Airtime Pro station's files from Amazon S3 * Delete the Airtime Pro station's files from Amazon S3
*/ */