Merge branch '2.0.x' of dev.sourcefabric.org:airtime into 2.0.x

This commit is contained in:
Daniel 2012-02-17 16:49:44 -05:00
commit 5dd94ce12c
205 changed files with 70643 additions and 603 deletions

View File

@ -1,7 +1,6 @@
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"

View File

@ -219,8 +219,6 @@ class PreferenceController extends Zend_Controller_Action
for($i=1;$i<=$num_of_stream;$i++){
Application_Model_StreamSetting::setLiquidsoapError($i, "waiting");
}
// this goes into cc_pref table
Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']);
// store stream update timestamp
Application_Model_Preference::SetStreamUpdateTimestamp();
Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data);

View File

@ -4,6 +4,8 @@ class SystemstatusController extends Zend_Controller_Action
{
public function init()
{
global $CC_CONFIG;
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();

View File

@ -102,7 +102,6 @@ class Application_Model_Preference
public static function SetHeadTitle($title, $view=null){
self::SetValue("station_name", $title);
Application_Model_RabbitMq::PushSchedule();
// in case this is called from airtime-saas script
if($view !== null){
@ -111,6 +110,11 @@ class Application_Model_Preference
$view->headTitle()->exchangeArray(array()); //clear headTitle ArrayObject
$view->headTitle(self::GetHeadTitle());
}
$eventType = "update_station_name";
$md = array("station_name"=>$title);
Application_Model_RabbitMq::SendMessageToPypo($eventType, $md);
}
/**
@ -153,7 +157,11 @@ class Application_Model_Preference
public static function SetStreamLabelFormat($type){
self::SetValue("stream_label_format", $type);
Application_Model_RabbitMq::PushSchedule();
$eventType = "update_stream_format";
$md = array("stream_format"=>$type);
Application_Model_RabbitMq::SendMessageToPypo($eventType, $md);
}
public static function GetStreamLabelFormat(){
@ -421,7 +429,7 @@ class Application_Model_Preference
}
public static function GetInstallMethod(){
$easy_install = file_exists('/usr/bin/airtime-easy-install');
$easy_install = file_exists('/usr/bin/airtime-easy-setup');
$debian_install = file_exists('/var/lib/dpkg/info/airtime.config');
if($debian_install){
if($easy_install){

View File

@ -1396,7 +1396,7 @@ class Application_Model_Show {
Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp);
}
$sql = "SELECT starts, ends, record, rebroadcast, instance_id, show_id, name, description,
$sql = "SELECT starts, ends, record, rebroadcast, instance_id, show_id, name,
color, background_color, file_id, cc_show_instances.id AS instance_id
FROM cc_show_instances
LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id
@ -1536,7 +1536,6 @@ class Application_Model_Show {
$event["start"] = $startDateTime->format("Y-m-d H:i:s");
$event["end"] = $endDateTime->format("Y-m-d H:i:s");
$event["allDay"] = false;
$event["description"] = $show["description"];
$event["showId"] = $show["show_id"];
$event["record"] = intval($show["record"]);
$event["rebroadcast"] = intval($show["rebroadcast"]);

View File

@ -83,8 +83,12 @@ class Application_Model_StreamSetting {
$CC_DBC->query($sql);
} else if ($key == "output_sound_device_type") {
$sql = "UPDATE cc_stream_setting SET value='$d' WHERE keyname='$key'";
$CC_DBC->query($sql);
} else {
$CC_DBC->query($sql);
} else if ($key == "streamFormat"){
// this goes into cc_pref table
Logging::log("Insert stream label format $d");
Application_Model_Preference::SetStreamLabelFormat($d);
} else if (is_array($d)) {
$temp = explode('_', $key);
$prefix = $temp[0];
foreach ($d as $k=>$v) {
@ -96,6 +100,8 @@ class Application_Model_StreamSetting {
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'";
$CC_DBC->query($sql);
}
} else {
Logging::log("Warning unexpected value: ".$key);
}
}
}

View File

@ -120,23 +120,31 @@ class Application_Model_Systemstatus
public static function GetPypoStatus(){
$component = CcServiceRegisterQuery::create()->findOneByDbName("pypo");
$ip = $component->getDbIp();
$docRoot = self::GetMonitStatus($ip);
$data = self::ExtractServiceInformation($docRoot, "airtime-playout");
if (is_null($component)){
return null;
} else {
$ip = $component->getDbIp();
$docRoot = self::GetMonitStatus($ip);
$data = self::ExtractServiceInformation($docRoot, "airtime-playout");
return $data;
return $data;
}
}
public static function GetLiquidsoapStatus(){
$component = CcServiceRegisterQuery::create()->findOneByDbName("pypo");
$ip = $component->getDbIp();
$docRoot = self::GetMonitStatus($ip);
$data = self::ExtractServiceInformation($docRoot, "airtime-liquidsoap");
if (is_null($component)){
return null;
} else {
$ip = $component->getDbIp();
$docRoot = self::GetMonitStatus($ip);
$data = self::ExtractServiceInformation($docRoot, "airtime-liquidsoap");
return $data;
return $data;
}
}
public static function GetShowRecorderStatus(){

View File

@ -14,8 +14,8 @@ defined('APPLICATION_ENV')
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
realpath(APPLICATION_PATH . '/../library')
)));
//Propel classes.

View File

@ -0,0 +1,6 @@
<?php
/* The purpose of this file is get PHP to clear its cache regarding the
* filesystem layout. See this ticket http://dev.sourcefabric.org/browse/CC-3320 */
clearstatcache(true);

View File

@ -30,9 +30,11 @@ function generatePartitions(partitions){
var tr = $(row);
lastElement.after(tr);
var watched_dirs_ul = $('#watched-dir-list-'+i);
for (var j=0; j<partitions[i].dirs.length; j++){
watched_dirs_ul.append('<li>'+partitions[i].dirs[j]+'</li>');
if (partitions[i].dirs){
var watched_dirs_ul = $('#watched-dir-list-'+i);
for (var j=0; j<partitions[i].dirs.length; j++){
watched_dirs_ul.append('<li>'+partitions[i].dirs[j]+'</li>');
}
}
lastElement = tr;
}

View File

@ -1,4 +1,16 @@
2.0.0 - January 24, 2011
2.0.1 - February 14, 2012
* Changes:
* Widgets should have a version string so users can make sure widgets are up to date
* Bug Fixes:
* Fixed: Media monitor should not change the ownership of watched files if unnecessary
* Fixed: Sometimes the Current Playing Item on the top Panel in the UI incorrectly shows "Nothing Scheduled"
* Fixed: Stream settings page does not remember the stream metadata format
* Fixed: Airtime is missing Australia and Arctic timezones
* Fixed: Shows not recorded after upgrade to 2.0.0 from 1.8.2
* Fixed: Don't make it necessary users clear their browser cache when Airtime is upgraded
* Fixed: Media-Monitor does not handle corrupt audio metadata gracefully
2.0.0 - January 24, 2012
* The cool stuff:
* Stream configuration through the browser
* You can have up to three streams with different bitrates and point them

View File

@ -39,7 +39,7 @@ php-pear php5-gd postgresql odbc-postgresql python2.6 libsoundtouch-ocaml \
libtaglib-ocaml libao-ocaml libmad-ocaml ecasound \
libesd0 libportaudio2 libsamplerate0 rabbitmq-server patch \
php5-curl mpg123 monit python-virtualenv multitail libcamomile-ocaml-data \
libvorbis-ocaml libpulse0 vorbis-tools lsb-release php-db
libpulse0 vorbis-tools lsb-release php-db
#install packages with --force-yes option (this is useful in the case
#of Debian, where these packages are unauthorized)
@ -52,7 +52,7 @@ apt-get -y --force-yes install libmp3lame-dev lame icecast2
if [ "$dist" = "Debian" ]; then
apt-get -y install zendframework
else
apt-get -y install zend-framework
apt-get -y install libzend-framework-php
fi

View File

@ -42,7 +42,7 @@ php-pear php5-gd postgresql odbc-postgresql python2.6 libsoundtouch-ocaml \
libtaglib-ocaml libao-ocaml libmad-ocaml ecasound \
libesd0 libportaudio2 libsamplerate0 rabbitmq-server patch \
php5-curl mpg123 monit python-virtualenv multitail libcamomile-ocaml-data \
libvorbis-ocaml libpulse0 vorbis-tools lsb-release php-db
libpulse0 vorbis-tools lsb-release php-db
#install packages with --force-yes option (this is useful in the case
#of Debian, where these packages are unauthorized)
@ -54,7 +54,7 @@ apt-get -y --force-yes install libmp3lame-dev lame icecast2
if [ "$dist" = "Debian" ]; then
apt-get -y install zendframework
else
apt-get -y install zend-framework
apt-get -y install libzend-framework-php
fi

View File

@ -78,6 +78,31 @@ SCRIPT=`readlink -f $0`
SCRIPTPATH=`dirname $SCRIPT`
AIRTIMEROOT=$SCRIPTPATH/../
#Check if required zend mvc and php-db libraries are present. This is a temporary workaround for 2.0.1,
#and we should probably create a seperate file that checks whether ALL dependencies are satisfied before
#allowing the install to continue. However in that case, we wouldn't check for Debian packages so that we
#can become less Debian platform dependent in the future...
set +e
dpkg -l | grep php-db > /dev/null 2>&1
PHP_DB=$?
dpkg -l | grep zendframework > /dev/null 2>&1
ZENDFRAMEWORK=$?
dpkg -l | grep libzend-framework-php > /dev/null 2>&1
LIBZEND=$?
set -e
if [ "$PHP_DB" != "0" ]; then
echo "php-db package missing. Please run airtime-full-install"
exit 1
fi
if [ "$ZENDFRAMEWORK" != "0" -a "$LIBZEND" != "0" ]; then
echo "zendframework/libzend-framework-php package missing. Please run airtime-full-install"
exit 1
fi
# Check if airtime exists already
set +e
php --php-ini ${SCRIPTPATH}/airtime-php.ini ${SCRIPTPATH}/include/airtime-installed-check.php
@ -98,6 +123,18 @@ elif [ "$result" -eq "3" ]; then
exit 1
fi
#We don't want any of our python services running if we are doing an upgrade/reinstall.
#They will be automatically restarted later on.
if [ -e /etc/init.d/airtime-media-monitor ]; then
/etc/init.d/airtime-media-monitor stop > /dev/null 2>&1
fi
if [ -e /etc/init.d/airtime-playout ]; then
/etc/init.d/airtime-playout stop > /dev/null 2>&1
fi
if [ -e /etc/init.d/airtime-show-recorder ]; then
/etc/init.d/airtime-show-recorder stop > /dev/null 2>&1
fi
#export these variables to make them available in sub bash scripts
export DO_UPGRADE
@ -145,6 +182,8 @@ fi
/usr/lib/airtime/utils/rabbitmq-update-pid.sh > /dev/null
touch /usr/share/airtime/public/index.php
if [ "$python_service" -eq "0" ]; then
#only run airtime-check-system if all components were installed
echo -e "\n*** Verifying your system environment, running airtime-check-system ***"

View File

@ -42,6 +42,7 @@ fi
echo "* Creating /etc/monit/conf.d/monit-airtime-generic.cfg"
mkdir -p /etc/monit/conf.d/
if [ ! -e /etc/monit/conf.d/monit-airtime-generic.cfg ]; then
rm -f /etc/monit/conf.d/*airtime*
cp $AIRTIMEROOT/python_apps/monit/monit-airtime-generic.cfg /etc/monit/conf.d/
fi

View File

@ -100,7 +100,11 @@ if (strcmp($version, "1.9.5") < 0){
pause();
}
if (strcmp($version, "2.0.0") < 0){
system("php ".__DIR__."/../upgrades/airtime-2.0.0/airtime-upgrade.php");
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.0.0/airtime-upgrade.php");
pause();
}
if (strcmp($version, "2.0.1") < 0){
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.0.1/airtime-upgrade.php");
pause();
}

View File

@ -16,7 +16,7 @@ class UpgradeCommon{
const CONF_PYPO_GRP = "pypo";
const CONF_WWW_DATA_GRP = "www-data";
const CONF_BACKUP_SUFFIX = "200";
const VERSION_NUMBER = "2.0";
const VERSION_NUMBER = "2.0.0";
public static function connectToDatabase($p_exitOnError = true)
{

View File

@ -445,9 +445,6 @@ class AirtimeMiscUpgrade{
}
}
echo "Pausing Pypo".PHP_EOL;
exec("/etc/init.d/airtime-playout stop");
while (@ob_end_flush());
UpgradeCommon::connectToDatabase();
@ -456,6 +453,3 @@ AirtimeDatabaseUpgrade::start();
AirtimeStorWatchedDirsUpgrade::start();
AirtimeConfigFileUpgrade::start();
AirtimeMiscUpgrade::start();
//echo "Resuming Pypo".PHP_EOL;
//exec("/etc/init.d/airtime-playout start");

View File

@ -0,0 +1,258 @@
<?php
require_once('DB.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";
const CONF_BACKUP_SUFFIX = "201";
const VERSION_NUMBER = "2.0.1";
public static function SetDefaultTimezone()
{
$sql = "SELECT valstr from cc_pref WHERE keystr = 'timezone'";
$result = self::queryDb($sql);
$timezone = $result['valstr'];
date_default_timezone_set($timezone);
}
public static function connectToDatabase($p_exitOnError = true)
{
global $CC_DBC, $CC_CONFIG;
$CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
if (PEAR::isError($CC_DBC)) {
echo $CC_DBC->getMessage().PHP_EOL;
echo $CC_DBC->getUserInfo().PHP_EOL;
echo "Database connection problem.".PHP_EOL;
echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists".
" with corresponding permissions.".PHP_EOL;
if ($p_exitOnError) {
exit(1);
}
} else {
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
}
}
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)
{
echo "Upgrading database, may take several minutes, please wait".PHP_EOL;
$appDir = self::GetAirtimeSrcDir();
$command = "php --php-ini $dir/../../airtime-php.ini ".
"$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 --php-ini $dir/../../airtime-php.ini ".
"$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")."-".UpgradeCommon::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
}
}
self::CreateIniFiles(UpgradeCommon::CONF_BACKUP_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__."/media-monitor.cfg.$suffix", self::CONF_FILE_MEDIAMONITOR)){
echo "Could not copy meadia-monitor.cfg to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/api_client.cfg.$suffix", self::CONF_FILE_API_CLIENT)){
echo "Could not copy api_client.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);
}
public static function queryDb($p_sql){
global $CC_DBC;
$result = $CC_DBC->getRow($p_sql, $fetchmode=DB_FETCHMODE_ASSOC);
if (PEAR::isError($result)) {
echo "Error executing $sql. Exiting.";
exit(1);
}
return $result;
}
}

View File

@ -0,0 +1,24 @@
set daemon 10 # Poll at 10 second intervals
#set logfile syslog facility log_daemon
set logfile /var/log/monit.log
set httpd port 2812 and use address 127.0.0.1
allow localhost
allow admin:monit
check process airtime-playout
with pidfile "/var/run/airtime-playout.pid"
start program = "/etc/init.d/airtime-playout monit-restart" with timeout 5 seconds
stop program = "/etc/init.d/airtime-playout stop"
check process airtime-liquidsoap
with pidfile "/var/run/airtime-liquidsoap.pid"
start program = "/etc/init.d/airtime-playout monit-restart" with timeout 5 seconds
stop program = "/etc/init.d/airtime-playout stop"
check process airtime-media-monitor
with pidfile "/var/run/airtime-media-monitor.pid"
start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-media-monitor stop"
check process airtime-show-recorder
with pidfile "/var/run/airtime-show-recorder.pid"
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-show-recorder stop"

View File

@ -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");

View File

@ -0,0 +1,85 @@
<?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.
*/
set_include_path(__DIR__.'/../../../airtime_mvc/library' . 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 'propel/runtime/lib/Propel.php';
Propel::init(__DIR__."/propel/airtime-conf.php");
require_once 'UpgradeCommon.php';
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(){
echo "* Updating configFiles\n";
self::changeConfigFilePermissions();
UpgradeCommon::upgradeConfigFiles();
}
/* 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. */
private static function changeConfigFilePermissions(){
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_AIRTIME, UpgradeCommon::CONF_WWW_DATA_GRP)){
echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting.";
exit(1);
}
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_API_CLIENT, UpgradeCommon::CONF_PYPO_GRP)){
echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting.";
exit(1);
}
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_PYPO, UpgradeCommon::CONF_PYPO_GRP)){
echo "Could not set ownership of pypo.cfg to 'pypo'. Exiting.";
exit(1);
}
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_RECORDER, UpgradeCommon::CONF_PYPO_GRP)){
echo "Could not set ownership of recorder.cfg to 'pypo'. Exiting.";
exit(1);
}
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_LIQUIDSOAP, UpgradeCommon::CONF_PYPO_GRP)){
echo "Could not set ownership of liquidsoap.cfg to 'pypo'. Exiting.";
exit(1);
}
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_MEDIAMONITOR, UpgradeCommon::CONF_PYPO_GRP)){
echo "Could not set ownership of media-monitor.cfg to 'pypo'. Exiting.";
exit(1);
}
}
private static function ChangeFileOwnerGroupMod($filename, $user){
return (chown($filename, $user) &&
chgrp($filename, $user) &&
chmod($filename, 0640));
}
}
UpgradeCommon::connectToDatabase();
UpgradeCommon::SetDefaultTimezone();
AirtimeConfigFileUpgrade::start();

