CC-2807: Remove AIRTIME_VERSION from constants.php and use the value in the database instead

-done
This commit is contained in:
martin 2011-09-23 16:26:19 -04:00
parent e60db9e031
commit cd95170b06
10 changed files with 94 additions and 147 deletions

View file

@ -1,6 +1,5 @@
<?php
define('AIRTIME_VERSION', '2.0.0-beta1');
define('AIRTIME_COPYRIGHT_DATE', '2010-2011');
define('AIRTIME_REST_VERSION', '1.1');

View file

@ -36,7 +36,7 @@ class ApiController extends Zend_Controller_Action
*
* First checks to ensure the correct API key was
* supplied, then returns AIRTIME_VERSION as defined
* in application/conf.php
* in the database
*
* @return void
*
@ -56,7 +56,7 @@ class ApiController extends Zend_Controller_Action
print 'You are not allowed to access this resource.';
exit;
}
$jsonStr = json_encode(array("version"=>AIRTIME_VERSION));
$jsonStr = json_encode(array("version"=>Application_Model_Preference::GetAirtimeVersion()));
echo $jsonStr;
}
@ -662,7 +662,7 @@ class ApiController extends Zend_Controller_Action
$status = array(
"platform"=>Application_Model_Systemstatus::GetPlatformInfo(),
"airtime_version"=>Application_Model_Systemstatus::GetAirtimeVersion(),
"airtime_version"=>Application_Model_Preference::GetAirtimeVersion(),
"services"=>array(
"icecast2"=>Application_Model_Systemstatus::GetIcecastStatus(),
"rabbitmq"=>Application_Model_Systemstatus::GetRabbitMqStatus(),

View file

@ -83,7 +83,7 @@ class LoginController extends Zend_Controller_Action
$this->view->message = $message;
$this->view->error = $error;
$this->view->form = $form;
$this->view->airtimeVersion = AIRTIME_VERSION;
$this->view->airtimeVersion = Application_Model_Preference::GetAirtimeVersion();
$this->view->airtimeCopyright = AIRTIME_COPYRIGHT_DATE;
}

View file

@ -68,7 +68,7 @@ class Application_Model_Preference
if (isset($defaultNamespace->title)) {
$title = $defaultNamespace->title;
} else {
$title = Application_Model_Preference::GetValue("station_name");
$title = self::GetValue("station_name");
$defaultNamespace->title = $title;
}
if (strlen($title) > 0)
@ -78,7 +78,7 @@ class Application_Model_Preference
}
public static function SetHeadTitle($title, $view){
Application_Model_Preference::SetValue("station_name", $title);
self::SetValue("station_name", $title);
$defaultNamespace = new Zend_Session_Namespace('title_name');
$defaultNamespace->title = $title;
RabbitMq::PushSchedule();
@ -86,101 +86,101 @@ class Application_Model_Preference
//set session variable to new station name so that html title is updated.
//should probably do this in a view helper to keep this controller as minimal as possible.
$view->headTitle()->exchangeArray(array()); //clear headTitle ArrayObject
$view->headTitle(Application_Model_Preference::GetHeadTitle());
$view->headTitle(self::GetHeadTitle());
}
public static function SetShowsPopulatedUntil($timestamp) {
Application_Model_Preference::SetValue("shows_populated_until", $timestamp);
self::SetValue("shows_populated_until", $timestamp);
}
public static function GetShowsPopulatedUntil() {
return Application_Model_Preference::GetValue("shows_populated_until");
return self::GetValue("shows_populated_until");
}
public static function SetDefaultFade($fade) {
Application_Model_Preference::SetValue("default_fade", $fade);
self::SetValue("default_fade", $fade);
}
public static function GetDefaultFade() {
return Application_Model_Preference::GetValue("default_fade");
return self::GetValue("default_fade");
}
public static function SetStreamLabelFormat($type){
Application_Model_Preference::SetValue("stream_label_format", $type);
self::SetValue("stream_label_format", $type);
RabbitMq::PushSchedule();
}
public static function GetStreamLabelFormat(){
return Application_Model_Preference::getValue("stream_label_format");
return self::getValue("stream_label_format");
}
public static function GetStationName(){
return Application_Model_Preference::getValue("station_name");
return self::getValue("station_name");
}
public static function SetDoSoundCloudUpload($upload) {
Application_Model_Preference::SetValue("soundcloud_upload", $upload);
self::SetValue("soundcloud_upload", $upload);
}
public static function GetDoSoundCloudUpload() {
return Application_Model_Preference::GetValue("soundcloud_upload");
return self::GetValue("soundcloud_upload");
}
public static function SetSoundCloudUser($user) {
Application_Model_Preference::SetValue("soundcloud_user", $user);
self::SetValue("soundcloud_user", $user);
}
public static function GetSoundCloudUser() {
return Application_Model_Preference::GetValue("soundcloud_user");
return self::GetValue("soundcloud_user");
}
public static function SetSoundCloudPassword($password) {
if (strlen($password) > 0)
Application_Model_Preference::SetValue("soundcloud_password", $password);
self::SetValue("soundcloud_password", $password);
}
public static function GetSoundCloudPassword() {
return Application_Model_Preference::GetValue("soundcloud_password");
return self::GetValue("soundcloud_password");
}
public static function SetSoundCloudTags($tags) {
Application_Model_Preference::SetValue("soundcloud_tags", $tags);
self::SetValue("soundcloud_tags", $tags);
}
public static function GetSoundCloudTags() {
return Application_Model_Preference::GetValue("soundcloud_tags");
return self::GetValue("soundcloud_tags");
}
public static function SetSoundCloudGenre($genre) {
Application_Model_Preference::SetValue("soundcloud_genre", $genre);
self::SetValue("soundcloud_genre", $genre);
}
public static function GetSoundCloudGenre() {
return Application_Model_Preference::GetValue("soundcloud_genre");
return self::GetValue("soundcloud_genre");
}
public static function SetSoundCloudTrackType($track_type) {
Application_Model_Preference::SetValue("soundcloud_tracktype", $track_type);
self::SetValue("soundcloud_tracktype", $track_type);
}
public static function GetSoundCloudTrackType() {
return Application_Model_Preference::GetValue("soundcloud_tracktype");
return self::GetValue("soundcloud_tracktype");
}
public static function SetSoundCloudLicense($license) {
Application_Model_Preference::SetValue("soundcloud_license", $license);
self::SetValue("soundcloud_license", $license);
}
public static function GetSoundCloudLicense() {
return Application_Model_Preference::GetValue("soundcloud_license");
return self::GetValue("soundcloud_license");
}
public static function SetAllow3rdPartyApi($bool) {
Application_Model_Preference::SetValue("third_party_api", $bool);
self::SetValue("third_party_api", $bool);
}
public static function GetAllow3rdPartyApi() {
$val = Application_Model_Preference::GetValue("third_party_api");
$val = self::GetValue("third_party_api");
if (strlen($val) == 0){
return "0";
} else {
@ -189,101 +189,101 @@ class Application_Model_Preference
}
public static function SetPhone($phone){
Application_Model_Preference::SetValue("phone", $phone);
self::SetValue("phone", $phone);
}
public static function GetPhone(){
return Application_Model_Preference::GetValue("phone");
return self::GetValue("phone");
}
public static function SetEmail($email){
Application_Model_Preference::SetValue("email", $email);
self::SetValue("email", $email);
}
public static function GetEmail(){
return Application_Model_Preference::GetValue("email");
return self::GetValue("email");
}
public static function SetStationWebSite($site){
Application_Model_Preference::SetValue("station_website", $site);
self::SetValue("station_website", $site);
}
public static function GetStationWebSite(){
return Application_Model_Preference::GetValue("station_website");
return self::GetValue("station_website");
}
public static function SetSupportFeedback($feedback){
Application_Model_Preference::SetValue("support_feedback", $feedback);
self::SetValue("support_feedback", $feedback);
}
public static function GetSupportFeedback(){
return Application_Model_Preference::GetValue("support_feedback");
return self::GetValue("support_feedback");
}
public static function SetPublicise($publicise){
Application_Model_Preference::SetValue("publicise", $publicise);
self::SetValue("publicise", $publicise);
}
public static function GetPublicise(){
return Application_Model_Preference::GetValue("publicise");
return self::GetValue("publicise");
}
public static function SetRegistered($registered){
Application_Model_Preference::SetValue("registered", $registered);
self::SetValue("registered", $registered);
}
public static function GetRegistered(){
return Application_Model_Preference::GetValue("registered");
return self::GetValue("registered");
}
public static function SetStationCountry($country){
Application_Model_Preference::SetValue("country", $country);
self::SetValue("country", $country);
}
public static function GetStationCountry(){
return Application_Model_Preference::GetValue("country");
return self::GetValue("country");
}
public static function SetStationCity($city){
Application_Model_Preference::SetValue("city", $city);
self::SetValue("city", $city);
}
public static function GetStationCity(){
return Application_Model_Preference::GetValue("city");
return self::GetValue("city");
}
public static function SetStationDescription($description){
Application_Model_Preference::SetValue("description", $description);
self::SetValue("description", $description);
}
public static function GetStationDescription(){
return Application_Model_Preference::GetValue("description");
return self::GetValue("description");
}
public static function SetTimezone($timezone){
Application_Model_Preference::SetValue("timezone", $timezone);
self::SetValue("timezone", $timezone);
date_default_timezone_set($timezone);
$md = array("timezone" => $timezone);
}
public static function GetTimezone(){
return Application_Model_Preference::GetValue("timezone");
return self::GetValue("timezone");
}
public static function SetStationLogo($imagePath){
if(!empty($imagePath)){
$image = @file_get_contents($imagePath);
$image = base64_encode($image);
Application_Model_Preference::SetValue("logoImage", $image);
self::SetValue("logoImage", $image);
}
}
public static function GetStationLogo(){
return Application_Model_Preference::GetValue("logoImage");
return self::GetValue("logoImage");
}
public static function GetUniqueId(){
return Application_Model_Preference::GetValue("uniqueId");
return self::GetValue("uniqueId");
}
public static function GetCountryList(){
@ -315,13 +315,13 @@ class Application_Model_Preference
$outputArray = array();
$outputArray['STATION_NAME'] = Application_Model_Preference::GetStationName();
$outputArray['PHONE'] = Application_Model_Preference::GetPhone();
$outputArray['EMAIL'] = Application_Model_Preference::GetEmail();
$outputArray['STATION_WEB_SITE'] = Application_Model_Preference::GetStationWebSite();
$outputArray['STATION_COUNTRY'] = Application_Model_Preference::GetStationCountry();
$outputArray['STATION_CITY'] = Application_Model_Preference::GetStationCity();
$outputArray['STATION_DESCRIPTION'] = Application_Model_Preference::GetStationDescription();
$outputArray['STATION_NAME'] = self::GetStationName();
$outputArray['PHONE'] = self::GetPhone();
$outputArray['EMAIL'] = self::GetEmail();
$outputArray['STATION_WEB_SITE'] = self::GetStationWebSite();
$outputArray['STATION_COUNTRY'] = self::GetStationCountry();
$outputArray['STATION_CITY'] = self::GetStationCity();
$outputArray['STATION_DESCRIPTION'] = self::GetStationDescription();
// get web server info
if(isset($systemInfoArray["AIRTIME_VERSION_URL"])){
@ -338,7 +338,7 @@ class Application_Model_Preference
$outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount();
$outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Schedule::getSchduledPlaylistCount();
$outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(date("Y-m-d H:i:s"));
$outputArray['UNIQUE_ID'] = Application_Model_Preference::GetUniqueId();
$outputArray['UNIQUE_ID'] = self::GetUniqueId();
$outputArray = array_merge($systemInfoArray, $outputArray);
@ -349,8 +349,8 @@ class Application_Model_Preference
}
}
if($returnArray){
$outputArray['PROMOTE'] = Application_Model_Preference::GetPublicise();
$outputArray['LOGOIMG'] = Application_Model_Preference::GetStationLogo();
$outputArray['PROMOTE'] = self::GetPublicise();
$outputArray['LOGOIMG'] = self::GetStationLogo();
return $outputArray;
}else{
return $outputString;
@ -359,80 +359,84 @@ class Application_Model_Preference
public static function SetRemindMeDate($now){
$weekAfter = mktime(0, 0, 0, date("m") , date("d")+7, date("Y"));
Application_Model_Preference::SetValue("remindme", $weekAfter);
self::SetValue("remindme", $weekAfter);
}
public static function GetRemindMeDate(){
return Application_Model_Preference::GetValue("remindme");
return self::GetValue("remindme");
}
public static function SetImportTimestamp(){
$now = time();
if(Application_Model_Preference::GetImportTimestamp()+5 < $now){
Application_Model_Preference::SetValue("import_timestamp", $now);
if(self::GetImportTimestamp()+5 < $now){
self::SetValue("import_timestamp", $now);
}
}
public static function GetImportTimestamp(){
return Application_Model_Preference::GetValue("import_timestamp");
return self::GetValue("import_timestamp");
}
public static function GetStreamType(){
$st = Application_Model_Preference::GetValue("stream_type");
$st = self::GetValue("stream_type");
return explode(',', $st);
}
public static function GetStreamBitrate(){
$sb = Application_Model_Preference::GetValue("stream_bitrate");
$sb = self::GetValue("stream_bitrate");
return explode(',', $sb);
}
public static function SetPrivacyPolicyCheck($flag){
Application_Model_Preference::SetValue("privacy_policy", $flag);
self::SetValue("privacy_policy", $flag);
}
public static function GetPrivacyPolicyCheck(){
return Application_Model_Preference::GetValue("privacy_policy");
return self::GetValue("privacy_policy");
}
public static function SetNumOfStreams($num){
Application_Model_Preference::SetValue("num_of_streams", intval($num));
self::SetValue("num_of_streams", intval($num));
}
public static function GetNumOfStreams(){
return Application_Model_Preference::GetValue("num_of_streams");
return self::GetValue("num_of_streams");
}
public static function SetMaxBitrate($bitrate){
Application_Model_Preference::SetValue("max_bitrate", intval($bitrate));
self::SetValue("max_bitrate", intval($bitrate));
}
public static function GetMaxBitrate(){
return Application_Model_Preference::GetValue("max_bitrate");
return self::GetValue("max_bitrate");
}
public static function SetPlanLevel($plan){
Application_Model_Preference::SetValue("plan_level", $plan);
self::SetValue("plan_level", $plan);
}
public static function GetPlanLevel(){
return Application_Model_Preference::GetValue("plan_level");
return self::GetValue("plan_level");
}
public static function SetTrialEndingDate($date){
Application_Model_Preference::SetValue("trial_end_date", $date);
self::SetValue("trial_end_date", $date);
}
public static function GetTrialEndingDate(){
return Application_Model_Preference::GetValue("trial_end_date");
return self::GetValue("trial_end_date");
}
public static function SetDisableStreamConf($bool){
Application_Model_Preference::SetValue("disable_stream_conf", $bool);
self::SetValue("disable_stream_conf", $bool);
}
public static function GetDisableStreamConf(){
return Application_Model_Preference::GetValue("disable_stream_conf");
return self::GetValue("disable_stream_conf");
}
public static function GetAirtimeVersion(){
return self::GetValue("system_version");
}
}

View file

@ -174,11 +174,6 @@ class Application_Model_Systemstatus
return $data;
}
public static function GetAirtimeVersion(){
return AIRTIME_VERSION;
}
public static function GetDiskInfo(){
/* First lets get all the watched directories. Then we can group them
* into the same paritions by comparing the partition sizes. */
@ -202,58 +197,4 @@ class Application_Model_Systemstatus
return array_values($partitions);
}
/*
private function getCheckSystemResults(){
//exec("airtime-check-system", $output);
require_once "/usr/lib/airtime/utils/airtime-check-system.php";
$arrs = AirtimeCheck::CheckAirtimeDaemons();
$status = array("AIRTIME_VERSION" => AIRTIME_VERSION);
foreach($arrs as $arr){
$status[$arr[0]] = $arr[1];
}
$storDir = Application_Model_MusicDir::getStorDir()->getDirectory();
$freeSpace = disk_free_space($storDir);
$totalSpace = disk_total_space($storDir);
$status["DISK_SPACE"] = sprintf("%01.3f%%", $freeSpace/$totalSpace*100);
return $status;
}
public function getResults(){
$keyValues = $this->getCheckSystemResults();
$results = array();
$key = "AIRTIME_VERSION";
$results[$key] = array("Airtime Version", $keyValues[$key], false);
$triplets = array(array("PLAYOUT_ENGINE_RUNNING_SECONDS", "Playout Engine Status", true),
array("LIQUIDSOAP_RUNNING_SECONDS", "Liquidsoap Status", true),
array("MEDIA_MONITOR_RUNNING_SECONDS", "Media-Monitor Status", true),
array("SHOW_RECORDER_RUNNING_SECONDS", "Show-Recorder Status", true));
foreach($triplets as $triple){
list($key, $desc, $downloadLog) = $triple;
$results[$key] = array($desc, $this->convertRunTimeToPassFail($keyValues[$key]), $downloadLog);
}
$key = "DISK_SPACE";
$results[$key] = array("Disk Space Free: ", $keyValues[$key], false);
return $results;
}
private function convertRunTimeToPassFail($runTime){
return $runTime > 3 ? "Pass" : "Fail";
}
*/
}

