diff --git a/application/configs/conf.php b/application/configs/conf.php index b4c3a9160..41f5aea4c 100644 --- a/application/configs/conf.php +++ b/application/configs/conf.php @@ -1,12 +1,4 @@ 'www-data', + 'webServerUser' => $values['general']['webServerUser'], - 'rabbitmq' => array("host" => "127.0.0.1", - "port" => "5672", - "user" => "guest", - "password" => "guest", - "vhost" => "/"), - - // *********************************************************************** - // STOP CUSTOMIZING HERE - // - // You don't need to touch anything below this point. - // *********************************************************************** + 'rabbitmq' => $values['rabbitmq'], 'baseFilesDir' => $baseFilesDir, // main directory for storing binary media files 'storageDir' => "$baseFilesDir/stor", // Database config - 'dsn' => $values['database'], + 'dsn' => array( + 'username' => $values['database']['dbuser'], + 'password' => $values['database']['dbpass'], + 'hostspec' => $values['database']['host'], + 'phptype' => 'pgsql', + 'database' => $values['database']['dbname']), // prefix for table names in the database 'tblNamePrefix' => 'cc_', /* ================================================ storage configuration */ - 'apiKey' => $values['api_key'], + 'apiKey' => array($values['general']['api_key']), 'apiPath' => '/api/', 'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A', @@ -90,8 +90,9 @@ set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath'] .PATH_SEPARATOR.$old_include_path); function load_airtime_config(){ - $ini_array = parse_ini_file(dirname(__FILE__).'/../../build/airtime.conf', true); - + $ini_array = parse_ini_file('/etc/airtime/airtime.conf', true); + return $ini_array; + /* return array( 'database' => array( 'username' => $ini_array['database']['dbuser'], @@ -101,4 +102,5 @@ function load_airtime_config(){ 'database' => $ini_array['database']['dbname']), 'api_key' => array($ini_array['general']['api_key']) ); + */ } diff --git a/build/airtime.conf b/build/airtime.conf index e72855457..97c9e8147 100644 --- a/build/airtime.conf +++ b/build/airtime.conf @@ -4,6 +4,13 @@ dbname = airtime dbuser = airtime dbpass = airtime +[rabbitmq] +host = 127.0.0.1 +port = 5672 +user = guest +password = guest +vhost = / + [general] api_key = AAA - +webServerUser = www-data diff --git a/install/airtime-install.php b/install/airtime-install.php index a0428878c..0fa541db3 100644 --- a/install/airtime-install.php +++ b/install/airtime-install.php @@ -5,21 +5,16 @@ * @license http://www.gnu.org/licenses/gpl.txt */ -// Do not allow remote execution -$arr = array_diff_assoc($_SERVER, $_ENV); -if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) { - header("HTTP/1.1 400"); - header("Content-type: text/plain; charset=UTF-8"); - echo "400 Not executable\r\n"; - exit(1); -} - -require_once(dirname(__FILE__).'/../application/configs/conf.php'); -require_once(dirname(__FILE__).'/installInit.php'); - echo "******************************** Install Begin *********************************".PHP_EOL; -AirtimeInstall::ExitIfNotRoot(); +require_once(dirname(__FILE__).'/include/installInit.php'); + +ExitIfNotRoot(); +CreateINIFile(); + +require_once(dirname(__FILE__).'/../application/configs/conf.php'); +require_once(dirname(__FILE__).'/include/AirtimeInstall.php'); + AirtimeInstall::CreateApiKey(); AirtimeInstall::UpdateIniValue('../build/build.properties', 'project.home', realpath(__dir__.'/../')); diff --git a/install/airtime-uninstall.php b/install/airtime-uninstall.php index 5b9a58c3a..b82a79f07 100644 --- a/install/airtime-uninstall.php +++ b/install/airtime-uninstall.php @@ -5,20 +5,13 @@ * @license http://www.gnu.org/licenses/gpl.txt */ -// Do not allow remote execution. -$arr = array_diff_assoc($_SERVER, $_ENV); -if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) { - header("HTTP/1.1 400"); - header("Content-type: text/plain; charset=UTF-8"); - echo "400 Not executable".PHP_EOL; - exit; -} +require_once(dirname(__FILE__).'/include/installInit.php'); +// Need to check that we are superuser before running this. +ExitIfNotRoot(); require_once(dirname(__FILE__).'/../application/configs/conf.php'); -require_once(dirname(__FILE__).'/installInit.php'); +require_once(dirname(__FILE__).'/include/AirtimeInstall.php'); -// Need to check that we are superuser before running this. -AirtimeInstall::ExitIfNotRoot(); AirtimeInstall::RemoveSymlinks(); @@ -80,7 +73,7 @@ if ($results == 0) { // Delete files //------------------------------------------------------------------------ AirtimeInstall::DeleteFilesRecursive($CC_CONFIG['storageDir']); - +RemoveINIFile(); $command = "python ".__DIR__."/../python_apps/pypo/install/pypo-uninstall.py"; system($command); diff --git a/install/installInit.php b/install/include/AirtimeInstall.php similarity index 85% rename from install/installInit.php rename to install/include/AirtimeInstall.php index d720daaab..5286e10fc 100644 --- a/install/installInit.php +++ b/install/include/AirtimeInstall.php @@ -1,11 +1,7 @@ propel-error.log"; + $command = __DIR__."/../../library/propel/generator/bin/propel-gen ../build/ insert-sql 2>propel-error.log"; @exec($command, $output, $results); } @@ -200,10 +187,10 @@ class AirtimeInstall { public static function CreateSymlinks(){ AirtimeInstall::RemoveSymlinks(); - $dir = realpath(__DIR__."/../utils/airtime-import"); + $dir = realpath(__DIR__."/../../utils/airtime-import"); exec("ln -s $dir /usr/bin/airtime-import"); - $dir = realpath(__DIR__."/../utils/airtime-clean-storage"); + $dir = realpath(__DIR__."/../../utils/airtime-clean-storage"); exec("ln -s $dir /usr/bin/airtime-clean-storage"); } @@ -211,6 +198,4 @@ class AirtimeInstall { exec("rm -f /usr/bin/airtime-import"); exec("rm -f /usr/bin/airtime-clean-storage"); } - - } diff --git a/install/include/installInit.php b/install/include/installInit.php new file mode 100644 index 000000000..99793c0ff --- /dev/null +++ b/install/include/installInit.php @@ -0,0 +1,56 @@ +