View File

@ -0,0 +1,23 @@
[database]
host = localhost
dbname = airtime
dbuser = airtime
dbpass = airtime
[rabbitmq]
host = 127.0.0.1
port = 5672
user = guest
password = guest
vhost = /
[general]
api_key = AAA
web_server_user = www-data
airtime_dir = /usr/share/airtime/
base_url = localhost
base_port = 80
[soundcloud]
connection_retries = 3
time_between_retries = 60

View File

@ -0,0 +1,117 @@
bin_dir = "/usr/lib/airtime/api_clients"
#############################
## Common
#############################
# Value needed to access the API
api_key = 'AAA'
# Path to the base of the API
api_base = 'api'
# URL to get the version number of the server API
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
base_url = 'localhost'
base_port = 80
#############################
## Config for Media Monitor
#############################
# URL to setup the media monitor
media_setup_url = 'media-monitor-setup/format/json/api_key/%%api_key%%'
# Tell Airtime the file id associated with a show instance.
upload_recorded = 'upload-recorded/format/json/api_key/%%api_key%%/fileid/%%fileid%%/showinstanceid/%%showinstanceid%%'
# URL to tell Airtime to update file's meta data
update_media_url = 'reload-metadata/format/json/api_key/%%api_key%%/mode/%%mode%%'
# URL to tell Airtime we want a listing of all files it knows about
list_all_db_files = 'list-all-files/format/json/api_key/%%api_key%%/dir_id/%%dir_id%%'
# URL to tell Airtime we want a listing of all dirs its watching (including the stor dir)
list_all_watched_dirs = 'list-all-watched-dirs/format/json/api_key/%%api_key%%'
# URL to tell Airtime we want to add watched directory
add_watched_dir = 'add-watched-dir/format/json/api_key/%%api_key%%/path/%%path%%'
# URL to tell Airtime we want to add watched directory
remove_watched_dir = 'remove-watched-dir/format/json/api_key/%%api_key%%/path/%%path%%'
# URL to tell Airtime we want to add watched directory
set_storage_dir = 'set-storage-dir/format/json/api_key/%%api_key%%/path/%%path%%'
#############################
## Config for Recorder
#############################
# URL to get the schedule of shows set to record
show_schedule_url = 'recorded-shows/format/json/api_key/%%api_key%%'
# URL to upload the recorded show's file to Airtime
upload_file_url = 'upload-file/format/json/api_key/%%api_key%%'
#number of retries to upload file if connection problem
upload_retries = 3
#time to wait between attempts to upload file if connection problem (in seconds)
upload_wait = 60
################################################################################
# Uncomment *one of the sets* of values from the API clients below, and comment
# out all the others.
################################################################################
#############################
## Config for Pypo
#############################
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
export_url = 'schedule/api_key/%%api_key%%'
get_media_url = 'get-media/file/%%file%%/api_key/%%api_key%%'
# Update whether a schedule group has begun playing.
update_item_url = 'notify-schedule-group-play/api_key/%%api_key%%/schedule_id/%%schedule_id%%'
# Update whether an audio clip is currently playing.
update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/media_id/%%media_id%%/schedule_id/%%schedule_id%%'
# ???
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%%/'
#URL to update liquidsoap status
update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%'
##############
# OBP config #
##############
# URL to get the version number of the server API
#version_url = 'api/pypo/status/json'
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
# Update whether an item has been played.
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
# Update whether an item is currently playing.
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
# ???
#generate_range_url = 'api/pypo/generate_range_dp/'