View file

@ -0,0 +1,3 @@
<?php
define('AIRTIME_VERSION', '2.0.0-beta1');

View file

@ -9,8 +9,8 @@ set_include_path(__DIR__.'/../airtime_mvc/library' . PATH_SEPARATOR . get_includ
require_once(dirname(__FILE__).'/AirtimeIni.php');
require_once(dirname(__FILE__).'/AirtimeInstall.php');
require_once(__DIR__.'/airtime-constants.php');
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/constants.php');
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
echo PHP_EOL."*** Database Installation ***".PHP_EOL;

View file

@ -13,7 +13,7 @@ set_include_path(__DIR__.'/../../airtime_mvc/library' . PATH_SEPARATOR . get_inc
require_once(dirname(__FILE__).'/AirtimeIni.php');
require_once(dirname(__FILE__).'/AirtimeInstall.php');
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/constants.php');
require_once(__DIR__.'/airtime-constants.php');
AirtimeInstall::ExitIfNotRoot();

View file

@ -15,7 +15,7 @@ if (!file_exists(AirtimeIni::CONF_FILE_AIRTIME)) {
echo "Most likely this means that Airtime is not installed, so there is nothing to do.".PHP_EOL.PHP_EOL;
exit();
}
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/constants.php');
require_once(__DIR__.'/airtime-constants.php');
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
echo PHP_EOL;

View file

@ -10,7 +10,7 @@
set_include_path(__DIR__.'/../../airtime_mvc/library/pear' . PATH_SEPARATOR . get_include_path());
require_once('DB.php');
require_once(__DIR__.'/../../airtime_mvc/application/configs/constants.php');
require_once(__DIR__.'/airtime-constants.php');
require_once(dirname(__FILE__).'/AirtimeIni.php');
require_once(dirname(__FILE__).'/AirtimeInstall.php');