Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
83e8a610df
|
@ -28,7 +28,6 @@ $CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||||
date_default_timezone_set(Application_Model_Preference::GetTimezone());
|
date_default_timezone_set(Application_Model_Preference::GetTimezone());
|
||||||
|
|
||||||
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
||||||
Logging::log("bootstrap");
|
|
||||||
|
|
||||||
Zend_Validate::setDefaultNamespaces("Zend");
|
Zend_Validate::setDefaultNamespaces("Zend");
|
||||||
|
|
||||||
|
@ -67,7 +66,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/libs/jquery.stickyPanel.js','text/javascript');
|
$view->headScript()->appendFile($baseUrl.'/js/libs/jquery.stickyPanel.js','text/javascript');
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/qtip/jquery.qtip2.min.js','text/javascript');
|
$view->headScript()->appendFile($baseUrl.'/js/qtip/jquery.qtip2.min.js','text/javascript');
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js');
|
$view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js');
|
||||||
|
$view->headScript()->appendScript("var baseUrl='$baseUrl/'");
|
||||||
|
|
||||||
//scripts for now playing bar
|
//scripts for now playing bar
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js','text/javascript');
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js','text/javascript');
|
||||||
|
|
|
@ -134,11 +134,11 @@ return array (
|
||||||
'BaseCcLoginAttemptsPeer' => 'airtime/om/BaseCcLoginAttemptsPeer.php',
|
'BaseCcLoginAttemptsPeer' => 'airtime/om/BaseCcLoginAttemptsPeer.php',
|
||||||
'BaseCcLoginAttempts' => 'airtime/om/BaseCcLoginAttempts.php',
|
'BaseCcLoginAttempts' => 'airtime/om/BaseCcLoginAttempts.php',
|
||||||
'BaseCcLoginAttemptsQuery' => 'airtime/om/BaseCcLoginAttemptsQuery.php',
|
'BaseCcLoginAttemptsQuery' => 'airtime/om/BaseCcLoginAttemptsQuery.php',
|
||||||
'CcComponentTableMap' => 'airtime/map/CcComponentTableMap.php',
|
'CcServiceRegisterTableMap' => 'airtime/map/CcServiceRegisterTableMap.php',
|
||||||
'CcComponentPeer' => 'airtime/CcComponentPeer.php',
|
'CcServiceRegisterPeer' => 'airtime/CcServiceRegisterPeer.php',
|
||||||
'CcComponent' => 'airtime/CcComponent.php',
|
'CcServiceRegister' => 'airtime/CcServiceRegister.php',
|
||||||
'CcComponentQuery' => 'airtime/CcComponentQuery.php',
|
'CcServiceRegisterQuery' => 'airtime/CcServiceRegisterQuery.php',
|
||||||
'BaseCcComponentPeer' => 'airtime/om/BaseCcComponentPeer.php',
|
'BaseCcServiceRegisterPeer' => 'airtime/om/BaseCcServiceRegisterPeer.php',
|
||||||
'BaseCcComponent' => 'airtime/om/BaseCcComponent.php',
|
'BaseCcServiceRegister' => 'airtime/om/BaseCcServiceRegister.php',
|
||||||
'BaseCcComponentQuery' => 'airtime/om/BaseCcComponentQuery.php',
|
'BaseCcServiceRegisterQuery' => 'airtime/om/BaseCcServiceRegisterQuery.php',
|
||||||
);
|
);
|
|
@ -78,10 +78,10 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
||||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||||
|
|
||||||
$form->Logo->receive();
|
$form->Logo->receive();
|
||||||
$imagePath = $form->Logo->getFileName();
|
$imagePath = $form->Logo->getFileName();
|
||||||
|
|
||||||
Application_Model_Preference::SetStationCountry($values["Country"]);
|
Application_Model_Preference::SetStationCountry($values["Country"]);
|
||||||
Application_Model_Preference::SetStationCity($values["City"]);
|
Application_Model_Preference::SetStationCity($values["City"]);
|
||||||
Application_Model_Preference::SetStationDescription($values["Description"]);
|
Application_Model_Preference::SetStationDescription($values["Description"]);
|
||||||
|
@ -105,36 +105,36 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
//$form->render($this->view);
|
//$form->render($this->view);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function directoryConfigAction()
|
public function directoryConfigAction()
|
||||||
{
|
{
|
||||||
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js','text/javascript');
|
||||||
|
|
||||||
$watched_dirs_pref = new Application_Form_WatchedDirPreferences();
|
$watched_dirs_pref = new Application_Form_WatchedDirPreferences();
|
||||||
|
|
||||||
$this->view->form = $watched_dirs_pref;
|
$this->view->form = $watched_dirs_pref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function streamSettingAction()
|
public function streamSettingAction()
|
||||||
{
|
{
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js','text/javascript');
|
||||||
|
|
||||||
// get current settings
|
// get current settings
|
||||||
$temp = Application_Model_StreamSetting::getStreamSetting();
|
$temp = Application_Model_StreamSetting::getStreamSetting();
|
||||||
$setting = array();
|
$setting = array();
|
||||||
foreach ($temp as $t){
|
foreach ($temp as $t){
|
||||||
$setting[$t['keyname']] = $t['value'];
|
$setting[$t['keyname']] = $t['value'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// get predefined type and bitrate from pref table
|
// get predefined type and bitrate from pref table
|
||||||
$temp_types = Application_Model_Preference::GetStreamType();
|
$temp_types = Application_Model_Preference::GetStreamType();
|
||||||
$stream_types = array();
|
$stream_types = array();
|
||||||
|
@ -146,7 +146,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
$stream_types[trim($type)] = $temp;
|
$stream_types[trim($type)] = $temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp_bitrate = Application_Model_Preference::GetStreamBitrate();
|
$temp_bitrate = Application_Model_Preference::GetStreamBitrate();
|
||||||
$max_bitrate = intval(Application_Model_Preference::GetMaxBitrate());
|
$max_bitrate = intval(Application_Model_Preference::GetMaxBitrate());
|
||||||
$stream_bitrates = array();
|
$stream_bitrates = array();
|
||||||
|
@ -155,7 +155,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$stream_bitrates[trim($type)] = strtoupper(trim($type))." Kbit/s";
|
$stream_bitrates[trim($type)] = strtoupper(trim($type))." Kbit/s";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
|
$num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
|
||||||
$form = new Application_Form_StreamSetting();
|
$form = new Application_Form_StreamSetting();
|
||||||
$form->setSetting($setting);
|
$form->setSetting($setting);
|
||||||
|
@ -195,7 +195,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->view->num_stream = $num_of_stream;
|
$this->view->num_stream = $num_of_stream;
|
||||||
$this->view->disable_stream_conf = Application_Model_Preference::GetDisableStreamConf();
|
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
||||||
$this->view->subform = $watched_dirs_form->render();
|
$this->view->subform = $watched_dirs_form->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isImportInProgressAction(){
|
public function isImportInProgressAction(){
|
||||||
$now = time();
|
$now = time();
|
||||||
$res = false;
|
$res = false;
|
||||||
|
|
|
@ -3,29 +3,29 @@
|
||||||
class Application_Form_StreamSetting extends Zend_Form
|
class Application_Form_StreamSetting extends Zend_Form
|
||||||
{
|
{
|
||||||
private $setting;
|
private $setting;
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSetting($setting){
|
public function setSetting($setting){
|
||||||
$this->setting = $setting;
|
$this->setting = $setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function startFrom(){
|
public function startFrom() {
|
||||||
$setting = $this->setting;
|
$setting = $this->setting;
|
||||||
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
|
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
|
||||||
$output_sound_device->setLabel('Enabled')
|
$output_sound_device->setLabel('Enabled')
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
->setValue(($setting['output_sound_device'] == "true")?1:0)
|
->setValue(($setting['output_sound_device'] == "true")?1:0)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if(Application_Model_Preference::GetDisableStreamConf() == "true"){
|
if (Application_Model_Preference::GetEnableStreamConf() == "false"){
|
||||||
$output_sound_device->setAttrib("readonly", true);
|
$output_sound_device->setAttrib("readonly", true);
|
||||||
}
|
}
|
||||||
$this->addElement($output_sound_device);
|
$this->addElement($output_sound_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isValid($data){
|
public function isValid($data){
|
||||||
$this->populate(array("output_sound_device"=>$data));
|
$this->populate(array("output_sound_device"=>$data));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -4,43 +4,43 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
private $setting;
|
private $setting;
|
||||||
private $stream_types;
|
private $stream_types;
|
||||||
private $stream_bitrates;
|
private $stream_bitrates;
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPrefix($prefix){
|
public function setPrefix($prefix){
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSetting($setting){
|
public function setSetting($setting){
|
||||||
$this->setting = $setting;
|
$this->setting = $setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setStreamTypes($stream_types){
|
public function setStreamTypes($stream_types){
|
||||||
$this->stream_types = $stream_types;
|
$this->stream_types = $stream_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setStreamBitrates($stream_bitrates){
|
public function setStreamBitrates($stream_bitrates){
|
||||||
$this->stream_bitrates = $stream_bitrates;
|
$this->stream_bitrates = $stream_bitrates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function startForm(){
|
public function startForm(){
|
||||||
$prefix = "s".$this->prefix;
|
$prefix = "s".$this->prefix;
|
||||||
$stream_number = $this->prefix;
|
$stream_number = $this->prefix;
|
||||||
$setting = $this->setting;
|
$setting = $this->setting;
|
||||||
$stream_types = $this->stream_types;
|
$stream_types = $this->stream_types;
|
||||||
$stream_bitrates = $this->stream_bitrates;
|
$stream_bitrates = $this->stream_bitrates;
|
||||||
|
|
||||||
$this->setIsArray(true);
|
$this->setIsArray(true);
|
||||||
$this->setElementsBelongTo($prefix."_data");
|
$this->setElementsBelongTo($prefix."_data");
|
||||||
|
|
||||||
$disable_all = false;
|
$disable_all = false;
|
||||||
if(Application_Model_Preference::GetDisableStreamConf() == "true"){
|
if(Application_Model_Preference::GetEnableStreamConf() == "false"){
|
||||||
$disable_all = true;
|
$disable_all = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$enable = new Zend_Form_Element_Checkbox('enable');
|
$enable = new Zend_Form_Element_Checkbox('enable');
|
||||||
$enable->setLabel('Enabled:')
|
$enable->setLabel('Enabled:')
|
||||||
->setValue($setting[$prefix.'_output'] != 'disabled'?1:0)
|
->setValue($setting[$prefix.'_output'] != 'disabled'?1:0)
|
||||||
|
@ -49,7 +49,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$enable->setAttrib("disabled", "disabled");
|
$enable->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($enable);
|
$this->addElement($enable);
|
||||||
|
|
||||||
$type = new Zend_Form_Element_Select('type');
|
$type = new Zend_Form_Element_Select('type');
|
||||||
$type->setLabel("Stream Type:")
|
$type->setLabel("Stream Type:")
|
||||||
->setMultiOptions($stream_types)
|
->setMultiOptions($stream_types)
|
||||||
|
@ -59,7 +59,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$type->setAttrib("disabled", "disabled");
|
$type->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($type);
|
$this->addElement($type);
|
||||||
|
|
||||||
$bitrate = new Zend_Form_Element_Select('bitrate');
|
$bitrate = new Zend_Form_Element_Select('bitrate');
|
||||||
$bitrate->setLabel("Bit Rate:")
|
$bitrate->setLabel("Bit Rate:")
|
||||||
->setMultiOptions($stream_bitrates)
|
->setMultiOptions($stream_bitrates)
|
||||||
|
@ -70,7 +70,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
}
|
}
|
||||||
$this->addElement($type);
|
$this->addElement($type);
|
||||||
$this->addElement($bitrate);
|
$this->addElement($bitrate);
|
||||||
|
|
||||||
$output = new Zend_Form_Element_Select('output');
|
$output = new Zend_Form_Element_Select('output');
|
||||||
$output->setLabel("Service Type:")
|
$output->setLabel("Service Type:")
|
||||||
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"Shoutcast"))
|
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"Shoutcast"))
|
||||||
|
@ -80,7 +80,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$output->setAttrib("disabled", "disabled");
|
$output->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($output);
|
$this->addElement($output);
|
||||||
|
|
||||||
$host = new Zend_Form_Element_Text('host');
|
$host = new Zend_Form_Element_Text('host');
|
||||||
$host->setLabel("Server")
|
$host->setLabel("Server")
|
||||||
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
|
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
|
||||||
|
@ -89,7 +89,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$host->setAttrib("disabled", "disabled");
|
$host->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($host);
|
$this->addElement($host);
|
||||||
|
|
||||||
$port = new Zend_Form_Element_Text('port');
|
$port = new Zend_Form_Element_Text('port');
|
||||||
$port->setLabel("Port")
|
$port->setLabel("Port")
|
||||||
->setValue(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:"")
|
->setValue(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:"")
|
||||||
|
@ -100,7 +100,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$port->setAttrib("disabled", "disabled");
|
$port->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($port);
|
$this->addElement($port);
|
||||||
|
|
||||||
$pass = new Zend_Form_Element_Text('pass');
|
$pass = new Zend_Form_Element_Text('pass');
|
||||||
$pass->setLabel("Password")
|
$pass->setLabel("Password")
|
||||||
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
|
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
|
||||||
|
@ -109,7 +109,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$pass->setAttrib("disabled", "disabled");
|
$pass->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($pass);
|
$this->addElement($pass);
|
||||||
|
|
||||||
$genre = new Zend_Form_Element_Text('genre');
|
$genre = new Zend_Form_Element_Text('genre');
|
||||||
$genre->setLabel("Genre")
|
$genre->setLabel("Genre")
|
||||||
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
|
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
|
||||||
|
@ -118,7 +118,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$genre->setAttrib("disabled", "disabled");
|
$genre->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($genre);
|
$this->addElement($genre);
|
||||||
|
|
||||||
$url = new Zend_Form_Element_Text('url');
|
$url = new Zend_Form_Element_Text('url');
|
||||||
$url->setLabel("URL")
|
$url->setLabel("URL")
|
||||||
->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"")
|
->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"")
|
||||||
|
@ -127,7 +127,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$url->setAttrib("disabled", "disabled");
|
$url->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($url);
|
$this->addElement($url);
|
||||||
|
|
||||||
$description = new Zend_Form_Element_Text('description');
|
$description = new Zend_Form_Element_Text('description');
|
||||||
$description->setLabel("Name/Description")
|
$description->setLabel("Name/Description")
|
||||||
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
|
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
|
||||||
|
@ -136,7 +136,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$description->setAttrib("disabled", "disabled");
|
$description->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($description);
|
$this->addElement($description);
|
||||||
|
|
||||||
$mount = new Zend_Form_Element_Text('mount');
|
$mount = new Zend_Form_Element_Text('mount');
|
||||||
$mount->setLabel("Mount Point")
|
$mount->setLabel("Mount Point")
|
||||||
->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"")
|
->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"")
|
||||||
|
@ -145,7 +145,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$mount->setAttrib("disabled", "disabled");
|
$mount->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($mount);
|
$this->addElement($mount);
|
||||||
|
|
||||||
$user = new Zend_Form_Element_Text('user');
|
$user = new Zend_Form_Element_Text('user');
|
||||||
$user->setLabel("Username")
|
$user->setLabel("Username")
|
||||||
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
|
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
|
||||||
|
@ -154,12 +154,12 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$user->setAttrib("disabled", "disabled");
|
$user->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($user);
|
$this->addElement($user);
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number))
|
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isValid ($data){
|
public function isValid ($data){
|
||||||
$isValid = parent::isValid($data);
|
$isValid = parent::isValid($data);
|
||||||
if($data['enable'] == 1){
|
if($data['enable'] == 1){
|
||||||
|
|
|
@ -3,10 +3,10 @@ class Application_Model_Component {
|
||||||
|
|
||||||
public static function Register($p_componentName, $p_ipAddress){
|
public static function Register($p_componentName, $p_ipAddress){
|
||||||
|
|
||||||
$component = CcComponentQuery::create()->findOneByDbName($p_componentName);
|
$component = CcServiceRegisterQuery::create()->findOneByDbName($p_componentName);
|
||||||
|
|
||||||
if ($component == NULL){
|
if ($component == NULL){
|
||||||
$component = new CcComponent();
|
$component = new CcServiceRegister();
|
||||||
$component->setDbName($p_componentName);
|
$component->setDbName($p_componentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -259,13 +259,13 @@ class Application_Model_Preference
|
||||||
public static function GetStationDescription(){
|
public static function GetStationDescription(){
|
||||||
return self::GetValue("description");
|
return self::GetValue("description");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetTimezone($timezone){
|
public static function SetTimezone($timezone){
|
||||||
self::SetValue("timezone", $timezone);
|
self::SetValue("timezone", $timezone);
|
||||||
date_default_timezone_set($timezone);
|
date_default_timezone_set($timezone);
|
||||||
$md = array("timezone" => $timezone);
|
$md = array("timezone" => $timezone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetTimezone(){
|
public static function GetTimezone(){
|
||||||
return self::GetValue("timezone");
|
return self::GetValue("timezone");
|
||||||
}
|
}
|
||||||
|
@ -328,11 +328,11 @@ class Application_Model_Preference
|
||||||
$url = $systemInfoArray["AIRTIME_VERSION_URL"];
|
$url = $systemInfoArray["AIRTIME_VERSION_URL"];
|
||||||
$index = strpos($url,'/api/');
|
$index = strpos($url,'/api/');
|
||||||
$url = substr($url, 0, $index);
|
$url = substr($url, 0, $index);
|
||||||
|
|
||||||
$headerInfo = get_headers(trim($url),1);
|
$headerInfo = get_headers(trim($url),1);
|
||||||
$outputArray['WEB_SERVER'] = $headerInfo['Server'][0];
|
$outputArray['WEB_SERVER'] = $headerInfo['Server'][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$outputArray['NUM_OF_USERS'] = Application_Model_User::getUserCount();
|
$outputArray['NUM_OF_USERS'] = Application_Model_User::getUserCount();
|
||||||
$outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount();
|
$outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount();
|
||||||
$outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount();
|
$outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount();
|
||||||
|
@ -365,74 +365,74 @@ class Application_Model_Preference
|
||||||
public static function GetRemindMeDate(){
|
public static function GetRemindMeDate(){
|
||||||
return self::GetValue("remindme");
|
return self::GetValue("remindme");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetImportTimestamp(){
|
public static function SetImportTimestamp(){
|
||||||
$now = time();
|
$now = time();
|
||||||
if(self::GetImportTimestamp()+5 < $now){
|
if(self::GetImportTimestamp()+5 < $now){
|
||||||
self::SetValue("import_timestamp", $now);
|
self::SetValue("import_timestamp", $now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetImportTimestamp(){
|
public static function GetImportTimestamp(){
|
||||||
return self::GetValue("import_timestamp");
|
return self::GetValue("import_timestamp");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStreamType(){
|
public static function GetStreamType(){
|
||||||
$st = self::GetValue("stream_type");
|
$st = self::GetValue("stream_type");
|
||||||
return explode(',', $st);
|
return explode(',', $st);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStreamBitrate(){
|
public static function GetStreamBitrate(){
|
||||||
$sb = self::GetValue("stream_bitrate");
|
$sb = self::GetValue("stream_bitrate");
|
||||||
return explode(',', $sb);
|
return explode(',', $sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetPrivacyPolicyCheck($flag){
|
public static function SetPrivacyPolicyCheck($flag){
|
||||||
self::SetValue("privacy_policy", $flag);
|
self::SetValue("privacy_policy", $flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetPrivacyPolicyCheck(){
|
public static function GetPrivacyPolicyCheck(){
|
||||||
return self::GetValue("privacy_policy");
|
return self::GetValue("privacy_policy");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetNumOfStreams($num){
|
public static function SetNumOfStreams($num){
|
||||||
self::SetValue("num_of_streams", intval($num));
|
self::SetValue("num_of_streams", intval($num));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetNumOfStreams(){
|
public static function GetNumOfStreams(){
|
||||||
return self::GetValue("num_of_streams");
|
return self::GetValue("num_of_streams");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetMaxBitrate($bitrate){
|
public static function SetMaxBitrate($bitrate){
|
||||||
self::SetValue("max_bitrate", intval($bitrate));
|
self::SetValue("max_bitrate", intval($bitrate));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetMaxBitrate(){
|
public static function GetMaxBitrate(){
|
||||||
return self::GetValue("max_bitrate");
|
return self::GetValue("max_bitrate");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetPlanLevel($plan){
|
public static function SetPlanLevel($plan){
|
||||||
self::SetValue("plan_level", $plan);
|
self::SetValue("plan_level", $plan);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetPlanLevel(){
|
public static function GetPlanLevel(){
|
||||||
return self::GetValue("plan_level");
|
return self::GetValue("plan_level");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetTrialEndingDate($date){
|
public static function SetTrialEndingDate($date){
|
||||||
self::SetValue("trial_end_date", $date);
|
self::SetValue("trial_end_date", $date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetTrialEndingDate(){
|
public static function GetTrialEndingDate(){
|
||||||
return self::GetValue("trial_end_date");
|
return self::GetValue("trial_end_date");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetDisableStreamConf($bool){
|
public static function SetEnableStreamConf($bool){
|
||||||
self::SetValue("disable_stream_conf", $bool);
|
self::SetValue("enable_stream_conf", $bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetDisableStreamConf(){
|
public static function GetEnableStreamConf(){
|
||||||
return self::GetValue("disable_stream_conf");
|
return self::GetValue("enable_stream_conf");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetAirtimeVersion(){
|
public static function GetAirtimeVersion(){
|
||||||
|
|
|
@ -118,7 +118,7 @@ class Application_Model_Systemstatus
|
||||||
|
|
||||||
public static function GetPypoStatus(){
|
public static function GetPypoStatus(){
|
||||||
|
|
||||||
$component = CcComponentQuery::create()->findOneByDbName("pypo");
|
$component = CcServiceRegisterQuery::create()->findOneByDbName("pypo");
|
||||||
$ip = $component->getDbIp();
|
$ip = $component->getDbIp();
|
||||||
|
|
||||||
$docRoot = self::GetMonitStatus($ip);
|
$docRoot = self::GetMonitStatus($ip);
|
||||||
|
@ -129,7 +129,7 @@ class Application_Model_Systemstatus
|
||||||
|
|
||||||
public static function GetLiquidsoapStatus(){
|
public static function GetLiquidsoapStatus(){
|
||||||
|
|
||||||
$component = CcComponentQuery::create()->findOneByDbName("pypo");
|
$component = CcServiceRegisterQuery::create()->findOneByDbName("pypo");
|
||||||
$ip = $component->getDbIp();
|
$ip = $component->getDbIp();
|
||||||
|
|
||||||
$docRoot = self::GetMonitStatus($ip);
|
$docRoot = self::GetMonitStatus($ip);
|
||||||
|
@ -140,7 +140,7 @@ class Application_Model_Systemstatus
|
||||||
|
|
||||||
public static function GetShowRecorderStatus(){
|
public static function GetShowRecorderStatus(){
|
||||||
|
|
||||||
$component = CcComponentQuery::create()->findOneByDbName("show-recorder");
|
$component = CcServiceRegisterQuery::create()->findOneByDbName("show-recorder");
|
||||||
$ip = $component->getDbIp();
|
$ip = $component->getDbIp();
|
||||||
|
|
||||||
$docRoot = self::GetMonitStatus($ip);
|
$docRoot = self::GetMonitStatus($ip);
|
||||||
|
@ -151,7 +151,7 @@ class Application_Model_Systemstatus
|
||||||
|
|
||||||
public static function GetMediaMonitorStatus(){
|
public static function GetMediaMonitorStatus(){
|
||||||
|
|
||||||
$component = CcComponentQuery::create()->findOneByDbName("media-monitor");
|
$component = CcServiceRegisterQuery::create()->findOneByDbName("media-monitor");
|
||||||
$ip = $component->getDbIp();
|
$ip = $component->getDbIp();
|
||||||
|
|
||||||
$docRoot = self::GetMonitStatus($ip);
|
$docRoot = self::GetMonitStatus($ip);
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'cc_service_register' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime
|
||||||
|
*/
|
||||||
|
class CcServiceRegister extends BaseCcServiceRegister {
|
||||||
|
|
||||||
|
} // CcServiceRegister
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'cc_service_register' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime
|
||||||
|
*/
|
||||||
|
class CcServiceRegisterPeer extends BaseCcServiceRegisterPeer {
|
||||||
|
|
||||||
|
} // CcServiceRegisterPeer
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'cc_service_register' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime
|
||||||
|
*/
|
||||||
|
class CcServiceRegisterQuery extends BaseCcServiceRegisterQuery {
|
||||||
|
|
||||||
|
} // CcServiceRegisterQuery
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class defines the structure of the 'cc_component' table.
|
* This class defines the structure of the 'cc_service_register' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
@ -14,12 +14,12 @@
|
||||||
*
|
*
|
||||||
* @package propel.generator.airtime.map
|
* @package propel.generator.airtime.map
|
||||||
*/
|
*/
|
||||||
class CcComponentTableMap extends TableMap {
|
class CcServiceRegisterTableMap extends TableMap {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The (dot-path) name of this class
|
* The (dot-path) name of this class
|
||||||
*/
|
*/
|
||||||
const CLASS_NAME = 'airtime.map.CcComponentTableMap';
|
const CLASS_NAME = 'airtime.map.CcServiceRegisterTableMap';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the table attributes, columns and validators
|
* Initialize the table attributes, columns and validators
|
||||||
|
@ -31,9 +31,9 @@ class CcComponentTableMap extends TableMap {
|
||||||
public function initialize()
|
public function initialize()
|
||||||
{
|
{
|
||||||
// attributes
|
// attributes
|
||||||
$this->setName('cc_component');
|
$this->setName('cc_service_register');
|
||||||
$this->setPhpName('CcComponent');
|
$this->setPhpName('CcServiceRegister');
|
||||||
$this->setClassname('CcComponent');
|
$this->setClassname('CcServiceRegister');
|
||||||
$this->setPackage('airtime');
|
$this->setPackage('airtime');
|
||||||
$this->setUseIdGenerator(false);
|
$this->setUseIdGenerator(false);
|
||||||
// columns
|
// columns
|
||||||
|
@ -49,4 +49,4 @@ class CcComponentTableMap extends TableMap {
|
||||||
{
|
{
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
} // CcComponentTableMap
|
} // CcServiceRegisterTableMap
|
|
@ -2,25 +2,25 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class that represents a row from the 'cc_component' table.
|
* Base class that represents a row from the 'cc_service_register' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @package propel.generator.airtime.om
|
* @package propel.generator.airtime.om
|
||||||
*/
|
*/
|
||||||
abstract class BaseCcComponent extends BaseObject implements Persistent
|
abstract class BaseCcServiceRegister extends BaseObject implements Persistent
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Peer class name
|
* Peer class name
|
||||||
*/
|
*/
|
||||||
const PEER = 'CcComponentPeer';
|
const PEER = 'CcServiceRegisterPeer';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Peer class.
|
* The Peer class.
|
||||||
* Instance provides a convenient way of calling static methods on a class
|
* Instance provides a convenient way of calling static methods on a class
|
||||||
* that calling code may not be able to identify.
|
* that calling code may not be able to identify.
|
||||||
* @var CcComponentPeer
|
* @var CcServiceRegisterPeer
|
||||||
*/
|
*/
|
||||||
protected static $peer;
|
protected static $peer;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
* Set the value of [name] column.
|
* Set the value of [name] column.
|
||||||
*
|
*
|
||||||
* @param string $v new value
|
* @param string $v new value
|
||||||
* @return CcComponent The current object (for fluent API support)
|
* @return CcServiceRegister The current object (for fluent API support)
|
||||||
*/
|
*/
|
||||||
public function setDbName($v)
|
public function setDbName($v)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
|
|
||||||
if ($this->name !== $v) {
|
if ($this->name !== $v) {
|
||||||
$this->name = $v;
|
$this->name = $v;
|
||||||
$this->modifiedColumns[] = CcComponentPeer::NAME;
|
$this->modifiedColumns[] = CcServiceRegisterPeer::NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -94,7 +94,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
* Set the value of [ip] column.
|
* Set the value of [ip] column.
|
||||||
*
|
*
|
||||||
* @param string $v new value
|
* @param string $v new value
|
||||||
* @return CcComponent The current object (for fluent API support)
|
* @return CcServiceRegister The current object (for fluent API support)
|
||||||
*/
|
*/
|
||||||
public function setDbIp($v)
|
public function setDbIp($v)
|
||||||
{
|
{
|
||||||
|
@ -104,7 +104,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
|
|
||||||
if ($this->ip !== $v) {
|
if ($this->ip !== $v) {
|
||||||
$this->ip = $v;
|
$this->ip = $v;
|
||||||
$this->modifiedColumns[] = CcComponentPeer::IP;
|
$this->modifiedColumns[] = CcServiceRegisterPeer::IP;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -152,10 +152,10 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
$this->ensureConsistency();
|
$this->ensureConsistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $startcol + 2; // 2 = CcComponentPeer::NUM_COLUMNS - CcComponentPeer::NUM_LAZY_LOAD_COLUMNS).
|
return $startcol + 2; // 2 = CcServiceRegisterPeer::NUM_COLUMNS - CcServiceRegisterPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating CcComponent object", $e);
|
throw new PropelException("Error populating CcServiceRegister object", $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,13 +198,13 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(CcComponentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
$con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't need to alter the object instance pool; we're just modifying this instance
|
// We don't need to alter the object instance pool; we're just modifying this instance
|
||||||
// already in the pool.
|
// already in the pool.
|
||||||
|
|
||||||
$stmt = CcComponentPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
|
$stmt = CcServiceRegisterPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
|
||||||
$row = $stmt->fetch(PDO::FETCH_NUM);
|
$row = $stmt->fetch(PDO::FETCH_NUM);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
if (!$row) {
|
if (!$row) {
|
||||||
|
@ -233,14 +233,14 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(CcComponentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
$con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
$con->beginTransaction();
|
$con->beginTransaction();
|
||||||
try {
|
try {
|
||||||
$ret = $this->preDelete($con);
|
$ret = $this->preDelete($con);
|
||||||
if ($ret) {
|
if ($ret) {
|
||||||
CcComponentQuery::create()
|
CcServiceRegisterQuery::create()
|
||||||
->filterByPrimaryKey($this->getPrimaryKey())
|
->filterByPrimaryKey($this->getPrimaryKey())
|
||||||
->delete($con);
|
->delete($con);
|
||||||
$this->postDelete($con);
|
$this->postDelete($con);
|
||||||
|
@ -275,7 +275,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(CcComponentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
$con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
$con->beginTransaction();
|
$con->beginTransaction();
|
||||||
|
@ -295,7 +295,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
$this->postUpdate($con);
|
$this->postUpdate($con);
|
||||||
}
|
}
|
||||||
$this->postSave($con);
|
$this->postSave($con);
|
||||||
CcComponentPeer::addInstanceToPool($this);
|
CcServiceRegisterPeer::addInstanceToPool($this);
|
||||||
} else {
|
} else {
|
||||||
$affectedRows = 0;
|
$affectedRows = 0;
|
||||||
}
|
}
|
||||||
|
@ -333,7 +333,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
$affectedRows = 1;
|
$affectedRows = 1;
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
} else {
|
} else {
|
||||||
$affectedRows = CcComponentPeer::doUpdate($this, $con);
|
$affectedRows = CcServiceRegisterPeer::doUpdate($this, $con);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
||||||
|
@ -405,7 +405,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
$failureMap = array();
|
$failureMap = array();
|
||||||
|
|
||||||
|
|
||||||
if (($retval = CcComponentPeer::doValidate($this, $columns)) !== true) {
|
if (($retval = CcServiceRegisterPeer::doValidate($this, $columns)) !== true) {
|
||||||
$failureMap = array_merge($failureMap, $retval);
|
$failureMap = array_merge($failureMap, $retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
|
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
|
||||||
{
|
{
|
||||||
$pos = CcComponentPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
$pos = CcServiceRegisterPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||||
$field = $this->getByPosition($pos);
|
$field = $this->getByPosition($pos);
|
||||||
return $field;
|
return $field;
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
|
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
|
||||||
{
|
{
|
||||||
$keys = CcComponentPeer::getFieldNames($keyType);
|
$keys = CcServiceRegisterPeer::getFieldNames($keyType);
|
||||||
$result = array(
|
$result = array(
|
||||||
$keys[0] => $this->getDbName(),
|
$keys[0] => $this->getDbName(),
|
||||||
$keys[1] => $this->getDbIp(),
|
$keys[1] => $this->getDbIp(),
|
||||||
|
@ -490,7 +490,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
|
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
|
||||||
{
|
{
|
||||||
$pos = CcComponentPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
$pos = CcServiceRegisterPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||||
return $this->setByPosition($pos, $value);
|
return $this->setByPosition($pos, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
|
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
|
||||||
{
|
{
|
||||||
$keys = CcComponentPeer::getFieldNames($keyType);
|
$keys = CcServiceRegisterPeer::getFieldNames($keyType);
|
||||||
|
|
||||||
if (array_key_exists($keys[0], $arr)) $this->setDbName($arr[$keys[0]]);
|
if (array_key_exists($keys[0], $arr)) $this->setDbName($arr[$keys[0]]);
|
||||||
if (array_key_exists($keys[1], $arr)) $this->setDbIp($arr[$keys[1]]);
|
if (array_key_exists($keys[1], $arr)) $this->setDbIp($arr[$keys[1]]);
|
||||||
|
@ -546,10 +546,10 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
public function buildCriteria()
|
public function buildCriteria()
|
||||||
{
|
{
|
||||||
$criteria = new Criteria(CcComponentPeer::DATABASE_NAME);
|
$criteria = new Criteria(CcServiceRegisterPeer::DATABASE_NAME);
|
||||||
|
|
||||||
if ($this->isColumnModified(CcComponentPeer::NAME)) $criteria->add(CcComponentPeer::NAME, $this->name);
|
if ($this->isColumnModified(CcServiceRegisterPeer::NAME)) $criteria->add(CcServiceRegisterPeer::NAME, $this->name);
|
||||||
if ($this->isColumnModified(CcComponentPeer::IP)) $criteria->add(CcComponentPeer::IP, $this->ip);
|
if ($this->isColumnModified(CcServiceRegisterPeer::IP)) $criteria->add(CcServiceRegisterPeer::IP, $this->ip);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
|
@ -564,8 +564,8 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
public function buildPkeyCriteria()
|
public function buildPkeyCriteria()
|
||||||
{
|
{
|
||||||
$criteria = new Criteria(CcComponentPeer::DATABASE_NAME);
|
$criteria = new Criteria(CcServiceRegisterPeer::DATABASE_NAME);
|
||||||
$criteria->add(CcComponentPeer::NAME, $this->name);
|
$criteria->add(CcServiceRegisterPeer::NAME, $this->name);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
|
@ -605,7 +605,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
* If desired, this method can also make copies of all associated (fkey referrers)
|
* If desired, this method can also make copies of all associated (fkey referrers)
|
||||||
* objects.
|
* objects.
|
||||||
*
|
*
|
||||||
* @param object $copyObj An object of CcComponent (or compatible) type.
|
* @param object $copyObj An object of CcServiceRegister (or compatible) type.
|
||||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||||
* @throws PropelException
|
* @throws PropelException
|
||||||
*/
|
*/
|
||||||
|
@ -626,7 +626,7 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
* objects.
|
* objects.
|
||||||
*
|
*
|
||||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||||
* @return CcComponent Clone of current object.
|
* @return CcServiceRegister Clone of current object.
|
||||||
* @throws PropelException
|
* @throws PropelException
|
||||||
*/
|
*/
|
||||||
public function copy($deepCopy = false)
|
public function copy($deepCopy = false)
|
||||||
|
@ -645,12 +645,12 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
* same instance for all member of this class. The method could therefore
|
* same instance for all member of this class. The method could therefore
|
||||||
* be static, but this would prevent one from overriding the behavior.
|
* be static, but this would prevent one from overriding the behavior.
|
||||||
*
|
*
|
||||||
* @return CcComponentPeer
|
* @return CcServiceRegisterPeer
|
||||||
*/
|
*/
|
||||||
public function getPeer()
|
public function getPeer()
|
||||||
{
|
{
|
||||||
if (self::$peer === null) {
|
if (self::$peer === null) {
|
||||||
self::$peer = new CcComponentPeer();
|
self::$peer = new CcServiceRegisterPeer();
|
||||||
}
|
}
|
||||||
return self::$peer;
|
return self::$peer;
|
||||||
}
|
}
|
||||||
|
@ -705,4 +705,4 @@ abstract class BaseCcComponent extends BaseObject implements Persistent
|
||||||
throw new PropelException('Call to undefined method: ' . $name);
|
throw new PropelException('Call to undefined method: ' . $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // BaseCcComponent
|
} // BaseCcServiceRegister
|
|
@ -2,28 +2,28 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base static class for performing query and update operations on the 'cc_component' table.
|
* Base static class for performing query and update operations on the 'cc_service_register' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @package propel.generator.airtime.om
|
* @package propel.generator.airtime.om
|
||||||
*/
|
*/
|
||||||
abstract class BaseCcComponentPeer {
|
abstract class BaseCcServiceRegisterPeer {
|
||||||
|
|
||||||
/** the default database name for this class */
|
/** the default database name for this class */
|
||||||
const DATABASE_NAME = 'airtime';
|
const DATABASE_NAME = 'airtime';
|
||||||
|
|
||||||
/** the table name for this class */
|
/** the table name for this class */
|
||||||
const TABLE_NAME = 'cc_component';
|
const TABLE_NAME = 'cc_service_register';
|
||||||
|
|
||||||
/** the related Propel class for this table */
|
/** the related Propel class for this table */
|
||||||
const OM_CLASS = 'CcComponent';
|
const OM_CLASS = 'CcServiceRegister';
|
||||||
|
|
||||||
/** A class that can be returned by this peer. */
|
/** A class that can be returned by this peer. */
|
||||||
const CLASS_DEFAULT = 'airtime.CcComponent';
|
const CLASS_DEFAULT = 'airtime.CcServiceRegister';
|
||||||
|
|
||||||
/** the related TableMap class for this table */
|
/** the related TableMap class for this table */
|
||||||
const TM_CLASS = 'CcComponentTableMap';
|
const TM_CLASS = 'CcServiceRegisterTableMap';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 2;
|
const NUM_COLUMNS = 2;
|
||||||
|
@ -32,16 +32,16 @@ abstract class BaseCcComponentPeer {
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
|
||||||
/** the column name for the NAME field */
|
/** the column name for the NAME field */
|
||||||
const NAME = 'cc_component.NAME';
|
const NAME = 'cc_service_register.NAME';
|
||||||
|
|
||||||
/** the column name for the IP field */
|
/** the column name for the IP field */
|
||||||
const IP = 'cc_component.IP';
|
const IP = 'cc_service_register.IP';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An identiy map to hold any loaded instances of CcComponent objects.
|
* An identiy map to hold any loaded instances of CcServiceRegister objects.
|
||||||
* This must be public so that other peer classes can access this when hydrating from JOIN
|
* This must be public so that other peer classes can access this when hydrating from JOIN
|
||||||
* queries.
|
* queries.
|
||||||
* @var array CcComponent[]
|
* @var array CcServiceRegister[]
|
||||||
*/
|
*/
|
||||||
public static $instances = array();
|
public static $instances = array();
|
||||||
|
|
||||||
|
@ -122,12 +122,12 @@ abstract class BaseCcComponentPeer {
|
||||||
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
||||||
* </code>
|
* </code>
|
||||||
* @param string $alias The alias for the current table.
|
* @param string $alias The alias for the current table.
|
||||||
* @param string $column The column name for current table. (i.e. CcComponentPeer::COLUMN_NAME).
|
* @param string $column The column name for current table. (i.e. CcServiceRegisterPeer::COLUMN_NAME).
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function alias($alias, $column)
|
public static function alias($alias, $column)
|
||||||
{
|
{
|
||||||
return str_replace(CcComponentPeer::TABLE_NAME.'.', $alias.'.', $column);
|
return str_replace(CcServiceRegisterPeer::TABLE_NAME.'.', $alias.'.', $column);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -145,8 +145,8 @@ abstract class BaseCcComponentPeer {
|
||||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||||
{
|
{
|
||||||
if (null === $alias) {
|
if (null === $alias) {
|
||||||
$criteria->addSelectColumn(CcComponentPeer::NAME);
|
$criteria->addSelectColumn(CcServiceRegisterPeer::NAME);
|
||||||
$criteria->addSelectColumn(CcComponentPeer::IP);
|
$criteria->addSelectColumn(CcServiceRegisterPeer::IP);
|
||||||
} else {
|
} else {
|
||||||
$criteria->addSelectColumn($alias . '.NAME');
|
$criteria->addSelectColumn($alias . '.NAME');
|
||||||
$criteria->addSelectColumn($alias . '.IP');
|
$criteria->addSelectColumn($alias . '.IP');
|
||||||
|
@ -169,21 +169,21 @@ abstract class BaseCcComponentPeer {
|
||||||
// We need to set the primary table name, since in the case that there are no WHERE columns
|
// We need to set the primary table name, since in the case that there are no WHERE columns
|
||||||
// it will be impossible for the BasePeer::createSelectSql() method to determine which
|
// it will be impossible for the BasePeer::createSelectSql() method to determine which
|
||||||
// tables go into the FROM clause.
|
// tables go into the FROM clause.
|
||||||
$criteria->setPrimaryTableName(CcComponentPeer::TABLE_NAME);
|
$criteria->setPrimaryTableName(CcServiceRegisterPeer::TABLE_NAME);
|
||||||
|
|
||||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||||
$criteria->setDistinct();
|
$criteria->setDistinct();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$criteria->hasSelectClause()) {
|
if (!$criteria->hasSelectClause()) {
|
||||||
CcComponentPeer::addSelectColumns($criteria);
|
CcServiceRegisterPeer::addSelectColumns($criteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||||
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
|
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
|
||||||
|
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(CcComponentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
$con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
}
|
}
|
||||||
// BasePeer returns a PDOStatement
|
// BasePeer returns a PDOStatement
|
||||||
$stmt = BasePeer::doCount($criteria, $con);
|
$stmt = BasePeer::doCount($criteria, $con);
|
||||||
|
@ -201,7 +201,7 @@ abstract class BaseCcComponentPeer {
|
||||||
*
|
*
|
||||||
* @param Criteria $criteria object used to create the SELECT statement.
|
* @param Criteria $criteria object used to create the SELECT statement.
|
||||||
* @param PropelPDO $con
|
* @param PropelPDO $con
|
||||||
* @return CcComponent
|
* @return CcServiceRegister
|
||||||
* @throws PropelException Any exceptions caught during processing will be
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
* rethrown wrapped into a PropelException.
|
* rethrown wrapped into a PropelException.
|
||||||
*/
|
*/
|
||||||
|
@ -209,7 +209,7 @@ abstract class BaseCcComponentPeer {
|
||||||
{
|
{
|
||||||
$critcopy = clone $criteria;
|
$critcopy = clone $criteria;
|
||||||
$critcopy->setLimit(1);
|
$critcopy->setLimit(1);
|
||||||
$objects = CcComponentPeer::doSelect($critcopy, $con);
|
$objects = CcServiceRegisterPeer::doSelect($critcopy, $con);
|
||||||
if ($objects) {
|
if ($objects) {
|
||||||
return $objects[0];
|
return $objects[0];
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ abstract class BaseCcComponentPeer {
|
||||||
*/
|
*/
|
||||||
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
|
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
|
||||||
{
|
{
|
||||||
return CcComponentPeer::populateObjects(CcComponentPeer::doSelectStmt($criteria, $con));
|
return CcServiceRegisterPeer::populateObjects(CcServiceRegisterPeer::doSelectStmt($criteria, $con));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
|
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
|
||||||
|
@ -244,12 +244,12 @@ abstract class BaseCcComponentPeer {
|
||||||
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
|
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
|
||||||
{
|
{
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(CcComponentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
$con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$criteria->hasSelectClause()) {
|
if (!$criteria->hasSelectClause()) {
|
||||||
$criteria = clone $criteria;
|
$criteria = clone $criteria;
|
||||||
CcComponentPeer::addSelectColumns($criteria);
|
CcServiceRegisterPeer::addSelectColumns($criteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the correct dbName
|
// Set the correct dbName
|
||||||
|
@ -267,10 +267,10 @@ abstract class BaseCcComponentPeer {
|
||||||
* to the cache in order to ensure that the same objects are always returned by doSelect*()
|
* to the cache in order to ensure that the same objects are always returned by doSelect*()
|
||||||
* and retrieveByPK*() calls.
|
* and retrieveByPK*() calls.
|
||||||
*
|
*
|
||||||
* @param CcComponent $value A CcComponent object.
|
* @param CcServiceRegister $value A CcServiceRegister object.
|
||||||
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
|
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
|
||||||
*/
|
*/
|
||||||
public static function addInstanceToPool(CcComponent $obj, $key = null)
|
public static function addInstanceToPool(CcServiceRegister $obj, $key = null)
|
||||||
{
|
{
|
||||||
if (Propel::isInstancePoolingEnabled()) {
|
if (Propel::isInstancePoolingEnabled()) {
|
||||||
if ($key === null) {
|
if ($key === null) {
|
||||||
|
@ -288,18 +288,18 @@ abstract class BaseCcComponentPeer {
|
||||||
* methods in your stub classes -- you may need to explicitly remove objects
|
* methods in your stub classes -- you may need to explicitly remove objects
|
||||||
* from the cache in order to prevent returning objects that no longer exist.
|
* from the cache in order to prevent returning objects that no longer exist.
|
||||||
*
|
*
|
||||||
* @param mixed $value A CcComponent object or a primary key value.
|
* @param mixed $value A CcServiceRegister object or a primary key value.
|
||||||
*/
|
*/
|
||||||
public static function removeInstanceFromPool($value)
|
public static function removeInstanceFromPool($value)
|
||||||
{
|
{
|
||||||
if (Propel::isInstancePoolingEnabled() && $value !== null) {
|
if (Propel::isInstancePoolingEnabled() && $value !== null) {
|
||||||
if (is_object($value) && $value instanceof CcComponent) {
|
if (is_object($value) && $value instanceof CcServiceRegister) {
|
||||||
$key = (string) $value->getDbName();
|
$key = (string) $value->getDbName();
|
||||||
} elseif (is_scalar($value)) {
|
} elseif (is_scalar($value)) {
|
||||||
// assume we've been passed a primary key
|
// assume we've been passed a primary key
|
||||||
$key = (string) $value;
|
$key = (string) $value;
|
||||||
} else {
|
} else {
|
||||||
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcComponent object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
|
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcServiceRegister object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ abstract class BaseCcComponentPeer {
|
||||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||||
*
|
*
|
||||||
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
|
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
|
||||||
* @return CcComponent Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
|
* @return CcServiceRegister Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
|
||||||
* @see getPrimaryKeyHash()
|
* @see getPrimaryKeyHash()
|
||||||
*/
|
*/
|
||||||
public static function getInstanceFromPool($key)
|
public static function getInstanceFromPool($key)
|
||||||
|
@ -338,7 +338,7 @@ abstract class BaseCcComponentPeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to invalidate the instance pool of all tables related to cc_component
|
* Method to invalidate the instance pool of all tables related to cc_service_register
|
||||||
* by a foreign key with ON DELETE CASCADE
|
* by a foreign key with ON DELETE CASCADE
|
||||||
*/
|
*/
|
||||||
public static function clearRelatedInstancePool()
|
public static function clearRelatedInstancePool()
|
||||||
|
@ -390,11 +390,11 @@ abstract class BaseCcComponentPeer {
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
// set the class once to avoid overhead in the loop
|
// set the class once to avoid overhead in the loop
|
||||||
$cls = CcComponentPeer::getOMClass(false);
|
$cls = CcServiceRegisterPeer::getOMClass(false);
|
||||||
// populate the object(s)
|
// populate the object(s)
|
||||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
$key = CcComponentPeer::getPrimaryKeyHashFromRow($row, 0);
|
$key = CcServiceRegisterPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||||
if (null !== ($obj = CcComponentPeer::getInstanceFromPool($key))) {
|
if (null !== ($obj = CcServiceRegisterPeer::getInstanceFromPool($key))) {
|
||||||
// We no longer rehydrate the object, since this can cause data loss.
|
// We no longer rehydrate the object, since this can cause data loss.
|
||||||
// See http://www.propelorm.org/ticket/509
|
// See http://www.propelorm.org/ticket/509
|
||||||
// $obj->hydrate($row, 0, true); // rehydrate
|
// $obj->hydrate($row, 0, true); // rehydrate
|
||||||
|
@ -403,7 +403,7 @@ abstract class BaseCcComponentPeer {
|
||||||
$obj = new $cls();
|
$obj = new $cls();
|
||||||
$obj->hydrate($row);
|
$obj->hydrate($row);
|
||||||
$results[] = $obj;
|
$results[] = $obj;
|
||||||
CcComponentPeer::addInstanceToPool($obj, $key);
|
CcServiceRegisterPeer::addInstanceToPool($obj, $key);
|
||||||
} // if key exists
|
} // if key exists
|
||||||
}
|
}
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
@ -416,21 +416,21 @@ abstract class BaseCcComponentPeer {
|
||||||
* @param int $startcol The 0-based offset for reading from the resultset row.
|
* @param int $startcol The 0-based offset for reading from the resultset row.
|
||||||
* @throws PropelException Any exceptions caught during processing will be
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
* rethrown wrapped into a PropelException.
|
* rethrown wrapped into a PropelException.
|
||||||
* @return array (CcComponent object, last column rank)
|
* @return array (CcServiceRegister object, last column rank)
|
||||||
*/
|
*/
|
||||||
public static function populateObject($row, $startcol = 0)
|
public static function populateObject($row, $startcol = 0)
|
||||||
{
|
{
|
||||||
$key = CcComponentPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
$key = CcServiceRegisterPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||||
if (null !== ($obj = CcComponentPeer::getInstanceFromPool($key))) {
|
if (null !== ($obj = CcServiceRegisterPeer::getInstanceFromPool($key))) {
|
||||||
// We no longer rehydrate the object, since this can cause data loss.
|
// We no longer rehydrate the object, since this can cause data loss.
|
||||||
// See http://www.propelorm.org/ticket/509
|
// See http://www.propelorm.org/ticket/509
|
||||||
// $obj->hydrate($row, $startcol, true); // rehydrate
|
// $obj->hydrate($row, $startcol, true); // rehydrate
|
||||||
$col = $startcol + CcComponentPeer::NUM_COLUMNS;
|
$col = $startcol + CcServiceRegisterPeer::NUM_COLUMNS;
|
||||||
} else {
|
} else {
|
||||||
$cls = CcComponentPeer::OM_CLASS;
|
$cls = CcServiceRegisterPeer::OM_CLASS;
|
||||||
$obj = new $cls();
|
$obj = new $cls();
|
||||||
$col = $obj->hydrate($row, $startcol);
|
$col = $obj->hydrate($row, $startcol);
|
||||||
CcComponentPeer::addInstanceToPool($obj, $key);
|
CcServiceRegisterPeer::addInstanceToPool($obj, $key);
|
||||||
}
|
}
|
||||||
return array($obj, $col);
|
return array($obj, $col);
|
||||||
}
|
}
|
||||||
|
@ -451,10 +451,10 @@ abstract class BaseCcComponentPeer {
|
||||||
*/
|
*/
|
||||||
public static function buildTableMap()
|
public static function buildTableMap()
|
||||||
{
|
{
|
||||||
$dbMap = Propel::getDatabaseMap(BaseCcComponentPeer::DATABASE_NAME);
|
$dbMap = Propel::getDatabaseMap(BaseCcServiceRegisterPeer::DATABASE_NAME);
|
||||||
if (!$dbMap->hasTable(BaseCcComponentPeer::TABLE_NAME))
|
if (!$dbMap->hasTable(BaseCcServiceRegisterPeer::TABLE_NAME))
|
||||||
{
|
{
|
||||||
$dbMap->addTableObject(new CcComponentTableMap());
|
$dbMap->addTableObject(new CcServiceRegisterTableMap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,13 +471,13 @@ abstract class BaseCcComponentPeer {
|
||||||
*/
|
*/
|
||||||
public static function getOMClass($withPrefix = true)
|
public static function getOMClass($withPrefix = true)
|
||||||
{
|
{
|
||||||
return $withPrefix ? CcComponentPeer::CLASS_DEFAULT : CcComponentPeer::OM_CLASS;
|
return $withPrefix ? CcServiceRegisterPeer::CLASS_DEFAULT : CcServiceRegisterPeer::OM_CLASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method perform an INSERT on the database, given a CcComponent or Criteria object.
|
* Method perform an INSERT on the database, given a CcServiceRegister or Criteria object.
|
||||||
*
|
*
|
||||||
* @param mixed $values Criteria or CcComponent object containing data that is used to create the INSERT statement.
|
* @param mixed $values Criteria or CcServiceRegister object containing data that is used to create the INSERT statement.
|
||||||
* @param PropelPDO $con the PropelPDO connection to use
|
* @param PropelPDO $con the PropelPDO connection to use
|
||||||
* @return mixed The new primary key.
|
* @return mixed The new primary key.
|
||||||
* @throws PropelException Any exceptions caught during processing will be
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
@ -486,13 +486,13 @@ abstract class BaseCcComponentPeer {
|
||||||
public static function doInsert($values, PropelPDO $con = null)
|
public static function doInsert($values, PropelPDO $con = null)
|
||||||
{
|
{
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(CcComponentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
$con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($values instanceof Criteria) {
|
if ($values instanceof Criteria) {
|
||||||
$criteria = clone $values; // rename for clarity
|
$criteria = clone $values; // rename for clarity
|
||||||
} else {
|
} else {
|
||||||
$criteria = $values->buildCriteria(); // build Criteria from CcComponent object
|
$criteria = $values->buildCriteria(); // build Criteria from CcServiceRegister object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -514,9 +514,9 @@ abstract class BaseCcComponentPeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method perform an UPDATE on the database, given a CcComponent or Criteria object.
|
* Method perform an UPDATE on the database, given a CcServiceRegister or Criteria object.
|
||||||
*
|
*
|
||||||
* @param mixed $values Criteria or CcComponent object containing data that is used to create the UPDATE statement.
|
* @param mixed $values Criteria or CcServiceRegister object containing data that is used to create the UPDATE statement.
|
||||||
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
|
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
|
||||||
* @return int The number of affected rows (if supported by underlying database driver).
|
* @return int The number of affected rows (if supported by underlying database driver).
|
||||||
* @throws PropelException Any exceptions caught during processing will be
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
@ -525,7 +525,7 @@ abstract class BaseCcComponentPeer {
|
||||||
public static function doUpdate($values, PropelPDO $con = null)
|
public static function doUpdate($values, PropelPDO $con = null)
|
||||||
{
|
{
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(CcComponentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
$con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
$selectCriteria = new Criteria(self::DATABASE_NAME);
|
$selectCriteria = new Criteria(self::DATABASE_NAME);
|
||||||
|
@ -533,15 +533,15 @@ abstract class BaseCcComponentPeer {
|
||||||
if ($values instanceof Criteria) {
|
if ($values instanceof Criteria) {
|
||||||
$criteria = clone $values; // rename for clarity
|
$criteria = clone $values; // rename for clarity
|
||||||
|
|
||||||
$comparison = $criteria->getComparison(CcComponentPeer::NAME);
|
$comparison = $criteria->getComparison(CcServiceRegisterPeer::NAME);
|
||||||
$value = $criteria->remove(CcComponentPeer::NAME);
|
$value = $criteria->remove(CcServiceRegisterPeer::NAME);
|
||||||
if ($value) {
|
if ($value) {
|
||||||
$selectCriteria->add(CcComponentPeer::NAME, $value, $comparison);
|
$selectCriteria->add(CcServiceRegisterPeer::NAME, $value, $comparison);
|
||||||
} else {
|
} else {
|
||||||
$selectCriteria->setPrimaryTableName(CcComponentPeer::TABLE_NAME);
|
$selectCriteria->setPrimaryTableName(CcServiceRegisterPeer::TABLE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { // $values is CcComponent object
|
} else { // $values is CcServiceRegister object
|
||||||
$criteria = $values->buildCriteria(); // gets full criteria
|
$criteria = $values->buildCriteria(); // gets full criteria
|
||||||
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
|
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
|
||||||
}
|
}
|
||||||
|
@ -553,26 +553,26 @@ abstract class BaseCcComponentPeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to DELETE all rows from the cc_component table.
|
* Method to DELETE all rows from the cc_service_register table.
|
||||||
*
|
*
|
||||||
* @return int The number of affected rows (if supported by underlying database driver).
|
* @return int The number of affected rows (if supported by underlying database driver).
|
||||||
*/
|
*/
|
||||||
public static function doDeleteAll($con = null)
|
public static function doDeleteAll($con = null)
|
||||||
{
|
{
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(CcComponentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
$con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||||
}
|
}
|
||||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||||
try {
|
try {
|
||||||
// use transaction because $criteria could contain info
|
// use transaction because $criteria could contain info
|
||||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||||
$con->beginTransaction();
|
$con->beginTransaction();
|
||||||
$affectedRows += BasePeer::doDeleteAll(CcComponentPeer::TABLE_NAME, $con, CcComponentPeer::DATABASE_NAME);
|
$affectedRows += BasePeer::doDeleteAll(CcServiceRegisterPeer::TABLE_NAME, $con, CcServiceRegisterPeer::DATABASE_NAME);
|
||||||
// Because this db requires some delete cascade/set null emulation, we have to
|
// Because this db requires some delete cascade/set null emulation, we have to
|
||||||
// clear the cached instance *after* the emulation has happened (since
|
// clear the cached instance *after* the emulation has happened (since
|
||||||
// instances get re-added by the select statement contained therein).
|
// instances get re-added by the select statement contained therein).
|
||||||
CcComponentPeer::clearInstancePool();
|
CcServiceRegisterPeer::clearInstancePool();
|
||||||
CcComponentPeer::clearRelatedInstancePool();
|
CcServiceRegisterPeer::clearRelatedInstancePool();
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $affectedRows;
|
return $affectedRows;
|
||||||
} catch (PropelException $e) {
|
} catch (PropelException $e) {
|
||||||
|
@ -582,9 +582,9 @@ abstract class BaseCcComponentPeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method perform a DELETE on the database, given a CcComponent or Criteria object OR a primary key value.
|
* Method perform a DELETE on the database, given a CcServiceRegister or Criteria object OR a primary key value.
|
||||||
*
|
*
|
||||||
* @param mixed $values Criteria or CcComponent object or primary key or array of primary keys
|
* @param mixed $values Criteria or CcServiceRegister object or primary key or array of primary keys
|
||||||
* which is used to create the DELETE statement
|
* which is used to create the DELETE statement
|
||||||
* @param PropelPDO $con the connection to use
|
* @param PropelPDO $con the connection to use
|
||||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||||
|
@ -595,27 +595,27 @@ abstract class BaseCcComponentPeer {
|
||||||
public static function doDelete($values, PropelPDO $con = null)
|
public static function doDelete($values, PropelPDO $con = null)
|
||||||
{
|
{
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(CcComponentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
$con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($values instanceof Criteria) {
|
if ($values instanceof Criteria) {
|
||||||
// invalidate the cache for all objects of this type, since we have no
|
// invalidate the cache for all objects of this type, since we have no
|
||||||
// way of knowing (without running a query) what objects should be invalidated
|
// way of knowing (without running a query) what objects should be invalidated
|
||||||
// from the cache based on this Criteria.
|
// from the cache based on this Criteria.
|
||||||
CcComponentPeer::clearInstancePool();
|
CcServiceRegisterPeer::clearInstancePool();
|
||||||
// rename for clarity
|
// rename for clarity
|
||||||
$criteria = clone $values;
|
$criteria = clone $values;
|
||||||
} elseif ($values instanceof CcComponent) { // it's a model object
|
} elseif ($values instanceof CcServiceRegister) { // it's a model object
|
||||||
// invalidate the cache for this single object
|
// invalidate the cache for this single object
|
||||||
CcComponentPeer::removeInstanceFromPool($values);
|
CcServiceRegisterPeer::removeInstanceFromPool($values);
|
||||||
// create criteria based on pk values
|
// create criteria based on pk values
|
||||||
$criteria = $values->buildPkeyCriteria();
|
$criteria = $values->buildPkeyCriteria();
|
||||||
} else { // it's a primary key, or an array of pks
|
} else { // it's a primary key, or an array of pks
|
||||||
$criteria = new Criteria(self::DATABASE_NAME);
|
$criteria = new Criteria(self::DATABASE_NAME);
|
||||||
$criteria->add(CcComponentPeer::NAME, (array) $values, Criteria::IN);
|
$criteria->add(CcServiceRegisterPeer::NAME, (array) $values, Criteria::IN);
|
||||||
// invalidate the cache for this object(s)
|
// invalidate the cache for this object(s)
|
||||||
foreach ((array) $values as $singleval) {
|
foreach ((array) $values as $singleval) {
|
||||||
CcComponentPeer::removeInstanceFromPool($singleval);
|
CcServiceRegisterPeer::removeInstanceFromPool($singleval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,7 +630,7 @@ abstract class BaseCcComponentPeer {
|
||||||
$con->beginTransaction();
|
$con->beginTransaction();
|
||||||
|
|
||||||
$affectedRows += BasePeer::doDelete($criteria, $con);
|
$affectedRows += BasePeer::doDelete($criteria, $con);
|
||||||
CcComponentPeer::clearRelatedInstancePool();
|
CcServiceRegisterPeer::clearRelatedInstancePool();
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $affectedRows;
|
return $affectedRows;
|
||||||
} catch (PropelException $e) {
|
} catch (PropelException $e) {
|
||||||
|
@ -640,24 +640,24 @@ abstract class BaseCcComponentPeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates all modified columns of given CcComponent object.
|
* Validates all modified columns of given CcServiceRegister object.
|
||||||
* If parameter $columns is either a single column name or an array of column names
|
* If parameter $columns is either a single column name or an array of column names
|
||||||
* than only those columns are validated.
|
* than only those columns are validated.
|
||||||
*
|
*
|
||||||
* NOTICE: This does not apply to primary or foreign keys for now.
|
* NOTICE: This does not apply to primary or foreign keys for now.
|
||||||
*
|
*
|
||||||
* @param CcComponent $obj The object to validate.
|
* @param CcServiceRegister $obj The object to validate.
|
||||||
* @param mixed $cols Column name or array of column names.
|
* @param mixed $cols Column name or array of column names.
|
||||||
*
|
*
|
||||||
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
|
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
|
||||||
*/
|
*/
|
||||||
public static function doValidate(CcComponent $obj, $cols = null)
|
public static function doValidate(CcServiceRegister $obj, $cols = null)
|
||||||
{
|
{
|
||||||
$columns = array();
|
$columns = array();
|
||||||
|
|
||||||
if ($cols) {
|
if ($cols) {
|
||||||
$dbMap = Propel::getDatabaseMap(CcComponentPeer::DATABASE_NAME);
|
$dbMap = Propel::getDatabaseMap(CcServiceRegisterPeer::DATABASE_NAME);
|
||||||
$tableMap = $dbMap->getTable(CcComponentPeer::TABLE_NAME);
|
$tableMap = $dbMap->getTable(CcServiceRegisterPeer::TABLE_NAME);
|
||||||
|
|
||||||
if (! is_array($cols)) {
|
if (! is_array($cols)) {
|
||||||
$cols = array($cols);
|
$cols = array($cols);
|
||||||
|
@ -673,7 +673,7 @@ abstract class BaseCcComponentPeer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return BasePeer::doValidate(CcComponentPeer::DATABASE_NAME, CcComponentPeer::TABLE_NAME, $columns);
|
return BasePeer::doValidate(CcServiceRegisterPeer::DATABASE_NAME, CcServiceRegisterPeer::TABLE_NAME, $columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -681,23 +681,23 @@ abstract class BaseCcComponentPeer {
|
||||||
*
|
*
|
||||||
* @param string $pk the primary key.
|
* @param string $pk the primary key.
|
||||||
* @param PropelPDO $con the connection to use
|
* @param PropelPDO $con the connection to use
|
||||||
* @return CcComponent
|
* @return CcServiceRegister
|
||||||
*/
|
*/
|
||||||
public static function retrieveByPK($pk, PropelPDO $con = null)
|
public static function retrieveByPK($pk, PropelPDO $con = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (null !== ($obj = CcComponentPeer::getInstanceFromPool((string) $pk))) {
|
if (null !== ($obj = CcServiceRegisterPeer::getInstanceFromPool((string) $pk))) {
|
||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(CcComponentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
$con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
$criteria = new Criteria(CcComponentPeer::DATABASE_NAME);
|
$criteria = new Criteria(CcServiceRegisterPeer::DATABASE_NAME);
|
||||||
$criteria->add(CcComponentPeer::NAME, $pk);
|
$criteria->add(CcServiceRegisterPeer::NAME, $pk);
|
||||||
|
|
||||||
$v = CcComponentPeer::doSelect($criteria, $con);
|
$v = CcServiceRegisterPeer::doSelect($criteria, $con);
|
||||||
|
|
||||||
return !empty($v) > 0 ? $v[0] : null;
|
return !empty($v) > 0 ? $v[0] : null;
|
||||||
}
|
}
|
||||||
|
@ -713,23 +713,23 @@ abstract class BaseCcComponentPeer {
|
||||||
public static function retrieveByPKs($pks, PropelPDO $con = null)
|
public static function retrieveByPKs($pks, PropelPDO $con = null)
|
||||||
{
|
{
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(CcComponentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
$con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
$objs = null;
|
$objs = null;
|
||||||
if (empty($pks)) {
|
if (empty($pks)) {
|
||||||
$objs = array();
|
$objs = array();
|
||||||
} else {
|
} else {
|
||||||
$criteria = new Criteria(CcComponentPeer::DATABASE_NAME);
|
$criteria = new Criteria(CcServiceRegisterPeer::DATABASE_NAME);
|
||||||
$criteria->add(CcComponentPeer::NAME, $pks, Criteria::IN);
|
$criteria->add(CcServiceRegisterPeer::NAME, $pks, Criteria::IN);
|
||||||
$objs = CcComponentPeer::doSelect($criteria, $con);
|
$objs = CcServiceRegisterPeer::doSelect($criteria, $con);
|
||||||
}
|
}
|
||||||
return $objs;
|
return $objs;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // BaseCcComponentPeer
|
} // BaseCcServiceRegisterPeer
|
||||||
|
|
||||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
//
|
//
|
||||||
BaseCcComponentPeer::buildTableMap();
|
BaseCcServiceRegisterPeer::buildTableMap();
|
||||||
|
|
|
@ -2,60 +2,60 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class that represents a query for the 'cc_component' table.
|
* Base class that represents a query for the 'cc_service_register' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @method CcComponentQuery orderByDbName($order = Criteria::ASC) Order by the name column
|
* @method CcServiceRegisterQuery orderByDbName($order = Criteria::ASC) Order by the name column
|
||||||
* @method CcComponentQuery orderByDbIp($order = Criteria::ASC) Order by the ip column
|
* @method CcServiceRegisterQuery orderByDbIp($order = Criteria::ASC) Order by the ip column
|
||||||
*
|
*
|
||||||
* @method CcComponentQuery groupByDbName() Group by the name column
|
* @method CcServiceRegisterQuery groupByDbName() Group by the name column
|
||||||
* @method CcComponentQuery groupByDbIp() Group by the ip column
|
* @method CcServiceRegisterQuery groupByDbIp() Group by the ip column
|
||||||
*
|
*
|
||||||
* @method CcComponentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
* @method CcServiceRegisterQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
* @method CcComponentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
* @method CcServiceRegisterQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
* @method CcComponentQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
* @method CcServiceRegisterQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
*
|
*
|
||||||
* @method CcComponent findOne(PropelPDO $con = null) Return the first CcComponent matching the query
|
* @method CcServiceRegister findOne(PropelPDO $con = null) Return the first CcServiceRegister matching the query
|
||||||
* @method CcComponent findOneOrCreate(PropelPDO $con = null) Return the first CcComponent matching the query, or a new CcComponent object populated from the query conditions when no match is found
|
* @method CcServiceRegister findOneOrCreate(PropelPDO $con = null) Return the first CcServiceRegister matching the query, or a new CcServiceRegister object populated from the query conditions when no match is found
|
||||||
*
|
*
|
||||||
* @method CcComponent findOneByDbName(string $name) Return the first CcComponent filtered by the name column
|
* @method CcServiceRegister findOneByDbName(string $name) Return the first CcServiceRegister filtered by the name column
|
||||||
* @method CcComponent findOneByDbIp(string $ip) Return the first CcComponent filtered by the ip column
|
* @method CcServiceRegister findOneByDbIp(string $ip) Return the first CcServiceRegister filtered by the ip column
|
||||||
*
|
*
|
||||||
* @method array findByDbName(string $name) Return CcComponent objects filtered by the name column
|
* @method array findByDbName(string $name) Return CcServiceRegister objects filtered by the name column
|
||||||
* @method array findByDbIp(string $ip) Return CcComponent objects filtered by the ip column
|
* @method array findByDbIp(string $ip) Return CcServiceRegister objects filtered by the ip column
|
||||||
*
|
*
|
||||||
* @package propel.generator.airtime.om
|
* @package propel.generator.airtime.om
|
||||||
*/
|
*/
|
||||||
abstract class BaseCcComponentQuery extends ModelCriteria
|
abstract class BaseCcServiceRegisterQuery extends ModelCriteria
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes internal state of BaseCcComponentQuery object.
|
* Initializes internal state of BaseCcServiceRegisterQuery object.
|
||||||
*
|
*
|
||||||
* @param string $dbName The dabase name
|
* @param string $dbName The dabase name
|
||||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||||
*/
|
*/
|
||||||
public function __construct($dbName = 'airtime', $modelName = 'CcComponent', $modelAlias = null)
|
public function __construct($dbName = 'airtime', $modelName = 'CcServiceRegister', $modelAlias = null)
|
||||||
{
|
{
|
||||||
parent::__construct($dbName, $modelName, $modelAlias);
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new CcComponentQuery object.
|
* Returns a new CcServiceRegisterQuery object.
|
||||||
*
|
*
|
||||||
* @param string $modelAlias The alias of a model in the query
|
* @param string $modelAlias The alias of a model in the query
|
||||||
* @param Criteria $criteria Optional Criteria to build the query from
|
* @param Criteria $criteria Optional Criteria to build the query from
|
||||||
*
|
*
|
||||||
* @return CcComponentQuery
|
* @return CcServiceRegisterQuery
|
||||||
*/
|
*/
|
||||||
public static function create($modelAlias = null, $criteria = null)
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
{
|
{
|
||||||
if ($criteria instanceof CcComponentQuery) {
|
if ($criteria instanceof CcServiceRegisterQuery) {
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
$query = new CcComponentQuery();
|
$query = new CcServiceRegisterQuery();
|
||||||
if (null !== $modelAlias) {
|
if (null !== $modelAlias) {
|
||||||
$query->setModelAlias($modelAlias);
|
$query->setModelAlias($modelAlias);
|
||||||
}
|
}
|
||||||
|
@ -74,11 +74,11 @@ abstract class BaseCcComponentQuery extends ModelCriteria
|
||||||
* @param mixed $key Primary key to use for the query
|
* @param mixed $key Primary key to use for the query
|
||||||
* @param PropelPDO $con an optional connection object
|
* @param PropelPDO $con an optional connection object
|
||||||
*
|
*
|
||||||
* @return CcComponent|array|mixed the result, formatted by the current formatter
|
* @return CcServiceRegister|array|mixed the result, formatted by the current formatter
|
||||||
*/
|
*/
|
||||||
public function findPk($key, $con = null)
|
public function findPk($key, $con = null)
|
||||||
{
|
{
|
||||||
if ((null !== ($obj = CcComponentPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
|
if ((null !== ($obj = CcServiceRegisterPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
|
||||||
// the object is alredy in the instance pool
|
// the object is alredy in the instance pool
|
||||||
return $obj;
|
return $obj;
|
||||||
} else {
|
} else {
|
||||||
|
@ -114,11 +114,11 @@ abstract class BaseCcComponentQuery extends ModelCriteria
|
||||||
*
|
*
|
||||||
* @param mixed $key Primary key to use for the query
|
* @param mixed $key Primary key to use for the query
|
||||||
*
|
*
|
||||||
* @return CcComponentQuery The current query, for fluid interface
|
* @return CcServiceRegisterQuery The current query, for fluid interface
|
||||||
*/
|
*/
|
||||||
public function filterByPrimaryKey($key)
|
public function filterByPrimaryKey($key)
|
||||||
{
|
{
|
||||||
return $this->addUsingAlias(CcComponentPeer::NAME, $key, Criteria::EQUAL);
|
return $this->addUsingAlias(CcServiceRegisterPeer::NAME, $key, Criteria::EQUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,11 +126,11 @@ abstract class BaseCcComponentQuery extends ModelCriteria
|
||||||
*
|
*
|
||||||
* @param array $keys The list of primary key to use for the query
|
* @param array $keys The list of primary key to use for the query
|
||||||
*
|
*
|
||||||
* @return CcComponentQuery The current query, for fluid interface
|
* @return CcServiceRegisterQuery The current query, for fluid interface
|
||||||
*/
|
*/
|
||||||
public function filterByPrimaryKeys($keys)
|
public function filterByPrimaryKeys($keys)
|
||||||
{
|
{
|
||||||
return $this->addUsingAlias(CcComponentPeer::NAME, $keys, Criteria::IN);
|
return $this->addUsingAlias(CcServiceRegisterPeer::NAME, $keys, Criteria::IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,7 +140,7 @@ abstract class BaseCcComponentQuery extends ModelCriteria
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
*
|
*
|
||||||
* @return CcComponentQuery The current query, for fluid interface
|
* @return CcServiceRegisterQuery The current query, for fluid interface
|
||||||
*/
|
*/
|
||||||
public function filterByDbName($dbName = null, $comparison = null)
|
public function filterByDbName($dbName = null, $comparison = null)
|
||||||
{
|
{
|
||||||
|
@ -152,7 +152,7 @@ abstract class BaseCcComponentQuery extends ModelCriteria
|
||||||
$comparison = Criteria::LIKE;
|
$comparison = Criteria::LIKE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->addUsingAlias(CcComponentPeer::NAME, $dbName, $comparison);
|
return $this->addUsingAlias(CcServiceRegisterPeer::NAME, $dbName, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,7 +162,7 @@ abstract class BaseCcComponentQuery extends ModelCriteria
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
*
|
*
|
||||||
* @return CcComponentQuery The current query, for fluid interface
|
* @return CcServiceRegisterQuery The current query, for fluid interface
|
||||||
*/
|
*/
|
||||||
public function filterByDbIp($dbIp = null, $comparison = null)
|
public function filterByDbIp($dbIp = null, $comparison = null)
|
||||||
{
|
{
|
||||||
|
@ -174,23 +174,23 @@ abstract class BaseCcComponentQuery extends ModelCriteria
|
||||||
$comparison = Criteria::LIKE;
|
$comparison = Criteria::LIKE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->addUsingAlias(CcComponentPeer::IP, $dbIp, $comparison);
|
return $this->addUsingAlias(CcServiceRegisterPeer::IP, $dbIp, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude object from result
|
* Exclude object from result
|
||||||
*
|
*
|
||||||
* @param CcComponent $ccComponent Object to remove from the list of results
|
* @param CcServiceRegister $ccServiceRegister Object to remove from the list of results
|
||||||
*
|
*
|
||||||
* @return CcComponentQuery The current query, for fluid interface
|
* @return CcServiceRegisterQuery The current query, for fluid interface
|
||||||
*/
|
*/
|
||||||
public function prune($ccComponent = null)
|
public function prune($ccServiceRegister = null)
|
||||||
{
|
{
|
||||||
if ($ccComponent) {
|
if ($ccServiceRegister) {
|
||||||
$this->addUsingAlias(CcComponentPeer::NAME, $ccComponent->getDbName(), Criteria::NOT_EQUAL);
|
$this->addUsingAlias(CcServiceRegisterPeer::NAME, $ccServiceRegister->getDbName(), Criteria::NOT_EQUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // BaseCcComponentQuery
|
} // BaseCcServiceRegisterQuery
|
|
@ -1,4 +1,5 @@
|
||||||
<div id="content" class="jp-container">
|
<div id="content" class="jp-container">
|
||||||
|
<h1>Live stream</h1>
|
||||||
<?php $ids = Application_Model_StreamSetting::getEnabledStreamIds(); ?>
|
<?php $ids = Application_Model_StreamSetting::getEnabledStreamIds(); ?>
|
||||||
<script>
|
<script>
|
||||||
function setjPlayer(url, type){
|
function setjPlayer(url, type){
|
||||||
|
@ -18,7 +19,7 @@ function setjPlayer(url, type){
|
||||||
wmode: "window"
|
wmode: "window"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
$("#combo-box").change(function(eventObject){
|
$("#combo-box").change(function(eventObject){
|
||||||
|
@ -55,7 +56,7 @@ $(document).ready(function(){
|
||||||
if ($type == "ogg")
|
if ($type == "ogg")
|
||||||
$type = "oga";
|
$type = "oga";
|
||||||
|
|
||||||
$label = "Stream ".substr($id, 1)." (".$streamData["${id}_bitrate"]." Kbit/s)";
|
$label = $streamData["${id}_description"]." (".$streamData["${id}_bitrate"]." Kbit/s)";
|
||||||
echo sprintf("<option class='stream' value='%s' data-url='%s' data-type='%s'>%s</option>", $id, $url, $type, $label);
|
echo sprintf("<option class='stream' value='%s' data-url='%s' data-type='%s'>%s</option>", $id, $url, $type, $label);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -64,19 +65,20 @@ $(document).ready(function(){
|
||||||
</div>
|
</div>
|
||||||
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
|
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
|
||||||
|
|
||||||
<div id="jp_container_1" class="jp-audio">
|
<div id="jp_container_1" class="jp-audio">
|
||||||
<div class="jp-type-single">
|
<div class="jp-type-single">
|
||||||
<div id="jp_interface_1" class="jp-gui jp-interface">
|
<div id="jp_interface_1" class="jp-gui jp-interface">
|
||||||
<ul class="jp-controls">
|
<ul class="jp-controls">
|
||||||
<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
|
<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
|
||||||
<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
|
<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
|
||||||
<li><a href="javascript:;" class="jp-mute" tabindex="1">mute</a></li>
|
<li><a title="mute" tabindex="1" class="jp-mute" href="javascript:;">mute</a></li>
|
||||||
<li><a href="javascript:;" class="jp-unmute" tabindex="1">unmute</a></li>
|
<li><a title="unmute" tabindex="1" class="jp-unmute" href="javascript:;">unmute</a></li>
|
||||||
</ul>
|
<li><a title="max volume" tabindex="1" class="jp-volume-max" href="javascript:;">max volume</a></li>
|
||||||
</div>
|
</ul>
|
||||||
<div id="jp_playlist_1" class="jp-playlist">
|
<div class="jp-volume-bar">
|
||||||
</div>
|
<div class="jp-volume-bar-value"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="jp_playlist_1" class="jp-playlist"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong stream-config">
|
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong stream-config">
|
||||||
<h2 style="float:left">Stream Settings</h2>
|
<h2 style="float:left">Stream Settings</h2>
|
||||||
<?php if($this->disable_stream_conf != "true"){?>
|
<?php if($this->enable_stream_conf == "true"){?>
|
||||||
<form method="post" action="/Preference/stream-setting" enctype="application/x-www-form-urlencoded">
|
<form method="post" action="/Preference/stream-setting" enctype="application/x-www-form-urlencoded">
|
||||||
<div class="button-bar bottom" id="submit-element" style="float:right">
|
<div class="button-bar bottom" id="submit-element" style="float:right">
|
||||||
<input type="submit" class="ui-button ui-state-default right-floated" value="Save" id="Save" name="Save" />
|
<input type="submit" class="ui-button ui-state-default right-floated" value="Save" id="Save" name="Save" />
|
||||||
|
@ -22,11 +22,11 @@
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<?php
|
<?php
|
||||||
for($i=1;$i<=$this->num_stream;$i++){
|
for($i=1;$i<=$this->num_stream;$i++){
|
||||||
echo $this->form->getSubform("s".$i."_subform");
|
echo $this->form->getSubform("s".$i."_subform");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php if($this->disable_stream_conf != "true"){?>
|
<?php if($this->enable_stream_conf == "true"){?>
|
||||||
<div class="button-bar bottom" id="submit-element">
|
<div class="button-bar bottom" id="submit-element">
|
||||||
<input type="submit" class="ui-button ui-state-default right-floated" value="Save" id="Save" name="Save" />
|
<input type="submit" class="ui-button ui-state-default right-floated" value="Save" id="Save" name="Save" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -327,7 +327,7 @@
|
||||||
<column name="ip" phpName="DbIP" primaryKey="true" type="VARCHAR" size="32" required="true"/>
|
<column name="ip" phpName="DbIP" primaryKey="true" type="VARCHAR" size="32" required="true"/>
|
||||||
<column name="attempts" phpName="DbAttempts" type="INTEGER" required="false" defaultValue="0"/>
|
<column name="attempts" phpName="DbAttempts" type="INTEGER" required="false" defaultValue="0"/>
|
||||||
</table>
|
</table>
|
||||||
<table name="cc_component" phpName="CcComponent">
|
<table name="cc_service_register" phpName="CcServiceRegister">
|
||||||
<column name="name" phpName="DbName" primaryKey="true" type="VARCHAR" size="32" required="true" />
|
<column name="name" phpName="DbName" primaryKey="true" type="VARCHAR" size="32" required="true" />
|
||||||
<column name="ip" phpName="DbIp" type="VARCHAR" size="18" required="true"/>
|
<column name="ip" phpName="DbIp" type="VARCHAR" size="18" required="true"/>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -502,20 +502,20 @@ COMMENT ON TABLE "cc_login_attempts" IS '';
|
||||||
|
|
||||||
SET search_path TO public;
|
SET search_path TO public;
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- cc_component
|
-- cc_service_register
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
DROP TABLE "cc_component" CASCADE;
|
DROP TABLE "cc_service_register" CASCADE;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE "cc_component"
|
CREATE TABLE "cc_service_register"
|
||||||
(
|
(
|
||||||
"name" VARCHAR(32) NOT NULL,
|
"name" VARCHAR(32) NOT NULL,
|
||||||
"ip" VARCHAR(18) NOT NULL,
|
"ip" VARCHAR(18) NOT NULL,
|
||||||
PRIMARY KEY ("name")
|
PRIMARY KEY ("name")
|
||||||
);
|
);
|
||||||
|
|
||||||
COMMENT ON TABLE "cc_component" IS '';
|
COMMENT ON TABLE "cc_service_register" IS '';
|
||||||
|
|
||||||
|
|
||||||
SET search_path TO public;
|
SET search_path TO public;
|
||||||
|
|
|
@ -249,6 +249,8 @@ function setupQtip(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var stream_window = null;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
//begin producer "thread"
|
//begin producer "thread"
|
||||||
getScheduleFromServer();
|
getScheduleFromServer();
|
||||||
|
@ -259,8 +261,9 @@ function init() {
|
||||||
setupQtip();
|
setupQtip();
|
||||||
|
|
||||||
$('#on-air-info').click(function() {
|
$('#on-air-info').click(function() {
|
||||||
newwindow=window.open("Dashboard/stream-player", 'name', 'width=380,height=168');
|
if (stream_window == null || stream_window.closed)
|
||||||
if (window.focus) {newwindow.focus()}
|
stream_window=window.open(baseUrl+"Dashboard/stream-player", 'name', 'width=400,height=216');
|
||||||
|
stream_window.focus();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,27 @@
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
width:400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.jp-container h1 {
|
||||||
|
background: #282828;
|
||||||
|
font-size:18px;
|
||||||
|
text-align:center;
|
||||||
|
color:#CCC;
|
||||||
|
margin: 0;
|
||||||
|
padding: 8px 0;
|
||||||
|
font-weight:normal;
|
||||||
|
border-bottom:1px solid #000;
|
||||||
|
background-color:#3D3D3D;
|
||||||
|
background: linear-gradient(top, #3c3c3c 0, #1a1a1a 100%);
|
||||||
|
background: -moz-linear-gradient(top, #3c3c3c 0, #1a1a1a 100%);
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #3c3c3c), color-stop(100%, #1a1a1a));
|
||||||
|
text-shadow: 0px -1px 1px #000;
|
||||||
|
}
|
||||||
|
|
||||||
.jp-logo {
|
.jp-logo {
|
||||||
width:380px;
|
width:400px;
|
||||||
height: 67px;
|
height: 67px;
|
||||||
background:#282828 url(../../../css/images/airtime_logo_jp.png) no-repeat 120px 14px;
|
background:#282828 url(../../../css/images/airtime_logo_jp.png) no-repeat 120px 14px;
|
||||||
background: url(../../../css/images/airtime_logo_jp.png) no-repeat 120px 14px, -moz-radial-gradient(200px 0px, circle cover, rgba(70,70,70,1) 0%, rgba(40,40,40,1) 90%);
|
background: url(../../../css/images/airtime_logo_jp.png) no-repeat 120px 14px, -moz-radial-gradient(200px 0px, circle cover, rgba(70,70,70,1) 0%, rgba(40,40,40,1) 90%);
|
||||||
|
@ -29,7 +47,7 @@
|
||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
.jp-stream {
|
.jp-stream {
|
||||||
height: 18px;
|
height: 27px;
|
||||||
display:block;
|
display:block;
|
||||||
border-top:1px solid #050505;
|
border-top:1px solid #050505;
|
||||||
color:#ff5d1a;
|
color:#ff5d1a;
|
||||||
|
@ -41,6 +59,7 @@
|
||||||
box-shadow: rgba(248,248,248,.3) 0px 1px 0px, rgba(0, 0, 0, 0.2) 0 2px 2px inset;
|
box-shadow: rgba(248,248,248,.3) 0px 1px 0px, rgba(0, 0, 0, 0.2) 0 2px 2px inset;
|
||||||
-moz-box-shadow: rgba(0, 0, 0, 0.7) 0 0 5px inset;
|
-moz-box-shadow: rgba(0, 0, 0, 0.7) 0 0 5px inset;
|
||||||
-webkit-box-shadow: rgba(0, 0, 0, 0.7) 0 0 5px inset;
|
-webkit-box-shadow: rgba(0, 0, 0, 0.7) 0 0 5px inset;
|
||||||
|
line-height:23px;
|
||||||
}
|
}
|
||||||
.jp-stream-text,
|
.jp-stream-text,
|
||||||
.jp-stream form {
|
.jp-stream form {
|
||||||
|
@ -56,6 +75,23 @@
|
||||||
}
|
}
|
||||||
.jp-stream label input[type="radio"] {
|
.jp-stream label input[type="radio"] {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.jp-stream form input[type="text"], .jp-stream form select {
|
||||||
|
background-color: #212121;
|
||||||
|
border: 1px solid #1a1a1a;
|
||||||
|
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.5) inset;
|
||||||
|
-moz-box-shadow: 0 2px 2px rgba(0, 0, 0, 0.5) inset;
|
||||||
|
-webkit-box-shadow: 0 2px 2px rgba(0, 0, 0, 0.5) inset;
|
||||||
|
color: #767676;
|
||||||
|
font-family: Arial,Helvetica,sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
height: 25px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 2px 2px 2px 0;
|
||||||
|
vertical-align: top;
|
||||||
|
width:200px;
|
||||||
|
}
|
||||||
|
|
||||||
div.jp-audio,
|
div.jp-audio,
|
||||||
div.jp-video {
|
div.jp-video {
|
||||||
|
|
||||||
|
@ -282,14 +318,15 @@ div.jp-seeking-bg {
|
||||||
}
|
}
|
||||||
|
|
||||||
a.jp-mute,
|
a.jp-mute,
|
||||||
a.jp-unmute {
|
a.jp-unmute,
|
||||||
width:30px;
|
a.jp-volume-max {
|
||||||
height:30px;
|
width:20px;
|
||||||
|
height:20px;
|
||||||
}
|
}
|
||||||
div.jp-audio div.jp-type-single a.jp-mute,
|
div.jp-audio div.jp-type-single a.jp-mute,
|
||||||
div.jp-audio div.jp-type-single a.jp-unmute {
|
div.jp-audio div.jp-type-single a.jp-unmute {
|
||||||
top:22px;
|
top:30px;
|
||||||
left:300px;
|
left:227px;
|
||||||
}
|
}
|
||||||
div.jp-audio div.jp-type-playlist a.jp-mute,
|
div.jp-audio div.jp-type-playlist a.jp-mute,
|
||||||
div.jp-audio div.jp-type-playlist a.jp-unmute {
|
div.jp-audio div.jp-type-playlist a.jp-unmute {
|
||||||
|
@ -317,29 +354,45 @@ div.jp-video-360p div.jp-type-playlist a.jp-unmute {
|
||||||
left:443px;
|
left:443px;
|
||||||
}
|
}
|
||||||
a.jp-mute {
|
a.jp-mute {
|
||||||
background: url("jplayer.png") 0 -110px no-repeat;
|
background: url("jplayer.png") 0 -90px no-repeat;
|
||||||
}
|
}
|
||||||
a.jp-mute:hover {
|
a.jp-mute:hover {
|
||||||
background: url("jplayer.png") -30px -80px no-repeat;
|
background: url("jplayer.png") -30px -90px no-repeat;
|
||||||
}
|
}
|
||||||
a.jp-unmute {
|
a.jp-unmute {
|
||||||
background: url("jplayer.png") 0 -80px no-repeat;
|
background: url("jplayer.png") -61px -90px no-repeat;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
a.jp-unmute:hover {
|
a.jp-unmute:hover {
|
||||||
background: url("jplayer.png") -30px -110px no-repeat;
|
background: url("jplayer.png") -91px -90px no-repeat;
|
||||||
|
}
|
||||||
|
div.jp-interface ul.jp-controls a.jp-volume-max {
|
||||||
|
background: url("jplayer.png") no-repeat scroll 0 -110px transparent;
|
||||||
|
}
|
||||||
|
div.jp-interface ul.jp-controls a.jp-volume-max:hover {
|
||||||
|
background: url("jplayer.png") no-repeat scroll -30px -110px transparent;
|
||||||
|
}
|
||||||
|
div.jp-audio ul.jp-controls a.jp-volume-max {
|
||||||
|
left: 340px;
|
||||||
|
top: 28px;
|
||||||
}
|
}
|
||||||
div.jp-volume-bar {
|
div.jp-volume-bar {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
background: url("jplayer.png") 0 -250px repeat-x;
|
background:#393939;
|
||||||
width:46px;
|
-moz-box-shadow: rgba(0, 0, 0, 0.5) 0 0 1px inset;
|
||||||
height:5px;
|
-webkit-box-shadow: rgba(0, 0, 0, 0.5) 0 0 1px inset;
|
||||||
|
border-bottom:1px solid #5e5e5e;
|
||||||
|
border-top:1px solid #262526;
|
||||||
|
border-left:1px solid #262526;
|
||||||
|
border-right:1px solid #262526;
|
||||||
|
width:130px;
|
||||||
|
height:4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
div.jp-audio div.jp-type-single div.jp-volume-bar {
|
div.jp-audio div.jp-type-single div.jp-volume-bar {
|
||||||
top:37px;
|
top:48px;
|
||||||
left:302px;
|
left:225px;
|
||||||
}
|
}
|
||||||
div.jp-audio div.jp-type-playlist div.jp-volume-bar {
|
div.jp-audio div.jp-type-playlist div.jp-volume-bar {
|
||||||
top:37px;
|
top:37px;
|
||||||
|
@ -361,9 +414,11 @@ div.jp-video-360p div.jp-type-playlist div.jp-volume-bar {
|
||||||
left:471px;
|
left:471px;
|
||||||
}
|
}
|
||||||
div.jp-volume-bar-value {
|
div.jp-volume-bar-value {
|
||||||
background: url("jplayer.png") 0 -256px repeat-x;
|
background-color:#fb7018;
|
||||||
|
background: -moz-linear-gradient(top, #fc9318 0, #e56815 100%);
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fc9318), color-stop(100%, #e56815));
|
||||||
width:0px;
|
width:0px;
|
||||||
height:5px;
|
height:3px;
|
||||||
}
|
}
|
||||||
div.jp-current-time,
|
div.jp-current-time,
|
||||||
div.jp-duration {
|
div.jp-duration {
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 6.5 KiB |
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Migrations\AbstractMigration,
|
||||||
|
Doctrine\DBAL\Schema\Schema;
|
||||||
|
|
||||||
|
class Version20110929184401 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function up(Schema $schema)
|
||||||
|
{
|
||||||
|
$cc_component = $schema->createTable('cc_service_register');
|
||||||
|
$cc_component->addColumn('name', 'string', array('length' => 32));
|
||||||
|
$cc_component->addColumn('ip', 'string', array('length' => 18));
|
||||||
|
|
||||||
|
$cc_component->setPrimaryKey(array('name'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,11 +33,10 @@ python ${SCRIPTPATH}/../python_apps/create-pypo-user.py
|
||||||
set +e
|
set +e
|
||||||
php --php-ini ${SCRIPTPATH}/airtime-php.ini ${SCRIPTPATH}/include/airtime-install.php $@
|
php --php-ini ${SCRIPTPATH}/airtime-php.ini ${SCRIPTPATH}/include/airtime-install.php $@
|
||||||
result=$?
|
result=$?
|
||||||
if [ "$result" -eq "2" ]; then
|
|
||||||
#We've just finished an upgrade, so let's exit
|
if [ "$result" -ne "0" ]; then
|
||||||
exit 0
|
|
||||||
elif [ "$result" -ne "0" ]; then
|
|
||||||
#There was an error, exit with error code.
|
#There was an error, exit with error code.
|
||||||
|
echo "There was an error during upgrade. Exit code $result"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
set -e
|
set -e
|
||||||
|
|
|
@ -64,8 +64,7 @@ if (isset($version) && ($version != false) && ($version < AIRTIME_VERSION) && !i
|
||||||
echo "Airtime version $version found.".PHP_EOL;
|
echo "Airtime version $version found.".PHP_EOL;
|
||||||
|
|
||||||
require_once("airtime-upgrade.php");
|
require_once("airtime-upgrade.php");
|
||||||
|
exit(0);
|
||||||
exit(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($version === false){
|
if($version === false){
|
||||||
|
|
|
@ -19,6 +19,25 @@ if(exec("whoami") != "root"){
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This class is responsible for tasks that need to be executed only *once*
|
||||||
|
* per upgrade, even if it's upgrading over multiple versions of Airtime. */
|
||||||
|
class AirtimeMasterUpgrade{
|
||||||
|
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
||||||
|
|
||||||
|
public static function InstallAirtimePhpServerCode($phpDir)
|
||||||
|
{
|
||||||
|
$AIRTIME_SRC = realpath(__DIR__.'/../../airtime_mvc');
|
||||||
|
|
||||||
|
// delete old files
|
||||||
|
exec("rm -rf \"$phpDir\"");
|
||||||
|
echo "* Installing PHP code to ".$phpDir.PHP_EOL;
|
||||||
|
exec("mkdir -p ".$phpDir);
|
||||||
|
exec("cp -R ".$AIRTIME_SRC."/* ".$phpDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
global $CC_DBC, $CC_CONFIG;
|
global $CC_DBC, $CC_CONFIG;
|
||||||
|
|
||||||
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
||||||
|
@ -86,10 +105,18 @@ if (strcmp($version, "2.0.0") < 0){
|
||||||
$sql = "DELETE FROM cc_pref WHERE keystr = 'system_version'";
|
$sql = "DELETE FROM cc_pref WHERE keystr = 'system_version'";
|
||||||
$CC_DBC->query($sql);
|
$CC_DBC->query($sql);
|
||||||
|
|
||||||
|
$values = parse_ini_file(AirtimeMasterUpgrade::CONF_FILE_AIRTIME, true);
|
||||||
|
$phpDir = $values['general']['airtime_dir'];
|
||||||
|
AirtimeMasterUpgrade::InstallAirtimePhpServerCode($phpDir);
|
||||||
|
AirtimeInstall::InstallBinaries();
|
||||||
|
AirtimeInstall::CreateSymlinksToUtils();
|
||||||
|
|
||||||
|
|
||||||
$newVersion = AIRTIME_VERSION;
|
$newVersion = AIRTIME_VERSION;
|
||||||
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '$newVersion')";
|
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '$newVersion')";
|
||||||
$CC_DBC->query($sql);
|
$CC_DBC->query($sql);
|
||||||
|
|
||||||
|
/*
|
||||||
echo PHP_EOL."*** Updating Api Client ***".PHP_EOL;
|
echo PHP_EOL."*** Updating Api Client ***".PHP_EOL;
|
||||||
passthru("python $SCRIPTPATH/../../python_apps/api_clients/install/api_client_install.py");
|
passthru("python $SCRIPTPATH/../../python_apps/api_clients/install/api_client_install.py");
|
||||||
|
|
||||||
|
@ -108,3 +135,4 @@ sleep(4);
|
||||||
passthru("airtime-check-system");
|
passthru("airtime-check-system");
|
||||||
|
|
||||||
echo "******************************* Update Complete *******************************".PHP_EOL;
|
echo "******************************* Update Complete *******************************".PHP_EOL;
|
||||||
|
*/
|
||||||
|
|
|
@ -0,0 +1,206 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/* These are helper functions that are common to each upgrade such as
|
||||||
|
* creating connections to a database, backing up config files etc.
|
||||||
|
*/
|
||||||
|
class UpgradeCommon{
|
||||||
|
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
||||||
|
const CONF_FILE_PYPO = "/etc/airtime/pypo.cfg";
|
||||||
|
const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg";
|
||||||
|
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
|
||||||
|
const CONF_FILE_MEDIAMONITOR = "/etc/airtime/media-monitor.cfg";
|
||||||
|
const CONF_FILE_API_CLIENT = "/etc/airtime/api_client.cfg";
|
||||||
|
|
||||||
|
const CONF_PYPO_GRP = "pypo";
|
||||||
|
const CONF_WWW_DATA_GRP = "www-data";
|
||||||
|
|
||||||
|
public static function DbTableExists($p_name)
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
$sql = "SELECT * FROM ".$p_name;
|
||||||
|
$result = $CC_DBC->GetOne($sql);
|
||||||
|
if (PEAR::isError($result)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function GetAirtimeSrcDir()
|
||||||
|
{
|
||||||
|
return __DIR__."/../../../airtime_mvc";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function MigrateTablesToVersion($dir, $version)
|
||||||
|
{
|
||||||
|
$appDir = self::GetAirtimeSrcDir();
|
||||||
|
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||||
|
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||||
|
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||||
|
"--no-interaction migrations:migrate $version";
|
||||||
|
system($command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function BypassMigrations($dir, $version)
|
||||||
|
{
|
||||||
|
$appDir = self::GetAirtimeSrcDir();
|
||||||
|
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||||
|
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||||
|
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||||
|
"--no-interaction --add migrations:version $version";
|
||||||
|
system($command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function upgradeConfigFiles(){
|
||||||
|
|
||||||
|
$configFiles = array(UpgradeCommon::CONF_FILE_AIRTIME,
|
||||||
|
UpgradeCommon::CONF_FILE_PYPO,
|
||||||
|
UpgradeCommon::CONF_FILE_RECORDER,
|
||||||
|
UpgradeCommon::CONF_FILE_LIQUIDSOAP,
|
||||||
|
UpgradeCommon::CONF_FILE_MEDIAMONITOR,
|
||||||
|
UpgradeCommon::CONF_FILE_API_CLIENT);
|
||||||
|
|
||||||
|
// Backup the config files
|
||||||
|
$suffix = date("Ymdhis")."-".VERSION_NUMBER;
|
||||||
|
foreach ($configFiles as $conf) {
|
||||||
|
// do not back up monit cfg
|
||||||
|
if (file_exists($conf)) {
|
||||||
|
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
|
||||||
|
//copy($conf, $conf.$suffix.".bak");
|
||||||
|
exec("cp -p $conf $conf$suffix.bak"); //use cli version to preserve file attributes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$default_suffix = "200";
|
||||||
|
self::CreateIniFiles($default_suffix);
|
||||||
|
self::MergeConfigFiles($configFiles, $suffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function creates the /etc/airtime configuration folder
|
||||||
|
* and copies the default config files to it.
|
||||||
|
*/
|
||||||
|
public static function CreateIniFiles($suffix)
|
||||||
|
{
|
||||||
|
if (!file_exists("/etc/airtime/")){
|
||||||
|
if (!mkdir("/etc/airtime/", 0755, true)){
|
||||||
|
echo "Could not create /etc/airtime/ directory. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!copy(__DIR__."/airtime.conf.$suffix", self::CONF_FILE_AIRTIME)){
|
||||||
|
echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!copy(__DIR__."/pypo.cfg.$suffix", self::CONF_FILE_PYPO)){
|
||||||
|
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!copy(__DIR__."/recorder.cfg.$suffix", self::CONF_FILE_RECORDER)){
|
||||||
|
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!copy(__DIR__."/api_client.cfg.$suffix", self::CONF_FILE_API_CLIENT)){
|
||||||
|
echo "Could not copy airtime-monit.cfg to /etc/monit/conf.d/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function MergeConfigFiles($configFiles, $suffix) {
|
||||||
|
foreach ($configFiles as $conf) {
|
||||||
|
// we want to use new liquidsoap.cfg so don't merge
|
||||||
|
// also for monit
|
||||||
|
if( $conf == self::CONF_FILE_LIQUIDSOAP){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (file_exists("$conf$suffix.bak")) {
|
||||||
|
|
||||||
|
if($conf === self::CONF_FILE_AIRTIME) {
|
||||||
|
// Parse with sections
|
||||||
|
$newSettings = parse_ini_file($conf, true);
|
||||||
|
$oldSettings = parse_ini_file("$conf$suffix.bak", true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$newSettings = self::ReadPythonConfig($conf);
|
||||||
|
$oldSettings = self::ReadPythonConfig("$conf$suffix.bak");
|
||||||
|
}
|
||||||
|
|
||||||
|
$settings = array_keys($newSettings);
|
||||||
|
|
||||||
|
foreach($settings as $section) {
|
||||||
|
if(isset($oldSettings[$section])) {
|
||||||
|
if(is_array($oldSettings[$section])) {
|
||||||
|
$sectionKeys = array_keys($newSettings[$section]);
|
||||||
|
foreach($sectionKeys as $sectionKey) {
|
||||||
|
// skip airtim_dir as we want to use new value
|
||||||
|
if($sectionKey != "airtime_dir"){
|
||||||
|
if(isset($oldSettings[$section][$sectionKey])) {
|
||||||
|
self::UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self::UpdateIniValue($conf, $section, $oldSettings[$section]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function ReadPythonConfig($p_filename)
|
||||||
|
{
|
||||||
|
$values = array();
|
||||||
|
|
||||||
|
$fh = fopen($p_filename, 'r');
|
||||||
|
|
||||||
|
while(!feof($fh)){
|
||||||
|
$line = fgets($fh);
|
||||||
|
if(substr(trim($line), 0, 1) == '#' || trim($line) == ""){
|
||||||
|
continue;
|
||||||
|
}else{
|
||||||
|
$info = explode('=', $line, 2);
|
||||||
|
$values[trim($info[0])] = trim($info[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function updates an INI style config file.
|
||||||
|
*
|
||||||
|
* A property and the value the property should be changed to are
|
||||||
|
* supplied. If the property is not found, then no changes are made.
|
||||||
|
*
|
||||||
|
* @param string $p_filename
|
||||||
|
* The path the to the file.
|
||||||
|
* @param string $p_property
|
||||||
|
* The property to look for in order to change its value.
|
||||||
|
* @param string $p_value
|
||||||
|
* The value the property should be changed to.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static function UpdateIniValue($p_filename, $p_property, $p_value)
|
||||||
|
{
|
||||||
|
$lines = file($p_filename);
|
||||||
|
$n=count($lines);
|
||||||
|
foreach ($lines as &$line) {
|
||||||
|
if ($line[0] != "#"){
|
||||||
|
$key_value = explode("=", $line);
|
||||||
|
$key = trim($key_value[0]);
|
||||||
|
|
||||||
|
if ($key == $p_property){
|
||||||
|
$line = "$p_property = $p_value".PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$fp=fopen($p_filename, 'w');
|
||||||
|
for($i=0; $i<$n; $i++){
|
||||||
|
fwrite($fp, $lines[$i]);
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,586 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Airtime
|
||||||
|
* @subpackage StorageServer
|
||||||
|
* @copyright 2010 Sourcefabric O.P.S.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
||||||
|
set_include_path(__DIR__.'/../../../airtime_mvc/library/pear' . PATH_SEPARATOR . get_include_path());
|
||||||
|
set_include_path(__DIR__.'/../../../airtime_mvc/application/models' . PATH_SEPARATOR . get_include_path());
|
||||||
|
set_include_path(__DIR__.'/../../../airtime_mvc/application/configs' . PATH_SEPARATOR . get_include_path());
|
||||||
|
require_once 'conf.php';
|
||||||
|
require_once 'DB.php';
|
||||||
|
|
||||||
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
|
Propel::init(__DIR__."/../../../airtime_mvc/application/configs/airtime-conf.php");
|
||||||
|
|
||||||
|
class AirtimeInstall{
|
||||||
|
const CONF_DIR_BINARIES = "/usr/lib/airtime";
|
||||||
|
|
||||||
|
public static function SetDefaultTimezone()
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$defaultTimezone = date_default_timezone_get();
|
||||||
|
|
||||||
|
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', '$defaultTimezone')";
|
||||||
|
$result = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($result)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetUtilsSrcDir()
|
||||||
|
{
|
||||||
|
return __DIR__."/../../../utils";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function InstallBinaries()
|
||||||
|
{
|
||||||
|
echo "* Installing binaries to ".AirtimeInstall::CONF_DIR_BINARIES.PHP_EOL;
|
||||||
|
exec("mkdir -p ".AirtimeInstall::CONF_DIR_BINARIES);
|
||||||
|
exec("cp -R ".AirtimeInstall::GetUtilsSrcDir()." ".AirtimeInstall::CONF_DIR_BINARIES);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function CreateSymlinksToUtils()
|
||||||
|
{
|
||||||
|
echo "* Installing airtime-log".PHP_EOL;
|
||||||
|
$dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-log";
|
||||||
|
copy(AirtimeInstall::GetUtilsSrcDir()."/airtime-log.php", AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-log.php");
|
||||||
|
|
||||||
|
exec("ln -s $dir /usr/bin/airtime-log");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetDefaultStreamSetting()
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
echo "* Setting up default stream setting".PHP_EOL;
|
||||||
|
$sql = "INSERT INTO cc_pref(keystr, valstr) VALUES('stream_type', 'ogg, mp3');
|
||||||
|
INSERT INTO cc_pref(keystr, valstr) VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320');
|
||||||
|
INSERT INTO cc_pref(keystr, valstr) VALUES('num_of_streams', '3');
|
||||||
|
INSERT INTO cc_pref(keystr, valstr) VALUES('max_bitrate', '128');
|
||||||
|
INSERT INTO cc_pref(keystr, valstr) VALUES('plan_level', 'disabled');
|
||||||
|
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('output_sound_device', 'false', 'boolean');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('icecast_vorbis_metadata', 'false', 'boolean');
|
||||||
|
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_output', 'icecast', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_type', 'ogg', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_bitrate', '128', 'integer');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_host', '127.0.0.1', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_port', '8000', 'integer');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_user', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_pass', 'hackme', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_mount', 'airtime_128', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_url', 'http://airtime.sourcefabric.org', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_description', 'Airtime Radio! Stream #1', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_genre', 'genre', 'string');
|
||||||
|
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_output', 'disabled', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_type', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_bitrate', '', 'integer');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_host', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_port', '', 'integer');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_user', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_pass', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_mount', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_url', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_description', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_genre', '', 'string');
|
||||||
|
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_output', 'disabled', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_type', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_bitrate', '', 'integer');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_host', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_port', '', 'integer');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_user', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_pass', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_mount', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_url', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_description', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_genre', '', 'string');";
|
||||||
|
$result = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($result)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function BypassMigrations($dir, $version)
|
||||||
|
{
|
||||||
|
$appDir = AirtimeInstall::GetAirtimeSrcDir();
|
||||||
|
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||||
|
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||||
|
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||||
|
"--no-interaction --add migrations:version $version";
|
||||||
|
system($command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function MigrateTablesToVersion($dir, $version)
|
||||||
|
{
|
||||||
|
$appDir = AirtimeInstall::GetAirtimeSrcDir();
|
||||||
|
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||||
|
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||||
|
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||||
|
"--no-interaction migrations:migrate $version";
|
||||||
|
system($command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetAirtimeSrcDir()
|
||||||
|
{
|
||||||
|
return __DIR__."/../../../airtime_mvc";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function DbTableExists($p_name)
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
$sql = "SELECT * FROM ".$p_name;
|
||||||
|
$result = $CC_DBC->GetOne($sql);
|
||||||
|
if (PEAR::isError($result)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public static function GetOldLiquidsoapCfgAndUpdate(){
|
||||||
|
global $CC_DBC;
|
||||||
|
echo "* Retrieving old liquidsoap configuration".PHP_EOL;
|
||||||
|
$map = array();
|
||||||
|
$fh = fopen("/etc/airtime/liquidsoap.cfg", 'r');
|
||||||
|
$newConfigMap = array();
|
||||||
|
|
||||||
|
while(!feof($fh)){
|
||||||
|
$line = fgets($fh);
|
||||||
|
if(substr(trim($line), 0, 1) == '#' || trim($line) == ""){
|
||||||
|
continue;
|
||||||
|
}else{
|
||||||
|
$info = explode('=', $line, 2);
|
||||||
|
$map[trim($info[0])] = trim($info[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$newConfigMap['output_sound_device'] = $map['output_sound_device'];
|
||||||
|
$newConfigMap['icecast_vorbis_metadata'] = $map['output_icecast_vorbis_metadata'];
|
||||||
|
$newConfigMap['log_file'] = $map['log_file'];
|
||||||
|
|
||||||
|
$count = 1;
|
||||||
|
if( $map['output_icecast_vorbis'] == 'true'){
|
||||||
|
$newConfigMap['s'.$count.'_output'] = 'icecast';
|
||||||
|
$newConfigMap['s'.$count.'_host'] = $map['icecast_host'];
|
||||||
|
$newConfigMap['s'.$count.'_port'] = $map['icecast_port'];
|
||||||
|
$newConfigMap['s'.$count.'_pass'] = $map['icecast_pass'];
|
||||||
|
$newConfigMap['s'.$count.'_mount'] = $map['mount_point_vorbis'];
|
||||||
|
$newConfigMap['s'.$count.'_url'] = $map['icecast_url'];
|
||||||
|
$newConfigMap['s'.$count.'_description'] = $map['icecast_description'];
|
||||||
|
$newConfigMap['s'.$count.'_genre'] = $map['icecast_genre'];
|
||||||
|
$newConfigMap['s'.$count.'_type'] = "ogg";
|
||||||
|
$newConfigMap['s'.$count.'_bitrate'] = "128";
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
if($map['output_icecast_mp3'] == 'true'){
|
||||||
|
$newConfigMap['s'.$count.'_output'] = 'icecast';
|
||||||
|
$newConfigMap['s'.$count.'_host'] = $map['icecast_host'];
|
||||||
|
$newConfigMap['s'.$count.'_port'] = $map['icecast_port'];
|
||||||
|
$newConfigMap['s'.$count.'_pass'] = $map['icecast_pass'];
|
||||||
|
$newConfigMap['s'.$count.'_mount'] = $map['mount_point_mp3'];
|
||||||
|
$newConfigMap['s'.$count.'_url'] = $map['icecast_url'];
|
||||||
|
$newConfigMap['s'.$count.'_description'] = $map['icecast_description'];
|
||||||
|
$newConfigMap['s'.$count.'_genre'] = $map['icecast_genre'];
|
||||||
|
$newConfigMap['s'.$count.'_type'] = "mp3";
|
||||||
|
$newConfigMap['s'.$count.'_bitrate'] = "128";
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
if($map['output_shoutcast'] == 'true'){
|
||||||
|
$newConfigMap['s'.$count.'_output'] = 'shoutcast';
|
||||||
|
$newConfigMap['s'.$count.'_host'] = $map['shoutcast_host'];
|
||||||
|
$newConfigMap['s'.$count.'_port'] = $map['shoutcast_port'];
|
||||||
|
$newConfigMap['s'.$count.'_pass'] = $map['shoutcast_pass'];
|
||||||
|
$newConfigMap['s'.$count.'_url'] = $map['shoutcast_url'];
|
||||||
|
$newConfigMap['s'.$count.'_genre'] = $map['shoutcast_genre'];
|
||||||
|
$newConfigMap['s'.$count.'_type'] = "mp3";
|
||||||
|
$newConfigMap['s'.$count.'_bitrate'] = "128";
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "";
|
||||||
|
foreach( $newConfigMap as $key=>$val){
|
||||||
|
if(substr($val, 0, 1) == '"' && substr($val, strlen($val)-1,1)){
|
||||||
|
$val = ltrim($val, '"');
|
||||||
|
$val = rtrim($val, '"');
|
||||||
|
}
|
||||||
|
$sql .= "UPDATE cc_stream_setting SET value='$val' WHERE keyname='$key';";
|
||||||
|
}
|
||||||
|
$result = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($result)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Airtime200Upgrade{
|
||||||
|
|
||||||
|
public static function connectToDatabase(){
|
||||||
|
global $CC_DBC, $CC_CONFIG;
|
||||||
|
|
||||||
|
$values = parse_ini_file('/etc/airtime/airtime.conf', 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_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function InstallAirtimePhpServerCode($phpDir)
|
||||||
|
{
|
||||||
|
|
||||||
|
$AIRTIME_SRC = realpath(__DIR__.'/../../../airtime_mvc');
|
||||||
|
|
||||||
|
// delete old files
|
||||||
|
exec("rm -rf ".$phpDir);
|
||||||
|
echo "* Installing PHP code to ".$phpDir.PHP_EOL;
|
||||||
|
exec("mkdir -p ".$phpDir);
|
||||||
|
exec("cp -R ".$AIRTIME_SRC."/* ".$phpDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function RemoveOldMonitFile(){
|
||||||
|
unlink("/etc/monit/conf.d/airtime-monit.cfg");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConvertToUtc{
|
||||||
|
|
||||||
|
public static function setPhpDefaultTimeZoneToSystemTimezone(){
|
||||||
|
//we can get the default system timezone on debian/ubuntu by reading "/etc/timezone"
|
||||||
|
$filename = "/etc/timezone";
|
||||||
|
$handle = fopen($filename, "r");
|
||||||
|
$contents = trim(fread($handle, filesize($filename)));
|
||||||
|
echo "System timezone detected as: $contents".PHP_EOL;
|
||||||
|
fclose($handle);
|
||||||
|
|
||||||
|
date_default_timezone_set($contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function convert_cc_playlist(){
|
||||||
|
/* cc_playlist has a field that keeps track of when the playlist was last modified. */
|
||||||
|
$playlists = CcPlaylistQuery::create()->find();
|
||||||
|
|
||||||
|
foreach ($playlists as $pl){
|
||||||
|
$dt = new DateTime($pl->getDbMtime(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$pl->setDbMtime($dt);
|
||||||
|
|
||||||
|
$pl->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function convert_cc_schedule(){
|
||||||
|
/* cc_schedule has start and end fields that need to be changed to UTC. */
|
||||||
|
$schedules = CcScheduleQuery::create()->find();
|
||||||
|
|
||||||
|
foreach ($schedules as $s){
|
||||||
|
$dt = new DateTime($s->getDbStarts(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$s->setDbStarts($dt);
|
||||||
|
|
||||||
|
$dt = new DateTime($s->getDbEnds(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$s->setDbEnds($dt);
|
||||||
|
|
||||||
|
$s->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function convert_cc_show_days(){
|
||||||
|
/* cc_show_days has first_show, last_show and start_time fields that need to be changed to UTC. */
|
||||||
|
$showDays = CcShowDaysQuery::create()->find();
|
||||||
|
|
||||||
|
foreach ($showDays as $sd){
|
||||||
|
$dt = new DateTime($sd->getDbFirstShow()." ".$sd->getDbStartTime(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$sd->setDbFirstShow($dt->format("Y-m-d"));
|
||||||
|
$sd->setDbStartTime($dt->format("H:i:s"));
|
||||||
|
|
||||||
|
$dt = new DateTime($sd->getDbLastShow()." ".$sd->getDbStartTime(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$sd->setDbLastShow($dt->format("Y-m-d"));
|
||||||
|
|
||||||
|
$sd->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function convert_cc_show_instances(){
|
||||||
|
/* convert_cc_show_instances has starts and ends fields that need to be changed to UTC. */
|
||||||
|
$showInstances = CcShowInstancesQuery::create()->find();
|
||||||
|
|
||||||
|
foreach ($showInstances as $si){
|
||||||
|
$dt = new DateTime($si->getDbStarts(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$si->setDbStarts($dt);
|
||||||
|
|
||||||
|
$dt = new DateTime($si->getDbEnds(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$si->setDbEnds($dt);
|
||||||
|
|
||||||
|
$si->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class AirtimeIni200{
|
||||||
|
|
||||||
|
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
||||||
|
const CONF_FILE_PYPO = "/etc/airtime/pypo.cfg";
|
||||||
|
const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg";
|
||||||
|
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
|
||||||
|
const CONF_FILE_MEDIAMONITOR = "/etc/airtime/media-monitor.cfg";
|
||||||
|
const CONF_FILE_API_CLIENT = "/etc/airtime/api_client.cfg";
|
||||||
|
|
||||||
|
const CONF_PYPO_GRP = "pypo";
|
||||||
|
const CONF_WWW_DATA_GRP = "www-data";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function updates an INI style config file.
|
||||||
|
*
|
||||||
|
* A property and the value the property should be changed to are
|
||||||
|
* supplied. If the property is not found, then no changes are made.
|
||||||
|
*
|
||||||
|
* @param string $p_filename
|
||||||
|
* The path the to the file.
|
||||||
|
* @param string $p_property
|
||||||
|
* The property to look for in order to change its value.
|
||||||
|
* @param string $p_value
|
||||||
|
* The value the property should be changed to.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function UpdateIniValue($p_filename, $p_property, $p_value)
|
||||||
|
{
|
||||||
|
$lines = file($p_filename);
|
||||||
|
$n=count($lines);
|
||||||
|
foreach ($lines as &$line) {
|
||||||
|
if ($line[0] != "#"){
|
||||||
|
$key_value = explode("=", $line);
|
||||||
|
$key = trim($key_value[0]);
|
||||||
|
|
||||||
|
if ($key == $p_property){
|
||||||
|
$line = "$p_property = $p_value".PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$fp=fopen($p_filename, 'w');
|
||||||
|
for($i=0; $i<$n; $i++){
|
||||||
|
fwrite($fp, $lines[$i]);
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function ReadPythonConfig($p_filename)
|
||||||
|
{
|
||||||
|
$values = array();
|
||||||
|
|
||||||
|
$fh = fopen($p_filename, 'r');
|
||||||
|
|
||||||
|
while(!feof($fh)){
|
||||||
|
$line = fgets($fh);
|
||||||
|
if(substr(trim($line), 0, 1) == '#' || trim($line) == ""){
|
||||||
|
continue;
|
||||||
|
}else{
|
||||||
|
$info = explode('=', $line, 2);
|
||||||
|
$values[trim($info[0])] = trim($info[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function MergeConfigFiles($configFiles, $suffix) {
|
||||||
|
foreach ($configFiles as $conf) {
|
||||||
|
// we want to use new liquidsoap.cfg so don't merge
|
||||||
|
// also for monit
|
||||||
|
if( $conf == AirtimeIni200::CONF_FILE_LIQUIDSOAP){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (file_exists("$conf$suffix.bak")) {
|
||||||
|
|
||||||
|
if($conf === AirtimeIni200::CONF_FILE_AIRTIME) {
|
||||||
|
// Parse with sections
|
||||||
|
$newSettings = parse_ini_file($conf, true);
|
||||||
|
$oldSettings = parse_ini_file("$conf$suffix.bak", true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$newSettings = AirtimeIni200::ReadPythonConfig($conf);
|
||||||
|
$oldSettings = AirtimeIni200::ReadPythonConfig("$conf$suffix.bak");
|
||||||
|
}
|
||||||
|
|
||||||
|
$settings = array_keys($newSettings);
|
||||||
|
|
||||||
|
foreach($settings as $section) {
|
||||||
|
if(isset($oldSettings[$section])) {
|
||||||
|
if(is_array($oldSettings[$section])) {
|
||||||
|
$sectionKeys = array_keys($newSettings[$section]);
|
||||||
|
foreach($sectionKeys as $sectionKey) {
|
||||||
|
// skip airtim_dir as we want to use new value
|
||||||
|
if($sectionKey != "airtime_dir"){
|
||||||
|
if(isset($oldSettings[$section][$sectionKey])) {
|
||||||
|
AirtimeIni200::UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
AirtimeIni200::UpdateIniValue($conf, $section, $oldSettings[$section]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Re: http://dev.sourcefabric.org/browse/CC-2797
|
||||||
|
* We don't want config files to be world-readable so we
|
||||||
|
* set the strictest permissions possible. */
|
||||||
|
public static function changeConfigFilePermissions(){
|
||||||
|
if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_AIRTIME, self::CONF_WWW_DATA_GRP)){
|
||||||
|
echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_API_CLIENT, self::CONF_PYPO_GRP)){
|
||||||
|
echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_PYPO, self::CONF_PYPO_GRP)){
|
||||||
|
echo "Could not set ownership of pypo.cfg to 'pypo'. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_RECORDER, self::CONF_PYPO_GRP)){
|
||||||
|
echo "Could not set ownership of recorder.cfg to 'pypo'. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_LIQUIDSOAP, self::CONF_PYPO_GRP)){
|
||||||
|
echo "Could not set ownership of liquidsoap.cfg to 'pypo'. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_MEDIAMONITOR, self::CONF_PYPO_GRP)){
|
||||||
|
echo "Could not set ownership of media-monitor.cfg to 'pypo'. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function ChangeFileOwnerGroupMod($filename, $user){
|
||||||
|
return (chown($filename, $user) &&
|
||||||
|
chgrp($filename, $user) &&
|
||||||
|
chmod($filename, 0640));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function upgradeConfigFiles(){
|
||||||
|
|
||||||
|
$configFiles = array(AirtimeIni200::CONF_FILE_AIRTIME,
|
||||||
|
AirtimeIni200::CONF_FILE_PYPO,
|
||||||
|
AirtimeIni200::CONF_FILE_RECORDER,
|
||||||
|
AirtimeIni200::CONF_FILE_LIQUIDSOAP,
|
||||||
|
AirtimeIni200::CONF_FILE_MEDIAMONITOR,
|
||||||
|
AirtimeIni200::CONF_FILE_API_CLIENT);
|
||||||
|
|
||||||
|
// Backup the config files
|
||||||
|
$suffix = date("Ymdhis")."-2.0.0";
|
||||||
|
foreach ($configFiles as $conf) {
|
||||||
|
// do not back up monit cfg
|
||||||
|
if (file_exists($conf)) {
|
||||||
|
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
|
||||||
|
//copy($conf, $conf.$suffix.".bak");
|
||||||
|
exec("cp -p $conf $conf$suffix.bak"); //use cli version to preserve file attributes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$default_suffix = "200";
|
||||||
|
AirtimeIni200::CreateIniFiles($default_suffix);
|
||||||
|
AirtimeIni200::MergeConfigFiles($configFiles, $suffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function creates the /etc/airtime configuration folder
|
||||||
|
* and copies the default config files to it.
|
||||||
|
*/
|
||||||
|
public static function CreateIniFiles($suffix)
|
||||||
|
{
|
||||||
|
if (!file_exists("/etc/airtime/")){
|
||||||
|
if (!mkdir("/etc/airtime/", 0755, true)){
|
||||||
|
echo "Could not create /etc/airtime/ directory. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!copy(__DIR__."/airtime.conf.$suffix", AirtimeIni200::CONF_FILE_AIRTIME)){
|
||||||
|
echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!copy(__DIR__."/pypo.cfg.$suffix", AirtimeIni200::CONF_FILE_PYPO)){
|
||||||
|
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!copy(__DIR__."/recorder.cfg.$suffix", AirtimeIni200::CONF_FILE_RECORDER)){
|
||||||
|
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
/*if (!copy(__DIR__."/liquidsoap.cfg.$suffix", AirtimeIni200::CONF_FILE_LIQUIDSOAP)){
|
||||||
|
echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}*/
|
||||||
|
if (!copy(__DIR__."/api_client.cfg.$suffix", AirtimeIni200::CONF_FILE_API_CLIENT)){
|
||||||
|
echo "Could not copy airtime-monit.cfg to /etc/monit/conf.d/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Airtime200Upgrade::connectToDatabase();
|
||||||
|
AirtimeInstall::SetDefaultTimezone();
|
||||||
|
|
||||||
|
AirtimeInstall::InstallBinaries();
|
||||||
|
AirtimeInstall::CreateSymlinksToUtils();
|
||||||
|
|
||||||
|
/* Airtime 2.0.0 starts interpreting all database times in UTC format. Prior to this, all the times
|
||||||
|
* were stored using the local time zone. Let's convert to UTC time. */
|
||||||
|
ConvertToUtc::setPhpDefaultTimeZoneToSystemTimezone();
|
||||||
|
ConvertToUtc::convert_cc_playlist();
|
||||||
|
ConvertToUtc::convert_cc_schedule();
|
||||||
|
ConvertToUtc::convert_cc_show_days();
|
||||||
|
ConvertToUtc::convert_cc_show_instances();
|
||||||
|
|
||||||
|
// merging/updating config files
|
||||||
|
echo "* Updating configFiles\n";
|
||||||
|
AirtimeIni200::changeConfigFilePermissions();
|
||||||
|
AirtimeIni200::upgradeConfigFiles();
|
||||||
|
|
||||||
|
$values = parse_ini_file(AirtimeIni200::CONF_FILE_AIRTIME, true);
|
||||||
|
$phpDir = $values['general']['airtime_dir'];
|
||||||
|
Airtime200Upgrade::InstallAirtimePhpServerCode($phpDir);
|
||||||
|
|
||||||
|
if(AirtimeInstall::DbTableExists('doctrine_migration_versions') === false) {
|
||||||
|
$migrations = array('20110312121200', '20110331111708', '20110402164819', '20110406182005', '20110629143017', '20110711161043', '20110713161043');
|
||||||
|
foreach($migrations as $migration) {
|
||||||
|
AirtimeInstall::BypassMigrations(__DIR__, $migration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AirtimeInstall::MigrateTablesToVersion(__DIR__, '20110925171256');
|
||||||
|
|
||||||
|
AirtimeInstall::SetDefaultStreamSetting();
|
||||||
|
|
||||||
|
AirtimeInstall::GetOldLiquidsoapCfgAndUpdate();
|
||||||
|
|
||||||
|
AirtimeUpgrade::RemoveOldMonitFile();
|
||||||
|
|
||||||
|
// restart monit
|
||||||
|
exec("service monit restart");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,17 @@
|
||||||
* @copyright 2010 Sourcefabric O.P.S.
|
* @copyright 2010 Sourcefabric O.P.S.
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
* @license http://www.gnu.org/licenses/gpl.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In the future, most Airtime upgrades will involve just mutating the
|
||||||
|
* data that is stored on the system. For example, The only data
|
||||||
|
* we need to preserve between versions is the database, /etc/airtime, and
|
||||||
|
* /srv/airtime. Everything else is just binary files that can be removed/replaced
|
||||||
|
* with the new version of Airtime. Of course, the data may need to be in a new
|
||||||
|
* format, and that's what this upgrade script will be for.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const VERSION_NUMBER = "2.0";
|
||||||
|
|
||||||
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
||||||
set_include_path(__DIR__.'/../../../airtime_mvc/library/pear' . PATH_SEPARATOR . get_include_path());
|
set_include_path(__DIR__.'/../../../airtime_mvc/library/pear' . PATH_SEPARATOR . get_include_path());
|
||||||
|
@ -12,14 +23,30 @@ set_include_path(__DIR__.'/../../../airtime_mvc/application/models' . PATH_SEPAR
|
||||||
set_include_path(__DIR__.'/../../../airtime_mvc/application/configs' . PATH_SEPARATOR . get_include_path());
|
set_include_path(__DIR__.'/../../../airtime_mvc/application/configs' . PATH_SEPARATOR . get_include_path());
|
||||||
require_once 'conf.php';
|
require_once 'conf.php';
|
||||||
require_once 'DB.php';
|
require_once 'DB.php';
|
||||||
|
|
||||||
require_once 'propel/runtime/lib/Propel.php';
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
Propel::init(__DIR__."/../../../airtime_mvc/application/configs/airtime-conf.php");
|
Propel::init(__DIR__."/../../../airtime_mvc/application/configs/airtime-conf.php");
|
||||||
|
|
||||||
class AirtimeInstall{
|
require_once 'UpgradeCommon.php';
|
||||||
const CONF_DIR_BINARIES = "/usr/lib/airtime";
|
|
||||||
|
/* All functions other than start() should be marked as
|
||||||
public static function SetDefaultTimezone()
|
* private.
|
||||||
|
*/
|
||||||
|
class AirtimeDatabaseUpgrade{
|
||||||
|
|
||||||
|
public static function start(){
|
||||||
|
self::SetDefaultTimezone();
|
||||||
|
self::setPhpDefaultTimeZoneToSystemTimezone();
|
||||||
|
self::convert_cc_playlist();
|
||||||
|
self::convert_cc_schedule();
|
||||||
|
self::convert_cc_show_days();
|
||||||
|
self::convert_cc_show_instances();
|
||||||
|
|
||||||
|
self::doDbMigration();
|
||||||
|
self::SetDefaultStreamSetting();
|
||||||
|
self::GetOldLiquidsoapCfgAndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function SetDefaultTimezone()
|
||||||
{
|
{
|
||||||
global $CC_DBC;
|
global $CC_DBC;
|
||||||
|
|
||||||
|
@ -33,28 +60,94 @@ class AirtimeInstall{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetUtilsSrcDir()
|
private static function setPhpDefaultTimeZoneToSystemTimezone(){
|
||||||
{
|
//we can get the default system timezone on debian/ubuntu by reading "/etc/timezone"
|
||||||
return __DIR__."/../../../utils";
|
$filename = "/etc/timezone";
|
||||||
|
$handle = fopen($filename, "r");
|
||||||
|
$contents = trim(fread($handle, filesize($filename)));
|
||||||
|
echo "System timezone detected as: $contents".PHP_EOL;
|
||||||
|
fclose($handle);
|
||||||
|
|
||||||
|
date_default_timezone_set($contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function InstallBinaries()
|
private static function convert_cc_playlist(){
|
||||||
{
|
/* cc_playlist has a field that keeps track of when the playlist was last modified. */
|
||||||
echo "* Installing binaries to ".AirtimeInstall::CONF_DIR_BINARIES.PHP_EOL;
|
$playlists = CcPlaylistQuery::create()->find();
|
||||||
exec("mkdir -p ".AirtimeInstall::CONF_DIR_BINARIES);
|
|
||||||
exec("cp -R ".AirtimeInstall::GetUtilsSrcDir()." ".AirtimeInstall::CONF_DIR_BINARIES);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function CreateSymlinksToUtils()
|
|
||||||
{
|
|
||||||
echo "* Installing airtime-log".PHP_EOL;
|
|
||||||
$dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-log";
|
|
||||||
copy(AirtimeInstall::GetUtilsSrcDir()."/airtime-log.php", AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-log.php");
|
|
||||||
|
|
||||||
exec("ln -s $dir /usr/bin/airtime-log");
|
foreach ($playlists as $pl){
|
||||||
|
$dt = new DateTime($pl->getDbMtime(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$pl->setDbMtime($dt);
|
||||||
|
|
||||||
|
$pl->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetDefaultStreamSetting()
|
private static function convert_cc_schedule(){
|
||||||
|
/* cc_schedule has start and end fields that need to be changed to UTC. */
|
||||||
|
$schedules = CcScheduleQuery::create()->find();
|
||||||
|
|
||||||
|
foreach ($schedules as $s){
|
||||||
|
$dt = new DateTime($s->getDbStarts(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$s->setDbStarts($dt);
|
||||||
|
|
||||||
|
$dt = new DateTime($s->getDbEnds(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$s->setDbEnds($dt);
|
||||||
|
|
||||||
|
$s->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function convert_cc_show_days(){
|
||||||
|
/* cc_show_days has first_show, last_show and start_time fields that need to be changed to UTC. */
|
||||||
|
$showDays = CcShowDaysQuery::create()->find();
|
||||||
|
|
||||||
|
foreach ($showDays as $sd){
|
||||||
|
$dt = new DateTime($sd->getDbFirstShow()." ".$sd->getDbStartTime(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$sd->setDbFirstShow($dt->format("Y-m-d"));
|
||||||
|
$sd->setDbStartTime($dt->format("H:i:s"));
|
||||||
|
|
||||||
|
$dt = new DateTime($sd->getDbLastShow()." ".$sd->getDbStartTime(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$sd->setDbLastShow($dt->format("Y-m-d"));
|
||||||
|
|
||||||
|
$sd->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function convert_cc_show_instances(){
|
||||||
|
/* convert_cc_show_instances has starts and ends fields that need to be changed to UTC. */
|
||||||
|
$showInstances = CcShowInstancesQuery::create()->find();
|
||||||
|
|
||||||
|
foreach ($showInstances as $si){
|
||||||
|
$dt = new DateTime($si->getDbStarts(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$si->setDbStarts($dt);
|
||||||
|
|
||||||
|
$dt = new DateTime($si->getDbEnds(), new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
$si->setDbEnds($dt);
|
||||||
|
|
||||||
|
$si->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function doDbMigration(){
|
||||||
|
if(UpgradeCommon::DbTableExists('doctrine_migration_versions') === false) {
|
||||||
|
$migrations = array('20110312121200', '20110331111708', '20110402164819', '20110406182005', '20110629143017', '20110711161043', '20110713161043');
|
||||||
|
foreach($migrations as $migration) {
|
||||||
|
UpgradeCommon::BypassMigrations(__DIR__, $migration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20110929184401');
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function SetDefaultStreamSetting()
|
||||||
{
|
{
|
||||||
global $CC_DBC;
|
global $CC_DBC;
|
||||||
|
|
||||||
|
@ -109,43 +202,8 @@ class AirtimeInstall{
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function BypassMigrations($dir, $version)
|
|
||||||
{
|
|
||||||
$appDir = AirtimeInstall::GetAirtimeSrcDir();
|
|
||||||
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
|
||||||
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
|
||||||
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
|
||||||
"--no-interaction --add migrations:version $version";
|
|
||||||
system($command);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function MigrateTablesToVersion($dir, $version)
|
private static function GetOldLiquidsoapCfgAndUpdate(){
|
||||||
{
|
|
||||||
$appDir = AirtimeInstall::GetAirtimeSrcDir();
|
|
||||||
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
|
||||||
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
|
||||||
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
|
||||||
"--no-interaction migrations:migrate $version";
|
|
||||||
system($command);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function GetAirtimeSrcDir()
|
|
||||||
{
|
|
||||||
return __DIR__."/../../../airtime_mvc";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function DbTableExists($p_name)
|
|
||||||
{
|
|
||||||
global $CC_DBC;
|
|
||||||
$sql = "SELECT * FROM ".$p_name;
|
|
||||||
$result = $CC_DBC->GetOne($sql);
|
|
||||||
if (PEAR::isError($result)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public static function GetOldLiquidsoapCfgAndUpdate(){
|
|
||||||
global $CC_DBC;
|
global $CC_DBC;
|
||||||
echo "* Retrieving old liquidsoap configuration".PHP_EOL;
|
echo "* Retrieving old liquidsoap configuration".PHP_EOL;
|
||||||
$map = array();
|
$map = array();
|
||||||
|
@ -220,367 +278,80 @@ class AirtimeInstall{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Airtime200Upgrade{
|
class AirtimeStorWatchedDirsUpgrade{
|
||||||
|
|
||||||
public static function connectToDatabase(){
|
public static function start(){
|
||||||
global $CC_DBC, $CC_CONFIG;
|
|
||||||
|
|
||||||
$values = parse_ini_file('/etc/airtime/airtime.conf', 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_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function InstallAirtimePhpServerCode($phpDir)
|
|
||||||
{
|
|
||||||
|
|
||||||
$AIRTIME_SRC = realpath(__DIR__.'/../../../airtime_mvc');
|
|
||||||
|
|
||||||
// delete old files
|
|
||||||
exec("rm -rf ".$phpDir);
|
|
||||||
echo "* Installing PHP code to ".$phpDir.PHP_EOL;
|
|
||||||
exec("mkdir -p ".$phpDir);
|
|
||||||
exec("cp -R ".$AIRTIME_SRC."/* ".$phpDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function RemoveOldMonitFile(){
|
|
||||||
unlink("/etc/monit/conf.d/airtime-monit.cfg");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConvertToUtc{
|
/* This class deals with any modifications to config files in /etc/airtime
|
||||||
|
* as well as backups. All functions other than start() should be marked
|
||||||
|
* as private. */
|
||||||
|
class AirtimeConfigFileUpgrade{
|
||||||
|
|
||||||
public static function setPhpDefaultTimeZoneToSystemTimezone(){
|
public static function start(){
|
||||||
//we can get the default system timezone on debian/ubuntu by reading "/etc/timezone"
|
echo "* Updating configFiles\n";
|
||||||
$filename = "/etc/timezone";
|
self::changeConfigFilePermissions();
|
||||||
$handle = fopen($filename, "r");
|
UpgradeCommon::upgradeConfigFiles();
|
||||||
$contents = trim(fread($handle, filesize($filename)));
|
|
||||||
echo "System timezone detected as: $contents".PHP_EOL;
|
|
||||||
fclose($handle);
|
|
||||||
|
|
||||||
date_default_timezone_set($contents);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function convert_cc_playlist(){
|
|
||||||
/* cc_playlist has a field that keeps track of when the playlist was last modified. */
|
|
||||||
$playlists = CcPlaylistQuery::create()->find();
|
|
||||||
|
|
||||||
foreach ($playlists as $pl){
|
|
||||||
$dt = new DateTime($pl->getDbMtime(), new DateTimeZone(date_default_timezone_get()));
|
|
||||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
|
||||||
$pl->setDbMtime($dt);
|
|
||||||
|
|
||||||
$pl->save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function convert_cc_schedule(){
|
|
||||||
/* cc_schedule has start and end fields that need to be changed to UTC. */
|
|
||||||
$schedules = CcScheduleQuery::create()->find();
|
|
||||||
|
|
||||||
foreach ($schedules as $s){
|
|
||||||
$dt = new DateTime($s->getDbStarts(), new DateTimeZone(date_default_timezone_get()));
|
|
||||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
|
||||||
$s->setDbStarts($dt);
|
|
||||||
|
|
||||||
$dt = new DateTime($s->getDbEnds(), new DateTimeZone(date_default_timezone_get()));
|
|
||||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
|
||||||
$s->setDbEnds($dt);
|
|
||||||
|
|
||||||
$s->save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function convert_cc_show_days(){
|
|
||||||
/* cc_show_days has first_show, last_show and start_time fields that need to be changed to UTC. */
|
|
||||||
$showDays = CcShowDaysQuery::create()->find();
|
|
||||||
|
|
||||||
foreach ($showDays as $sd){
|
|
||||||
$dt = new DateTime($sd->getDbFirstShow()." ".$sd->getDbStartTime(), new DateTimeZone(date_default_timezone_get()));
|
|
||||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
|
||||||
$sd->setDbFirstShow($dt->format("Y-m-d"));
|
|
||||||
$sd->setDbStartTime($dt->format("H:i:s"));
|
|
||||||
|
|
||||||
$dt = new DateTime($sd->getDbLastShow()." ".$sd->getDbStartTime(), new DateTimeZone(date_default_timezone_get()));
|
|
||||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
|
||||||
$sd->setDbLastShow($dt->format("Y-m-d"));
|
|
||||||
|
|
||||||
$sd->save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function convert_cc_show_instances(){
|
|
||||||
/* convert_cc_show_instances has starts and ends fields that need to be changed to UTC. */
|
|
||||||
$showInstances = CcShowInstancesQuery::create()->find();
|
|
||||||
|
|
||||||
foreach ($showInstances as $si){
|
|
||||||
$dt = new DateTime($si->getDbStarts(), new DateTimeZone(date_default_timezone_get()));
|
|
||||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
|
||||||
$si->setDbStarts($dt);
|
|
||||||
|
|
||||||
$dt = new DateTime($si->getDbEnds(), new DateTimeZone(date_default_timezone_get()));
|
|
||||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
|
||||||
$si->setDbEnds($dt);
|
|
||||||
|
|
||||||
$si->save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class AirtimeIni200{
|
|
||||||
|
|
||||||
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
|
||||||
const CONF_FILE_PYPO = "/etc/airtime/pypo.cfg";
|
|
||||||
const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg";
|
|
||||||
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
|
|
||||||
const CONF_FILE_MEDIAMONITOR = "/etc/airtime/media-monitor.cfg";
|
|
||||||
const CONF_FILE_API_CLIENT = "/etc/airtime/api_client.cfg";
|
|
||||||
|
|
||||||
const CONF_PYPO_GRP = "pypo";
|
|
||||||
const CONF_WWW_DATA_GRP = "www-data";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function updates an INI style config file.
|
|
||||||
*
|
|
||||||
* A property and the value the property should be changed to are
|
|
||||||
* supplied. If the property is not found, then no changes are made.
|
|
||||||
*
|
|
||||||
* @param string $p_filename
|
|
||||||
* The path the to the file.
|
|
||||||
* @param string $p_property
|
|
||||||
* The property to look for in order to change its value.
|
|
||||||
* @param string $p_value
|
|
||||||
* The value the property should be changed to.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static function UpdateIniValue($p_filename, $p_property, $p_value)
|
|
||||||
{
|
|
||||||
$lines = file($p_filename);
|
|
||||||
$n=count($lines);
|
|
||||||
foreach ($lines as &$line) {
|
|
||||||
if ($line[0] != "#"){
|
|
||||||
$key_value = explode("=", $line);
|
|
||||||
$key = trim($key_value[0]);
|
|
||||||
|
|
||||||
if ($key == $p_property){
|
|
||||||
$line = "$p_property = $p_value".PHP_EOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$fp=fopen($p_filename, 'w');
|
|
||||||
for($i=0; $i<$n; $i++){
|
|
||||||
fwrite($fp, $lines[$i]);
|
|
||||||
}
|
|
||||||
fclose($fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function ReadPythonConfig($p_filename)
|
|
||||||
{
|
|
||||||
$values = array();
|
|
||||||
|
|
||||||
$fh = fopen($p_filename, 'r');
|
|
||||||
|
|
||||||
while(!feof($fh)){
|
|
||||||
$line = fgets($fh);
|
|
||||||
if(substr(trim($line), 0, 1) == '#' || trim($line) == ""){
|
|
||||||
continue;
|
|
||||||
}else{
|
|
||||||
$info = explode('=', $line, 2);
|
|
||||||
$values[trim($info[0])] = trim($info[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function MergeConfigFiles($configFiles, $suffix) {
|
|
||||||
foreach ($configFiles as $conf) {
|
|
||||||
// we want to use new liquidsoap.cfg so don't merge
|
|
||||||
// also for monit
|
|
||||||
if( $conf == AirtimeIni200::CONF_FILE_LIQUIDSOAP){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (file_exists("$conf$suffix.bak")) {
|
|
||||||
|
|
||||||
if($conf === AirtimeIni200::CONF_FILE_AIRTIME) {
|
|
||||||
// Parse with sections
|
|
||||||
$newSettings = parse_ini_file($conf, true);
|
|
||||||
$oldSettings = parse_ini_file("$conf$suffix.bak", true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$newSettings = AirtimeIni200::ReadPythonConfig($conf);
|
|
||||||
$oldSettings = AirtimeIni200::ReadPythonConfig("$conf$suffix.bak");
|
|
||||||
}
|
|
||||||
|
|
||||||
$settings = array_keys($newSettings);
|
|
||||||
|
|
||||||
foreach($settings as $section) {
|
|
||||||
if(isset($oldSettings[$section])) {
|
|
||||||
if(is_array($oldSettings[$section])) {
|
|
||||||
$sectionKeys = array_keys($newSettings[$section]);
|
|
||||||
foreach($sectionKeys as $sectionKey) {
|
|
||||||
// skip airtim_dir as we want to use new value
|
|
||||||
if($sectionKey != "airtime_dir"){
|
|
||||||
if(isset($oldSettings[$section][$sectionKey])) {
|
|
||||||
AirtimeIni200::UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
AirtimeIni200::UpdateIniValue($conf, $section, $oldSettings[$section]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re: http://dev.sourcefabric.org/browse/CC-2797
|
/* Re: http://dev.sourcefabric.org/browse/CC-2797
|
||||||
* We don't want config files to be world-readable so we
|
* We don't want config files to be world-readable so we
|
||||||
* set the strictest permissions possible. */
|
* set the strictest permissions possible. */
|
||||||
public static function changeConfigFilePermissions(){
|
private static function changeConfigFilePermissions(){
|
||||||
if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_AIRTIME, self::CONF_WWW_DATA_GRP)){
|
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_AIRTIME, UpgradeCommon::CONF_WWW_DATA_GRP)){
|
||||||
echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting.";
|
echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting.";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_API_CLIENT, self::CONF_PYPO_GRP)){
|
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_API_CLIENT, UpgradeCommon::CONF_PYPO_GRP)){
|
||||||
echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting.";
|
echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting.";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_PYPO, self::CONF_PYPO_GRP)){
|
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_PYPO, UpgradeCommon::CONF_PYPO_GRP)){
|
||||||
echo "Could not set ownership of pypo.cfg to 'pypo'. Exiting.";
|
echo "Could not set ownership of pypo.cfg to 'pypo'. Exiting.";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_RECORDER, self::CONF_PYPO_GRP)){
|
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_RECORDER, UpgradeCommon::CONF_PYPO_GRP)){
|
||||||
echo "Could not set ownership of recorder.cfg to 'pypo'. Exiting.";
|
echo "Could not set ownership of recorder.cfg to 'pypo'. Exiting.";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_LIQUIDSOAP, self::CONF_PYPO_GRP)){
|
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_LIQUIDSOAP, UpgradeCommon::CONF_PYPO_GRP)){
|
||||||
echo "Could not set ownership of liquidsoap.cfg to 'pypo'. Exiting.";
|
echo "Could not set ownership of liquidsoap.cfg to 'pypo'. Exiting.";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_MEDIAMONITOR, self::CONF_PYPO_GRP)){
|
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_MEDIAMONITOR, UpgradeCommon::CONF_PYPO_GRP)){
|
||||||
echo "Could not set ownership of media-monitor.cfg to 'pypo'. Exiting.";
|
echo "Could not set ownership of media-monitor.cfg to 'pypo'. Exiting.";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function ChangeFileOwnerGroupMod($filename, $user){
|
private static function ChangeFileOwnerGroupMod($filename, $user){
|
||||||
return (chown($filename, $user) &&
|
return (chown($filename, $user) &&
|
||||||
chgrp($filename, $user) &&
|
chgrp($filename, $user) &&
|
||||||
chmod($filename, 0640));
|
chmod($filename, 0640));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function upgradeConfigFiles(){
|
|
||||||
|
|
||||||
$configFiles = array(AirtimeIni200::CONF_FILE_AIRTIME,
|
}
|
||||||
AirtimeIni200::CONF_FILE_PYPO,
|
|
||||||
AirtimeIni200::CONF_FILE_RECORDER,
|
|
||||||
AirtimeIni200::CONF_FILE_LIQUIDSOAP,
|
|
||||||
AirtimeIni200::CONF_FILE_MEDIAMONITOR,
|
|
||||||
AirtimeIni200::CONF_FILE_API_CLIENT);
|
|
||||||
|
|
||||||
// Backup the config files
|
/* Into this class put operations that don't fit into any of the other
|
||||||
$suffix = date("Ymdhis")."-2.0.0";
|
* 3 classes. For example, there may be stray files scattered throughout
|
||||||
foreach ($configFiles as $conf) {
|
* the filesystem that we don't need anymore. Put the functions to clean
|
||||||
// do not back up monit cfg
|
* those out into this class. */
|
||||||
if (file_exists($conf)) {
|
class AirtimeMiscUpgrade{
|
||||||
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
|
|
||||||
//copy($conf, $conf.$suffix.".bak");
|
|
||||||
exec("cp -p $conf $conf$suffix.bak"); //use cli version to preserve file attributes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$default_suffix = "200";
|
public static function start(){
|
||||||
AirtimeIni200::CreateIniFiles($default_suffix);
|
self::RemoveOldMonitFile();
|
||||||
AirtimeIni200::MergeConfigFiles($configFiles, $suffix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private static function RemoveOldMonitFile(){
|
||||||
* This function creates the /etc/airtime configuration folder
|
unlink("/etc/monit/conf.d/airtime-monit.cfg");
|
||||||
* and copies the default config files to it.
|
|
||||||
*/
|
|
||||||
public static function CreateIniFiles($suffix)
|
|
||||||
{
|
|
||||||
if (!file_exists("/etc/airtime/")){
|
|
||||||
if (!mkdir("/etc/airtime/", 0755, true)){
|
|
||||||
echo "Could not create /etc/airtime/ directory. Exiting.";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!copy(__DIR__."/airtime.conf.$suffix", AirtimeIni200::CONF_FILE_AIRTIME)){
|
|
||||||
echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (!copy(__DIR__."/pypo.cfg.$suffix", AirtimeIni200::CONF_FILE_PYPO)){
|
|
||||||
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (!copy(__DIR__."/recorder.cfg.$suffix", AirtimeIni200::CONF_FILE_RECORDER)){
|
|
||||||
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
/*if (!copy(__DIR__."/liquidsoap.cfg.$suffix", AirtimeIni200::CONF_FILE_LIQUIDSOAP)){
|
|
||||||
echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting.";
|
|
||||||
exit(1);
|
|
||||||
}*/
|
|
||||||
if (!copy(__DIR__."/api_client.cfg.$suffix", AirtimeIni200::CONF_FILE_API_CLIENT)){
|
|
||||||
echo "Could not copy airtime-monit.cfg to /etc/monit/conf.d/. Exiting.";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Airtime200Upgrade::connectToDatabase();
|
UpgradeCommon::connectToDatabase();
|
||||||
AirtimeInstall::SetDefaultTimezone();
|
|
||||||
|
|
||||||
AirtimeInstall::InstallBinaries();
|
AirtimeDatabaseUpgrade::start();
|
||||||
AirtimeInstall::CreateSymlinksToUtils();
|
AirtimeStorWatchedDirsUpgrade::start();
|
||||||
|
AirtimeConfigFileUpgrade::start();
|
||||||
/* Airtime 2.0.0 starts interpreting all database times in UTC format. Prior to this, all the times
|
AirtimeMiscUpgrade::start();
|
||||||
* were stored using the local time zone. Let's convert to UTC time. */
|
|
||||||
ConvertToUtc::setPhpDefaultTimeZoneToSystemTimezone();
|
|
||||||
ConvertToUtc::convert_cc_playlist();
|
|
||||||
ConvertToUtc::convert_cc_schedule();
|
|
||||||
ConvertToUtc::convert_cc_show_days();
|
|
||||||
ConvertToUtc::convert_cc_show_instances();
|
|
||||||
|
|
||||||
// merging/updating config files
|
|
||||||
echo "* Updating configFiles\n";
|
|
||||||
AirtimeIni200::changeConfigFilePermissions();
|
|
||||||
AirtimeIni200::upgradeConfigFiles();
|
|
||||||
|
|
||||||
$values = parse_ini_file(AirtimeIni200::CONF_FILE_AIRTIME, true);
|
|
||||||
$phpDir = $values['general']['airtime_dir'];
|
|
||||||
Airtime200Upgrade::InstallAirtimePhpServerCode($phpDir);
|
|
||||||
|
|
||||||
if(AirtimeInstall::DbTableExists('doctrine_migration_versions') === false) {
|
|
||||||
$migrations = array('20110312121200', '20110331111708', '20110402164819', '20110406182005', '20110629143017', '20110711161043', '20110713161043');
|
|
||||||
foreach($migrations as $migration) {
|
|
||||||
AirtimeInstall::BypassMigrations(__DIR__, $migration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AirtimeInstall::MigrateTablesToVersion(__DIR__, '20110925171256');
|
|
||||||
|
|
||||||
AirtimeInstall::SetDefaultStreamSetting();
|
|
||||||
|
|
||||||
AirtimeInstall::GetOldLiquidsoapCfgAndUpdate();
|
|
||||||
|
|
||||||
AirtimeUpgrade::RemoveOldMonitFile();
|
|
||||||
|
|
||||||
// restart monit
|
|
||||||
exec("service monit restart");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,9 @@ api_base = 'api'
|
||||||
# URL to get the version number of the server API
|
# URL to get the version number of the server API
|
||||||
version_url = 'version/api_key/%%api_key%%'
|
version_url = 'version/api_key/%%api_key%%'
|
||||||
|
|
||||||
|
#URL to register a components IP Address with the central web server
|
||||||
|
register_component = 'register-component/format/json/api_key/%%api_key%%/component/%%component%%'
|
||||||
|
|
||||||
# Hostname
|
# Hostname
|
||||||
base_url = 'localhost'
|
base_url = 'localhost'
|
||||||
base_port = 80
|
base_port = 80
|
||||||
|
@ -45,9 +48,6 @@ remove_watched_dir = 'remove-watched-dir/format/json/api_key/%%api_key%%/path/%%
|
||||||
# URL to tell Airtime we want to add watched directory
|
# URL to tell Airtime we want to add watched directory
|
||||||
set_storage_dir = 'set-storage-dir/format/json/api_key/%%api_key%%/path/%%path%%'
|
set_storage_dir = 'set-storage-dir/format/json/api_key/%%api_key%%/path/%%path%%'
|
||||||
|
|
||||||
# URL to tell Airtime we want to get stream setting
|
|
||||||
get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/'
|
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
## Config for Recorder
|
## Config for Recorder
|
||||||
#############################
|
#############################
|
||||||
|
@ -89,6 +89,8 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med
|
||||||
# ???
|
# ???
|
||||||
generate_range_url = 'generate_range_dp.php'
|
generate_range_url = 'generate_range_dp.php'
|
||||||
|
|
||||||
|
# URL to tell Airtime we want to get stream setting
|
||||||
|
get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/'
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# OBP config #
|
# OBP config #
|
||||||
|
|
|
@ -0,0 +1,206 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/* These are helper functions that are common to each upgrade such as
|
||||||
|
* creating connections to a database, backing up config files etc.
|
||||||
|
*/
|
||||||
|
class UpgradeCommon{
|
||||||
|
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
||||||
|
const CONF_FILE_PYPO = "/etc/airtime/pypo.cfg";
|
||||||
|
const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg";
|
||||||
|
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
|
||||||
|
const CONF_FILE_MEDIAMONITOR = "/etc/airtime/media-monitor.cfg";
|
||||||
|
const CONF_FILE_API_CLIENT = "/etc/airtime/api_client.cfg";
|
||||||
|
|
||||||
|
const CONF_PYPO_GRP = "pypo";
|
||||||
|
const CONF_WWW_DATA_GRP = "www-data";
|
||||||
|
|
||||||
|
public static function DbTableExists($p_name)
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
$sql = "SELECT * FROM ".$p_name;
|
||||||
|
$result = $CC_DBC->GetOne($sql);
|
||||||
|
if (PEAR::isError($result)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function GetAirtimeSrcDir()
|
||||||
|
{
|
||||||
|
return __DIR__."/../../../airtime_mvc";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function MigrateTablesToVersion($dir, $version)
|
||||||
|
{
|
||||||
|
$appDir = self::GetAirtimeSrcDir();
|
||||||
|
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||||
|
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||||
|
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||||
|
"--no-interaction migrations:migrate $version";
|
||||||
|
system($command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function BypassMigrations($dir, $version)
|
||||||
|
{
|
||||||
|
$appDir = self::GetAirtimeSrcDir();
|
||||||
|
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||||
|
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||||
|
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||||
|
"--no-interaction --add migrations:version $version";
|
||||||
|
system($command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function upgradeConfigFiles(){
|
||||||
|
|
||||||
|
$configFiles = array(UpgradeCommon::CONF_FILE_AIRTIME,
|
||||||
|
UpgradeCommon::CONF_FILE_PYPO,
|
||||||
|
UpgradeCommon::CONF_FILE_RECORDER,
|
||||||
|
UpgradeCommon::CONF_FILE_LIQUIDSOAP,
|
||||||
|
UpgradeCommon::CONF_FILE_MEDIAMONITOR,
|
||||||
|
UpgradeCommon::CONF_FILE_API_CLIENT);
|
||||||
|
|
||||||
|
// Backup the config files
|
||||||
|
$suffix = date("Ymdhis")."-".VERSION_NUMBER;
|
||||||
|
foreach ($configFiles as $conf) {
|
||||||
|
// do not back up monit cfg
|
||||||
|
if (file_exists($conf)) {
|
||||||
|
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
|
||||||
|
//copy($conf, $conf.$suffix.".bak");
|
||||||
|
exec("cp -p $conf $conf$suffix.bak"); //use cli version to preserve file attributes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$default_suffix = "200";
|
||||||
|
self::CreateIniFiles($default_suffix);
|
||||||
|
self::MergeConfigFiles($configFiles, $suffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function creates the /etc/airtime configuration folder
|
||||||
|
* and copies the default config files to it.
|
||||||
|
*/
|
||||||
|
public static function CreateIniFiles($suffix)
|
||||||
|
{
|
||||||
|
if (!file_exists("/etc/airtime/")){
|
||||||
|
if (!mkdir("/etc/airtime/", 0755, true)){
|
||||||
|
echo "Could not create /etc/airtime/ directory. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!copy(__DIR__."/airtime.conf.$suffix", self::CONF_FILE_AIRTIME)){
|
||||||
|
echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!copy(__DIR__."/pypo.cfg.$suffix", self::CONF_FILE_PYPO)){
|
||||||
|
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!copy(__DIR__."/recorder.cfg.$suffix", self::CONF_FILE_RECORDER)){
|
||||||
|
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!copy(__DIR__."/api_client.cfg.$suffix", self::CONF_FILE_API_CLIENT)){
|
||||||
|
echo "Could not copy airtime-monit.cfg to /etc/monit/conf.d/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function MergeConfigFiles($configFiles, $suffix) {
|
||||||
|
foreach ($configFiles as $conf) {
|
||||||
|
// we want to use new liquidsoap.cfg so don't merge
|
||||||
|
// also for monit
|
||||||
|
if( $conf == self::CONF_FILE_LIQUIDSOAP){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (file_exists("$conf$suffix.bak")) {
|
||||||
|
|
||||||
|
if($conf === self::CONF_FILE_AIRTIME) {
|
||||||
|
// Parse with sections
|
||||||
|
$newSettings = parse_ini_file($conf, true);
|
||||||
|
$oldSettings = parse_ini_file("$conf$suffix.bak", true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$newSettings = self::ReadPythonConfig($conf);
|
||||||
|
$oldSettings = self::ReadPythonConfig("$conf$suffix.bak");
|
||||||
|
}
|
||||||
|
|
||||||
|
$settings = array_keys($newSettings);
|
||||||
|
|
||||||
|
foreach($settings as $section) {
|
||||||
|
if(isset($oldSettings[$section])) {
|
||||||
|
if(is_array($oldSettings[$section])) {
|
||||||
|
$sectionKeys = array_keys($newSettings[$section]);
|
||||||
|
foreach($sectionKeys as $sectionKey) {
|
||||||
|
// skip airtim_dir as we want to use new value
|
||||||
|
if($sectionKey != "airtime_dir"){
|
||||||
|
if(isset($oldSettings[$section][$sectionKey])) {
|
||||||
|
self::UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self::UpdateIniValue($conf, $section, $oldSettings[$section]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function ReadPythonConfig($p_filename)
|
||||||
|
{
|
||||||
|
$values = array();
|
||||||
|
|
||||||
|
$fh = fopen($p_filename, 'r');
|
||||||
|
|
||||||
|
while(!feof($fh)){
|
||||||
|
$line = fgets($fh);
|
||||||
|
if(substr(trim($line), 0, 1) == '#' || trim($line) == ""){
|
||||||
|
continue;
|
||||||
|
}else{
|
||||||
|
$info = explode('=', $line, 2);
|
||||||
|
$values[trim($info[0])] = trim($info[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function updates an INI style config file.
|
||||||
|
*
|
||||||
|
* A property and the value the property should be changed to are
|
||||||
|
* supplied. If the property is not found, then no changes are made.
|
||||||
|
*
|
||||||
|
* @param string $p_filename
|
||||||
|
* The path the to the file.
|
||||||
|
* @param string $p_property
|
||||||
|
* The property to look for in order to change its value.
|
||||||
|
* @param string $p_value
|
||||||
|
* The value the property should be changed to.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static function UpdateIniValue($p_filename, $p_property, $p_value)
|
||||||
|
{
|
||||||
|
$lines = file($p_filename);
|
||||||
|
$n=count($lines);
|
||||||
|
foreach ($lines as &$line) {
|
||||||
|
if ($line[0] != "#"){
|
||||||
|
$key_value = explode("=", $line);
|
||||||
|
$key = trim($key_value[0]);
|
||||||
|
|
||||||
|
if ($key == $p_property){
|
||||||
|
$line = "$p_property = $p_value".PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$fp=fopen($p_filename, 'w');
|
||||||
|
for($i=0; $i<$n; $i++){
|
||||||
|
fwrite($fp, $lines[$i]);
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Airtime
|
||||||
|
* @subpackage StorageServer
|
||||||
|
* @copyright 2010 Sourcefabric O.P.S.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In the future, most Airtime upgrades will involve just mutating the
|
||||||
|
* data that is stored on the system. For example, The only data
|
||||||
|
* we need to preserve between versions is the database, /etc/airtime, and
|
||||||
|
* /srv/airtime. Everything else is just binary files that can be removed/replaced
|
||||||
|
* with the new version of Airtime. Of course, the data may need to be in a new
|
||||||
|
* format, and that's what this upgrade script will be for.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const VERSION_NUMBER = "2.0.0";
|
||||||
|
|
||||||
|
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
||||||
|
set_include_path(__DIR__.'/../../../airtime_mvc/library/pear' . PATH_SEPARATOR . get_include_path());
|
||||||
|
set_include_path(__DIR__.'/../../../airtime_mvc/application/models' . PATH_SEPARATOR . get_include_path());
|
||||||
|
set_include_path(__DIR__.'/../../../airtime_mvc/application/configs' . PATH_SEPARATOR . get_include_path());
|
||||||
|
require_once 'conf.php';
|
||||||
|
require_once 'DB.php';
|
||||||
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
|
Propel::init(__DIR__."/../../../airtime_mvc/application/configs/airtime-conf.php");
|
||||||
|
|
||||||
|
require_once 'UpgradeCommon.php';
|
||||||
|
|
||||||
|
|
||||||
|
/* All functions other than start() should be marked as
|
||||||
|
* private.
|
||||||
|
*/
|
||||||
|
class AirtimeDatabaseUpgrade{
|
||||||
|
|
||||||
|
public static function start(){
|
||||||
|
//self::doDbMigration();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function doDbMigration(){
|
||||||
|
if(UpgradeCommon::DbTableExists('doctrine_migration_versions') === false) {
|
||||||
|
$migrations = array('20110312121200', '20110331111708', '20110402164819', '20110406182005', '20110629143017', '20110711161043', '20110713161043');
|
||||||
|
foreach($migrations as $migration) {
|
||||||
|
UpgradeCommon::BypassMigrations(__DIR__, $migration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20110925171256');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class AirtimeStorWatchedDirsUpgrade{
|
||||||
|
|
||||||
|
public static function start(){
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This class deals with any modifications to config files in /etc/airtime
|
||||||
|
* as well as backups. All functions other than start() should be marked
|
||||||
|
* as private. */
|
||||||
|
class AirtimeConfigFileUpgrade{
|
||||||
|
|
||||||
|
public static function start(){
|
||||||
|
UpgradeCommon::upgradeConfigFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Into this class put operations that don't fit into any of the other
|
||||||
|
* 3 classes. For example, there may be stray files scattered throughout
|
||||||
|
* the filesystem that we don't need anymore. Put the functions to clean
|
||||||
|
* those out into this class. */
|
||||||
|
class AirtimeMiscUpgrade{1
|
||||||
|
|
||||||
|
public static function start(){
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UpgradeCommonFunctions::connectToDatabase();
|
||||||
|
|
||||||
|
AirtimeDatabaseUpgrade::start();
|
||||||
|
AirtimeStorWatchedDirsUpgrade::start();
|
||||||
|
AirtimeConfigFileUpgrade::start();
|
||||||
|
AirtimeMiscUpgrade::start();
|
|
@ -561,7 +561,6 @@ class AirTimeApiClient(ApiClientInterface):
|
||||||
response = urllib2.urlopen(req).read()
|
response = urllib2.urlopen(req).read()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.error("Exception: %s", e)
|
logger.error("Exception: %s", e)
|
||||||
logger.error("Response: %s", response)
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# OpenBroadcast API Client
|
# OpenBroadcast API Client
|
||||||
|
|
|
@ -33,7 +33,7 @@ require_once($CC_CONFIG['phpDir'].'/application/models/User.php');
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
|
require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/models/Playlist.php');
|
require_once($CC_CONFIG['phpDir'].'/application/models/Playlist.php');
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/models/Schedule.php');
|
require_once($CC_CONFIG['phpDir'].'/application/models/Schedule.php');
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/models/Shows.php');
|
require_once($CC_CONFIG['phpDir'].'/application/models/Show.php');
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');
|
require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');
|
||||||
|
|
||||||
//Pear classes.
|
//Pear classes.
|
||||||
|
|
Loading…
Reference in New Issue