View File

@ -0,0 +1,69 @@
###########################################
# Liquidsoap config file #
###########################################
###########################################
# Output settings #
###########################################
output_sound_device = false
output_sound_device_type = "ALSA"
s1_output = "icecast"
s2_output = "icecast"
s3_output = "icecast"
s1_enable = true
s2_enable = false
s3_enable = false
s1_type = "ogg"
s2_type = "ogg"
s3_type = "mp3"
s1_bitrate = 128
s2_bitrate = 128
s3_bitrate = 160
###########################################
# Logging settings #
###########################################
log_file = "/var/log/airtime/pypo-liquidsoap/<script>.log"
#log_level = 3
###########################################
# Icecast Stream settings #
###########################################
s1_host = "127.0.0.1"
s2_host = "127.0.0.1"
s3_host = "127.0.0.1"
s1_port = 8000
s2_port = 8000
s3_port = 8000
s1_user = ""
s2_user = ""
s3_user = ""
s1_pass = "hackme"
s2_pass = "hackme"
s3_pass = "hackme"
# Icecast mountpoint names
s1_mount = "airtime_128.ogg"
s2_mount = "airtime_128.ogg"
s3_mount = "airtime_160.mp3"
# Webstream metadata settings
s1_url = "http://airtime.sourcefabric.org"
s2_url = "http://airtime.sourcefabric.org"
s3_url = "http://airtime.sourcefabric.org"
s1_description = "Airtime Radio! stream1"
s2_description = "Airtime Radio! stream2"
s3_description = "Airtime Radio! stream3"
s1_genre = "genre"
s2_genre = "genre"
s3_genre = "genre"
# Audio stream metadata for vorbis/ogg is disabled by default
# due to a number of client media players that disconnect
# when the metadata changes to a new track. Some versions of
# mplayer and VLC have this problem. Enable this option at your
# own risk!
icecast_vorbis_metadata = false

