reloading config after ini values are changed

This commit is contained in:
Naomi 2011-04-18 15:28:48 -04:00
parent 2c7bf676a3
commit 9e96ec9da4
4 changed files with 31 additions and 3 deletions

View File

@ -86,4 +86,30 @@ set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath']
function load_airtime_config(){
$ini_array = parse_ini_file('/etc/airtime/airtime.conf', true);
return $ini_array;
}
class Config {
public static function reload_config() {
global $CC_CONFIG;
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
// Name of the web server user
$CC_CONFIG['webServerUser'] = $values['general']['web_server_user'];
$CC_CONFIG['rabbitmq'] = $values['rabbitmq'];
$CC_CONFIG['baseFilesDir'] = $values['general']['base_files_dir'];
// main directory for storing binary media files
$CC_CONFIG['storageDir'] = $values['general']['base_files_dir']."/stor";
// Database config
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
$CC_CONFIG['dsn']['hostspec'] = $values['database']['host'];
$CC_CONFIG['dsn']['database'] = $values['database']['dbname'];
$CC_CONFIG['apiKey'] = array($values['general']['api_key']);
$CC_CONFIG['soundcloud-connection-retries'] = $values['soundcloud']['connection_retries'];
$CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_retries'];
}
}

View File

@ -84,7 +84,7 @@ AirtimeInstall::InstallStorageDirectory();
AirtimeInstall::ChangeDirOwnerToWebserver($CC_CONFIG["storageDir"]);
AirtimeInstall::CreateSymlinksToUtils($CC_CONFIG["storageDir"]);
AirtimeInstall::CreateSymlinksToUtils();
echo PHP_EOL."*** Pypo Installation ***".PHP_EOL;
system("python ".__DIR__."/../python_apps/pypo/install/pypo-install.py");

View File

@ -1,7 +1,6 @@
<?php
/**
* @package Newscoop
* @subpackage Subscriptions
* @package Airtime
* @copyright 2011 Sourcefabric o.p.s.
* @license http://www.gnu.org/licenses/gpl-3.0.txt
*/

View File

@ -61,6 +61,9 @@ AirtimeInstall::InstallBinaries();
echo "* Initializing INI files".PHP_EOL;
AirtimeIni::UpdateIniFiles();
Config::reload_config();
echo "* Creating default storage directory".PHP_EOL;
AirtimeInstall::InstallStorageDirectory();
AirtimeInstall::ChangeDirOwnerToWebserver($CC_CONFIG["storageDir"]);
AirtimeInstall::CreateSymlinksToUtils();