Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
38719b1a4e
|
@ -310,13 +310,9 @@ class ScheduleController extends Zend_Controller_Action
|
|||
return;
|
||||
}
|
||||
|
||||
$start = explode(" ", $start_timestamp);
|
||||
$end = explode(" ", $end_timestamp);
|
||||
$startTime = explode(":", $start[1]);
|
||||
$endTime = explode(":", $end[1]);
|
||||
$dateInfo_s = getDate(strtotime($start_timestamp));
|
||||
$dateInfo_e = getDate(strtotime($end_timestamp));
|
||||
|
||||
$dateInfo_s = getDate(strtotime(Application_Model_DateHelper::ConvertToLocalDateTimeString($start_timestamp)));
|
||||
$dateInfo_e = getDate(strtotime(Application_Model_DateHelper::ConvertToLocalDateTimeString($end_timestamp)));
|
||||
|
||||
$this->view->showContent = $show->getShowContent();
|
||||
$this->view->timeFilled = $show->getTimeScheduled();
|
||||
$this->view->showName = $show->getName();
|
||||
|
@ -329,8 +325,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->e_wday = $dateInfo_e['weekday'];
|
||||
$this->view->e_month = $dateInfo_e['month'];
|
||||
$this->view->e_day = $dateInfo_e['mday'];
|
||||
$this->view->startTime = sprintf("%d:%02d", $startTime[0], $startTime[1]);
|
||||
$this->view->endTime = sprintf("%d:%02d", $endTime[0], $endTime[1]);
|
||||
$this->view->startTime = sprintf("%02d:%02d", $dateInfo_s['hours'], $dateInfo_s['minutes']);
|
||||
$this->view->endTime = sprintf("%02d:%02d", $dateInfo_e['hours'], $dateInfo_e['minutes']);
|
||||
|
||||
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
|
||||
$this->view->dialog = $this->view->render('schedule/schedule-show-dialog.phtml');
|
||||
|
|
|
@ -7,7 +7,7 @@ class Application_Model_Preference
|
|||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
//called from a daemon process
|
||||
if(!Zend_Auth::getInstance()->hasIdentity()) {
|
||||
if(!class_exists("Zend_Auth", false) || !Zend_Auth::getInstance()->hasIdentity()) {
|
||||
$id = NULL;
|
||||
}
|
||||
else {
|
||||
|
@ -369,11 +369,16 @@ class Application_Model_Preference
|
|||
$outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Application_Model_Schedule::getSchduledPlaylistCount();
|
||||
$outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(date("Y-m-d H:i:s"));
|
||||
$outputArray['UNIQUE_ID'] = self::GetUniqueId();
|
||||
$outputArray['SAAS'] = self::GetPlanLevel();
|
||||
$outputArray['INSTALL_METHOD'] = self::GetInstallMethod();
|
||||
|
||||
$outputArray = array_merge($systemInfoArray, $outputArray);
|
||||
|
||||
$outputString = "\n";
|
||||
foreach($outputArray as $key => $out){
|
||||
if($key == 'SAAS' && ($out != '' || $out != 'disabled')){
|
||||
continue;
|
||||
}
|
||||
if($out != ''){
|
||||
$outputString .= $key.' : '.$out."\n";
|
||||
}
|
||||
|
@ -386,6 +391,20 @@ class Application_Model_Preference
|
|||
return $outputString;
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetInstallMethod(){
|
||||
$easy_install = file_exists('/usr/bin/airtime-easy-install');
|
||||
$debian_install = file_exists('/var/lib/dpkg/info/airtime.config');
|
||||
if($debian_install){
|
||||
if($easy_install){
|
||||
return "easy_install";
|
||||
}else{
|
||||
return "debian_install";
|
||||
}
|
||||
}else{
|
||||
return "manual_install";
|
||||
}
|
||||
}
|
||||
|
||||
public static function SetRemindMeDate($now){
|
||||
$weekAfter = mktime(0, 0, 0, date("m") , date("d")+7, date("Y"));
|
||||
|
@ -446,7 +465,11 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function GetPlanLevel(){
|
||||
return self::GetValue("plan_level");
|
||||
$plan = self::GetValue("plan_level");
|
||||
if(trim($plan) == ''){
|
||||
$plan = 'disabled';
|
||||
}
|
||||
return $plan;
|
||||
}
|
||||
|
||||
public static function SetTrialEndingDate($date){
|
||||
|
|
|
@ -274,7 +274,8 @@ class AirtimeProcessEvent(ProcessEvent):
|
|||
# check if file exist
|
||||
# When whole directory is copied to the organized dir,
|
||||
# inotify doesn't fire IN_CLOSE_WRITE, hench we need special way of
|
||||
# handling those cases.
|
||||
# handling those cases. We are manully calling handle_created_file
|
||||
# function.
|
||||
if os.path.exists(k):
|
||||
# check if file is open
|
||||
command = "lsof "+k
|
||||
|
|
|
@ -20,6 +20,7 @@ if (substr($sapi_type, 0, 3) == 'cli') {
|
|||
class AirtimeCheck {
|
||||
|
||||
private static $AIRTIME_STATUS_OK = true;
|
||||
CONST UNKNOWN = "UNKNOWN";
|
||||
|
||||
/**
|
||||
* Ensures that the user is running this PHP script with root
|
||||
|
@ -29,11 +30,29 @@ class AirtimeCheck {
|
|||
public static function ExitIfNotRoot()
|
||||
{
|
||||
// Need to check that we are superuser before running this.
|
||||
if(exec("whoami") != "root"){
|
||||
$user = exec("whoami");
|
||||
if($user != "root" && $user != "www-data"){
|
||||
echo "Must be root user.\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetCpuInfo()
|
||||
{
|
||||
$command = "cat /proc/cpuinfo |grep -m 1 'model name' ";
|
||||
exec($command, $output, $rv);
|
||||
|
||||
if ($rv != 0 || !isset($output[0]))
|
||||
return self::UNKNOWN;
|
||||
|
||||
$choppedStr = explode(":", $output[0]);
|
||||
|
||||
if (!isset($choppedStr[1]))
|
||||
return self::UNKNOWN;
|
||||
|
||||
$status = trim($choppedStr[1]);
|
||||
return $status;
|
||||
}
|
||||
|
||||
public static function GetAirtimeConf()
|
||||
{
|
||||
|
@ -46,6 +65,37 @@ class AirtimeCheck {
|
|||
|
||||
return $ini;
|
||||
}
|
||||
|
||||
public static function CheckOsTypeVersion(){
|
||||
|
||||
exec("lsb_release -ds", $output, $rv);
|
||||
if ($rv != 0 || !isset($output[0])){
|
||||
$os_string = self::UNKNOWN;
|
||||
} else {
|
||||
$os_string = $output[0];
|
||||
}
|
||||
|
||||
unset($output);
|
||||
|
||||
// Figure out if 32 or 64 bit
|
||||
exec("uname -m", $output, $rv);
|
||||
if ($rv != 0 || !isset($output[0])){
|
||||
$machine = self::UNKNOWN;
|
||||
} else {
|
||||
$machine = $output[0];
|
||||
}
|
||||
|
||||
return $os_string." ".$machine;
|
||||
}
|
||||
|
||||
public static function GetServerType(){
|
||||
$headerInfo = get_headers("http://localhost",1);
|
||||
|
||||
if (!isset($headerInfo['Server'][0]))
|
||||
return self::UNKNOWN;
|
||||
else
|
||||
return $headerInfo['Server'][0];
|
||||
}
|
||||
|
||||
public static function GetStatus($p_apiKey){
|
||||
|
||||
|
@ -82,6 +132,9 @@ class AirtimeCheck {
|
|||
self::output_status("TOTAL_MEMORY_MBYTES", $data->platform->memory);
|
||||
self::output_status("TOTAL_SWAP_MBYTES", $data->platform->swap);
|
||||
self::output_status("AIRTIME_VERSION", $data->airtime_version);
|
||||
self::output_status("OS", self::CheckOsTypeVersion());
|
||||
self::output_status("CPU", self::GetCpuInfo());
|
||||
self::output_status("WEB_SERVER", self::GetServerType());
|
||||
if ($data->services->pypo){
|
||||
self::output_status("PLAYOUT_ENGINE_PROCESS_ID", $data->services->pypo->process_id);
|
||||
self::output_status("PLAYOUT_ENGINE_RUNNING_SECONDS", $data->services->pypo->uptime_seconds);
|
||||
|
|
Loading…
Reference in New Issue