View File

@ -0,0 +1,22 @@
api_client = "airtime"
# where the binary files live
bin_dir = '/usr/lib/airtime/media-monitor'
# where the logging files live
log_dir = '/var/log/airtime/media-monitor'
############################################
# RabbitMQ settings #
############################################
rabbitmq_host = 'localhost'
rabbitmq_user = 'guest'
rabbitmq_password = 'guest'
rabbitmq_vhost = '/'
############################################
# Media-Monitor preferences #
############################################
check_filesystem_events = 5 #how long to queue up events performed on the files themselves.
check_airtime_events = 30 #how long to queue metadata input from airtime.

View File

@ -0,0 +1,28 @@
<?php
// This file generated by Propel 1.5.2 convert-conf target - with modifications by Martin
// from XML runtime conf file /home/naomiaro/dev-campcaster/campcaster/build/runtime-conf.xml
$ini = parse_ini_file('/etc/airtime/airtime.conf', true);
$dbhost = $ini['database']['host'];
$dbname = $ini['database']['dbname'];
$dbuser = $ini['database']['dbuser'];
$dbpass = $ini['database']['dbpass'];
$conf = array (
'datasources' =>
array (
'airtime' =>
array (
'adapter' => 'pgsql',
'connection' =>
array (
'dsn' => "pgsql:host=$dbhost;port=5432;dbname=$dbname;user=$dbuser;password=$dbpass",
),
),
'default' => 'airtime',
),
'generator_version' => '1.5.2',
);
$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-airtime-conf.php');
return $conf;

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_access' 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 CcAccess extends BaseCcAccess {
} // CcAccess

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_access' 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 CcAccessPeer extends BaseCcAccessPeer {
} // CcAccessPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_access' 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 CcAccessQuery extends BaseCcAccessQuery {
} // CcAccessQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_backup' 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 CcBackup extends BaseCcBackup {
} // CcBackup

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_backup' 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 CcBackupPeer extends BaseCcBackupPeer {
} // CcBackupPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_backup' 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 CcBackupQuery extends BaseCcBackupQuery {
} // CcBackupQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_country' 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 CcCountry extends BaseCcCountry {
} // CcCountry

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_country' 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 CcCountryPeer extends BaseCcCountryPeer {
} // CcCountryPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_country' 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 CcCountryQuery extends BaseCcCountryQuery {
} // CcCountryQuery

