CC-4384: Remove annoying usage of $CC_CONFIG

- done
This commit is contained in:
James 2013-01-14 16:16:14 -05:00
parent a55bc9973c
commit 5a97fb69f2
30 changed files with 84 additions and 78 deletions

View File

@ -68,7 +68,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
protected function _initHeadLink()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$view = $this->getResource('view');
@ -85,7 +85,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
protected function _initHeadScript()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$view = $this->getResource('view');

View File

@ -28,6 +28,7 @@ class Config {
$CC_CONFIG['baseUrl'] = $values['general']['base_url'];
$CC_CONFIG['basePort'] = $values['general']['base_port'];
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
$CC_CONFIG['cache_ahead_hours'] = $values['general']['cache_ahead_hours'];

View File

@ -5,14 +5,6 @@
* yet available because airtime.conf hasn't been updated yet. This situation ends up throwing a lot of errors to stdout.
* airtime*/
global $CC_CONFIG;
require_once("conf.php");
$filename = "/etc/airtime/airtime.conf";
$values = parse_ini_file($filename, true);
// 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']['phptype'] = 'pgsql';
$CC_CONFIG['dsn']['database'] = $values['database']['dbname'];
$CC_CONFIG = Config::getConfig();

View File

@ -48,7 +48,7 @@ class ApiController extends Zend_Controller_Action
public function checkAuth()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$api_key = $this->_getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&

View File

@ -19,7 +19,7 @@ class AudiopreviewController extends Zend_Controller_Action
*/
public function audioPreviewAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$audioFileID = $this->_getParam('audioFileID');
$audioFileArtist = $this->_getParam('audioFileArtist');
@ -73,7 +73,7 @@ class AudiopreviewController extends Zend_Controller_Action
*/
public function playlistPreviewAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$playlistIndex = $this->_getParam('playlistIndex');
$playlistID = $this->_getParam('playlistID');
@ -99,7 +99,7 @@ class AudiopreviewController extends Zend_Controller_Action
public function blockPreviewAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$blockIndex = $this->_getParam('blockIndex');
$blockId = $this->_getParam('blockId');
@ -226,7 +226,7 @@ class AudiopreviewController extends Zend_Controller_Action
*/
public function showPreviewAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$showID = $this->_getParam('showID');
$showIndex = $this->_getParam('showIndex');

View File

@ -96,7 +96,7 @@ class DashboardController extends Zend_Controller_Action
public function streamPlayerAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();

View File

@ -25,7 +25,7 @@ class LibraryController extends Zend_Controller_Action
public function indexAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();
$baseUrl = Application_Common_OsPath::getBaseDir();

View File

@ -12,7 +12,7 @@ class ListenerstatController extends Zend_Controller_Action
public function indexAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();

View File

@ -9,7 +9,7 @@ class LoginController extends Zend_Controller_Action
public function indexAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();
@ -102,7 +102,7 @@ class LoginController extends Zend_Controller_Action
public function passwordRestoreAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();

View File

@ -12,7 +12,7 @@ class PlayouthistoryController extends Zend_Controller_Action
public function indexAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();

View File

@ -13,7 +13,7 @@ class PluploadController extends Zend_Controller_Action
public function indexAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
$locale = Application_Model_Preference::GetLocale();

View File

@ -20,7 +20,7 @@ class PreferenceController extends Zend_Controller_Action
public function indexAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
@ -80,7 +80,7 @@ class PreferenceController extends Zend_Controller_Action
public function supportSettingAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();
@ -136,7 +136,7 @@ class PreferenceController extends Zend_Controller_Action
public function directoryConfigAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
@ -153,7 +153,7 @@ class PreferenceController extends Zend_Controller_Action
public function streamSettingAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();

View File

@ -40,7 +40,7 @@ class ScheduleController extends Zend_Controller_Action
public function indexAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();

View File

@ -19,7 +19,7 @@ class ShowbuilderController extends Zend_Controller_Action
public function indexAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();

View File

@ -4,7 +4,7 @@ class SystemstatusController extends Zend_Controller_Action
{
public function init()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();

View File

@ -16,7 +16,7 @@ class UserController extends Zend_Controller_Action
public function addUserAction()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();
$baseUrl = Application_Common_OsPath::getBaseDir();

View File

@ -5,7 +5,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
public function init()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
$isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true";
@ -131,7 +131,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
public function updateVariables()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
$master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL();

View File

@ -5,7 +5,7 @@ class Application_Form_Login extends Zend_Form
public function init()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
// Set the method for the display form to POST
$this->setMethod('post');

View File

@ -15,7 +15,7 @@ class Application_Model_RabbitMq
private static function sendMessage($exchange, $data)
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
$CC_CONFIG["rabbitmq"]["port"],

View File

@ -763,7 +763,7 @@ SQL;
private static function getRangeStartAndEnd($p_fromDateTime, $p_toDateTime)
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
/* if $p_fromDateTime and $p_toDateTime function parameters are null,
then set range * from "now" to "now + 24 hours". */

View File

@ -1907,7 +1907,7 @@ SQL;
*/
public static function getCurrentShow($timeNow=null)
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$con = Propel::getConnection();
if ($timeNow == null) {
$date = new Application_Common_DateHelper;
@ -1953,7 +1953,7 @@ SQL;
*/
public static function getPrevCurrentNext($p_timeNow)
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$con = Propel::getConnection();
//
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin

View File

@ -7,7 +7,7 @@ class Application_Model_Soundcloud
public function __construct()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$this->_soundcloud = new Services_Soundcloud(
$CC_CONFIG['soundcloud-client-id'],
$CC_CONFIG['soundcloud-client-secret']);

View File

@ -504,7 +504,7 @@ SQL;
*/
public function getFileUrlUsingConfigAddress()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
if (isset($CC_CONFIG['baseUrl'])) {
$serverName = $CC_CONFIG['baseUrl'];
@ -1218,7 +1218,7 @@ SQL;
// note: never call this method from controllers because it does a sleep
public function uploadToSoundCloud()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$file = $this->_file;
if (is_null($file)) {

View File

@ -5,7 +5,7 @@ class Application_Model_Systemstatus
public static function GetMonitStatus($p_ip)
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$monit_user = $CC_CONFIG['monit_user'];
$monit_password = $CC_CONFIG['monit_password'];

View File

@ -126,7 +126,7 @@ class AirtimeInstall
*/
public static function DbConnect($p_exitOnError = true)
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
try {
$con = Propel::getConnection();
} catch (Exception $e) {
@ -147,7 +147,7 @@ class AirtimeInstall
* install script. */
public static function InstallStorageDirectory()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
echo "* Storage directory setup".PHP_EOL;
$ini = parse_ini_file(__DIR__."/airtime-install.ini");
@ -183,7 +183,7 @@ class AirtimeInstall
public static function CreateDatabaseUser()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
echo " * Creating Airtime database user".PHP_EOL;
@ -208,7 +208,7 @@ class AirtimeInstall
public static function CreateDatabase()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
echo " * Creating Airtime database".PHP_EOL;
@ -412,7 +412,7 @@ class AirtimeInstall
public static function InstallPhpCode()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
echo "* Installing PHP code to ".AirtimeInstall::CONF_DIR_WWW.PHP_EOL;
exec("mkdir -p ".AirtimeInstall::CONF_DIR_WWW);
exec("cp -R ".AirtimeInstall::GetAirtimeSrcDir()."/* ".AirtimeInstall::CONF_DIR_WWW);
@ -461,7 +461,7 @@ class AirtimeInstall
}
public static function CreateZendPhpLogFile(){
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$path = AirtimeInstall::CONF_DIR_LOG;
$file = $path.'/zendphp.log';

View File

@ -10,6 +10,8 @@ require_once(__DIR__.'/AirtimeInstall.php');
require_once(__DIR__.'/airtime-constants.php');
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
Config::loadConfig();
$CC_CONFIG = Config::getConfig();
require_once 'propel/runtime/lib/Propel.php';
Propel::init(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/airtime-conf-production.php");
@ -24,7 +26,6 @@ AirtimeInstall::DbConnect(true);
AirtimeInstall::InstallPostgresScriptingLanguage();
//Load Database parameters
global $CC_CONFIG;
$dbuser = $CC_CONFIG['dsn']['username'];
$dbpasswd = $CC_CONFIG['dsn']['password'];
$dbname = $CC_CONFIG['dsn']['database'];

View File

@ -16,6 +16,8 @@ $iniExists = file_exists("/etc/airtime/airtime.conf");
if ($iniExists){
//reinstall, Will ask if we should rewrite config files.
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
Config::loadConfig();
$CC_CONFIG = Config::getConfig();
require_once 'propel/runtime/lib/Propel.php';
Propel::init(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/airtime-conf-production.php");
$version = AirtimeInstall::GetVersionInstalled();
@ -51,6 +53,8 @@ if ($overwrite) {
}
if (!$iniExists){
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
Config::loadConfig();
$CC_CONFIG = Config::getConfig();
require_once 'propel/runtime/lib/Propel.php';
Propel::init(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/airtime-conf-production.php");
}

View File

@ -17,6 +17,8 @@ if (!file_exists(AirtimeIni::CONF_FILE_AIRTIME)) {
}
require_once(__DIR__.'/airtime-constants.php');
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
Config::loadConfig();
$CC_CONFIG = Config::getConfig();
require_once 'propel/runtime/lib/Propel.php';
@ -37,6 +39,7 @@ $sql = "SELECT pg_cancel_backend(procpid) FROM pg_stat_activity WHERE datname =
$command = "echo \"$sql\" | su postgres -c psql";
@exec($command, $output);
$CC_CONFIG = Config::getConfig();
echo " * Dropping the database '".$CC_CONFIG["dsn"]["database"]."'...".PHP_EOL;
//dropdb returns 1 if other sessions are using the database, otherwise returns 0

View File

@ -36,7 +36,7 @@ $version = AirtimeInstall::GetVersionInstalled();
echo "******************************** Upgrade Begin *********************************".PHP_EOL;
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$user = $CC_CONFIG['dsn']['username'];
$password = $CC_CONFIG['dsn']['password'];
$host = $CC_CONFIG['dsn']['hostspec'];

View File

@ -5,7 +5,12 @@ exitIfNotRoot();
date_default_timezone_set("UTC");
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
require_once($CC_CONFIG['phpDir'].'/application/configs/conf.php');
Config::loadConfig();
$CC_CONFIG = Config::getConfig();
/*
// Name of the web server user
$CC_CONFIG['webServerUser'] = $values['general']['web_server_user'];
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
@ -25,11 +30,11 @@ $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'];
*/
require_once($CC_CONFIG['phpDir'].'/application/configs/constants.php');
require_once($CC_CONFIG['phpDir'].'/application/configs/conf.php');
//require_once($CC_CONFIG['phpDir'].'/application/configs/conf.php');
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
//$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
@ -38,7 +43,7 @@ realpath($CC_CONFIG['phpDir'] . '/library')
)));
function my_autoload($classname){
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$info = explode('_', $classname);
if (isset($info[1]) && isset($info[2])) {
$filename = $info[2].".php";