View File

@ -0,0 +1,31 @@
<?php
require_once('Common.php');
/**
* Skeleton subclass for representing a row from the 'cc_files' 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.campcaster
*/
class CcFiles extends BaseCcFiles {
public function getDbLength()
{
return $this->length;
}
public function setDbLength($time)
{
$this->length = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::LENGTH;
return Common::setTimeInSub($this, 'LENGTH', $time);
}
} // CcFiles

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_files' 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 CcFilesPeer extends BaseCcFilesPeer {
} // CcFilesPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_files' 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 CcFilesQuery extends BaseCcFilesQuery {
} // CcFilesQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_login_attempts' 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 CcLoginAttempts extends BaseCcLoginAttempts {
} // CcLoginAttempts

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_login_attempts' 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 CcLoginAttemptsPeer extends BaseCcLoginAttemptsPeer {
} // CcLoginAttemptsPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_login_attempts' 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 CcLoginAttemptsQuery extends BaseCcLoginAttemptsQuery {
} // CcLoginAttemptsQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_music_dirs' 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 CcMusicDirs extends BaseCcMusicDirs {
} // CcMusicDirs

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_music_dirs' 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 CcMusicDirsPeer extends BaseCcMusicDirsPeer {
} // CcMusicDirsPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_music_dirs' 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 CcMusicDirsQuery extends BaseCcMusicDirsQuery {
} // CcMusicDirsQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_perms' 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 CcPerms extends BaseCcPerms {
} // CcPerms

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_perms' 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 CcPermsPeer extends BaseCcPermsPeer {
} // CcPermsPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_perms' 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 CcPermsQuery extends BaseCcPermsQuery {
} // CcPermsQuery

View File

@ -0,0 +1,48 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_playlist' 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.campcaster
*/
class CcPlaylist extends BaseCcPlaylist {
public function computeLastPosition()
{
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
$sql = 'SELECT MAX('.CcPlaylistcontentsPeer::POSITION.') AS pos'
. ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME
. ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1';
$stmt = $con->prepare($sql);
$stmt->bindValue(':p1', $this->getDbId());
$stmt->execute();
return $stmt->fetchColumn();
}
public function computeLength()
{
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
$sql = 'SELECT SUM('.CcPlaylistcontentsPeer::CLIPLENGTH.') AS length'
. ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME
. ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1';
$stmt = $con->prepare($sql);
$stmt->bindValue(':p1', $this->getDbId());
$stmt->execute();
return $stmt->fetchColumn();
}
} // CcPlaylist

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playlist' 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 CcPlaylistPeer extends BaseCcPlaylistPeer {
} // CcPlaylistPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playlist' 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 CcPlaylistQuery extends BaseCcPlaylistQuery {
} // CcPlaylistQuery

View File

@ -0,0 +1,81 @@
<?php
require_once('Common.php');
/**
* Skeleton subclass for representing a row from the 'cc_playlistcontents' 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.campcaster
*/
class CcPlaylistcontents extends BaseCcPlaylistcontents {
public function getDbFadein()
{
return $this->fadein;
}
public function setDbFadein($time)
{
$this->fadein = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN;
Common::setTimeInSub($this, 'FADEIN', $time);
}
public function getDbFadeout()
{
return $this->fadeout;
}
public function setDbFadeout($time)
{
$this->fadeout = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT;
Common::setTimeInSub($this, 'FADEOUT', $time);
}
public function getDbCuein()
{
return $this->cuein;
}
public function setDbCuein($time)
{
$this->cuein = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
Common::setTimeInSub($this, 'CUEIN', $time);
}
public function getDbCueout()
{
return $this->cueout;
}
public function setDbCueout($time)
{
$this->cueout = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
Common::setTimeInSub($this, 'CUEOUT', $time);
}
public function getDbCliplength()
{
return $this->cliplength;
}
public function setDbCliplength($time)
{
$this->cliplength = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
Common::setTimeInSub($this, 'CLIPLENGTH', $time);
}
} // CcPlaylistcontents

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playlistcontents' 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 CcPlaylistcontentsPeer extends BaseCcPlaylistcontentsPeer {
} // CcPlaylistcontentsPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playlistcontents' 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 CcPlaylistcontentsQuery extends BaseCcPlaylistcontentsQuery {
} // CcPlaylistcontentsQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_pref' 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 CcPref extends BaseCcPref {
} // CcPref

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_pref' 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 CcPrefPeer extends BaseCcPrefPeer {
} // CcPrefPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_pref' 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 CcPrefQuery extends BaseCcPrefQuery {
} // CcPrefQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_schedule' 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 CcSchedule extends BaseCcSchedule {
} // CcSchedule

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_schedule' 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 CcSchedulePeer extends BaseCcSchedulePeer {
} // CcSchedulePeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_schedule' 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 CcScheduleQuery extends BaseCcScheduleQuery {
} // CcScheduleQuery

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_sess' 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 CcSess extends BaseCcSess {
} // CcSess

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_sess' 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 CcSessPeer extends BaseCcSessPeer {
} // CcSessPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_sess' 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 CcSessQuery extends BaseCcSessQuery {
} // CcSessQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show' 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 CcShow extends BaseCcShow {
} // CcShow

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show_days' 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 CcShowDays extends BaseCcShowDays {
} // CcShowDays

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_days' 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 CcShowDaysPeer extends BaseCcShowDaysPeer {
} // CcShowDaysPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_days' 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 CcShowDaysQuery extends BaseCcShowDaysQuery {
} // CcShowDaysQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show_hosts' 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 CcShowHosts extends BaseCcShowHosts {
} // CcShowHosts

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_hosts' 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 CcShowHostsPeer extends BaseCcShowHostsPeer {
} // CcShowHostsPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_hosts' 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 CcShowHostsQuery extends BaseCcShowHostsQuery {
} // CcShowHostsQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show_instances' 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 CcShowInstances extends BaseCcShowInstances {
} // CcShowInstances

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_instances' 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 CcShowInstancesPeer extends BaseCcShowInstancesPeer {
} // CcShowInstancesPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_instances' 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 CcShowInstancesQuery extends BaseCcShowInstancesQuery {
} // CcShowInstancesQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show' 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 CcShowPeer extends BaseCcShowPeer {
} // CcShowPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show' 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 CcShowQuery extends BaseCcShowQuery {
} // CcShowQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show_rebroadcast' 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 CcShowRebroadcast extends BaseCcShowRebroadcast {
} // CcShowRebroadcast

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_rebroadcast' 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 CcShowRebroadcastPeer extends BaseCcShowRebroadcastPeer {
} // CcShowRebroadcastPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_rebroadcast' 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 CcShowRebroadcastQuery extends BaseCcShowRebroadcastQuery {
} // CcShowRebroadcastQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show_schedule' 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 CcShowSchedule extends BaseCcShowSchedule {
} // CcShowSchedule

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_schedule' 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 CcShowSchedulePeer extends BaseCcShowSchedulePeer {
} // CcShowSchedulePeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_schedule' 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 CcShowScheduleQuery extends BaseCcShowScheduleQuery {
} // CcShowScheduleQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_smemb' 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 CcSmemb extends BaseCcSmemb {
} // CcSmemb

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_smemb' 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 CcSmembPeer extends BaseCcSmembPeer {
} // CcSmembPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_smemb' 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 CcSmembQuery extends BaseCcSmembQuery {
} // CcSmembQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_stream_setting' 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 CcStreamSetting extends BaseCcStreamSetting {
} // CcStreamSetting

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_stream_setting' 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 CcStreamSettingPeer extends BaseCcStreamSettingPeer {
} // CcStreamSettingPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_stream_setting' 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 CcStreamSettingQuery extends BaseCcStreamSettingQuery {
} // CcStreamSettingQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_subjs' 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 CcSubjs extends BaseCcSubjs {
} // CcSubjs

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_subjs' 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 CcSubjsPeer extends BaseCcSubjsPeer {
} // CcSubjsPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_subjs' 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 CcSubjsQuery extends BaseCcSubjsQuery {
} // CcSubjsQuery

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_trans' 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 CcTrans extends BaseCcTrans {
} // CcTrans

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_trans' 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 CcTransPeer extends BaseCcTransPeer {
} // CcTransPeer

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_trans' 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 CcTransQuery extends BaseCcTransQuery {
} // CcTransQuery

View File

@ -0,0 +1,19 @@
<?php
class Common {
public static function setTimeInSub($row, $col, $time)
{
$class = get_class($row).'Peer';
$con = Propel::getConnection($class::DATABASE_NAME);
$sql = 'UPDATE '.$class::TABLE_NAME
. ' SET '.$col.' = :f1'
. ' WHERE ' .$class::ID. ' = :p1';
$stmt = $con->prepare($sql);
$stmt->bindValue(':f1', $time);
$stmt->bindValue(':p1', $row->getDbId());
$stmt->execute();
}
}

View File

@ -0,0 +1,61 @@
<?php
/**
* This class defines the structure of the 'cc_access' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcAccessTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcAccessTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_access');
$this->setPhpName('CcAccess');
$this->setClassname('CcAccess');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_access_id_seq');
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('GUNID', 'Gunid', 'CHAR', false, 32, null);
$this->addColumn('TOKEN', 'Token', 'BIGINT', false, null, null);
$this->addColumn('CHSUM', 'Chsum', 'CHAR', true, 32, '');
$this->addColumn('EXT', 'Ext', 'VARCHAR', true, 128, '');
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 20, '');
$this->addColumn('PARENT', 'Parent', 'BIGINT', false, null, null);
$this->addForeignKey('OWNER', 'Owner', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
$this->addColumn('TS', 'Ts', 'TIMESTAMP', false, null, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner' => 'id', ), null, null);
} // buildRelations()
} // CcAccessTableMap

View File

@ -0,0 +1,55 @@
<?php
/**
* This class defines the structure of the 'cc_backup' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcBackupTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcBackupTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_backup');
$this->setPhpName('CcBackup');
$this->setClassname('CcBackup');
$this->setPackage('airtime');
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('TOKEN', 'Token', 'VARCHAR', true, 64, null);
$this->addColumn('SESSIONID', 'Sessionid', 'VARCHAR', true, 64, null);
$this->addColumn('STATUS', 'Status', 'VARCHAR', true, 32, null);
$this->addColumn('FROMTIME', 'Fromtime', 'TIMESTAMP', true, null, null);
$this->addColumn('TOTIME', 'Totime', 'TIMESTAMP', true, null, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
} // buildRelations()
} // CcBackupTableMap

View File

@ -0,0 +1,52 @@
<?php
/**
* This class defines the structure of the 'cc_country' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcCountryTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcCountryTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_country');
$this->setPhpName('CcCountry');
$this->setClassname('CcCountry');
$this->setPackage('airtime');
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('ISOCODE', 'DbIsoCode', 'CHAR', true, 3, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
} // buildRelations()
} // CcCountryTableMap

Some files were not shown because too many files have changed in this diff Show More