-various optimizations
This commit is contained in:
parent
b500e2f7cc
commit
c3430e5411
airtime_mvc
application
public/js/airtime/status
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__."/configs/ACL.php";
|
||||
|
||||
require_once 'propel/runtime/lib/Propel.php';
|
||||
Propel::init(__DIR__."/configs/airtime-conf-production.php");
|
||||
|
||||
require_once __DIR__."/logging/Logging.php";
|
||||
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
||||
|
||||
require_once __DIR__."/configs/constants.php";
|
||||
require_once __DIR__."/configs/conf.php";
|
||||
|
||||
require_once __DIR__."/configs/ACL.php";
|
||||
require_once 'propel/runtime/lib/Propel.php';
|
||||
Propel::init(__DIR__."/configs/airtime-conf-production.php");
|
||||
|
||||
require_once __DIR__."/configs/constants.php";
|
||||
require_once 'DB.php';
|
||||
|
||||
require_once 'Preference.php';
|
||||
|
|
|
@ -9,15 +9,12 @@
|
|||
*/
|
||||
|
||||
|
||||
$configFile = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||
$ini = parse_ini_file($configFile, true);
|
||||
|
||||
$dbhost = $ini['database']['host'];
|
||||
$dbname = $ini['database']['dbname'];
|
||||
$dbuser = $ini['database']['dbuser'];
|
||||
$dbpass = $ini['database']['dbpass'];
|
||||
|
||||
global $CC_CONFIG;
|
||||
|
||||
$dbhost = $CC_CONFIG['dsn']['hostspec'];
|
||||
$dbname = $CC_CONFIG['dsn']['database'];
|
||||
$dbuser = $CC_CONFIG['dsn']['username'];
|
||||
$dbpass = $CC_CONFIG['dsn']['password'];
|
||||
|
||||
$conf = array (
|
||||
'datasources' =>
|
||||
|
|
|
@ -744,6 +744,7 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$request = $this->getRequest();
|
||||
$api_key = $request->getParam('api_key');
|
||||
$getDiskInfo = $request->getParam('diskinfo') == "true";
|
||||
/*
|
||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
||||
{
|
||||
|
@ -762,10 +763,13 @@ class ApiController extends Zend_Controller_Action
|
|||
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
||||
"show_recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(),
|
||||
"media_monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus()
|
||||
),
|
||||
"partitions"=>Application_Model_Systemstatus::GetDiskInfo()
|
||||
)
|
||||
);
|
||||
|
||||
if ($getDiskInfo){
|
||||
$status["partitions"] = Application_Model_Systemstatus::GetDiskInfo();
|
||||
}
|
||||
|
||||
$this->view->status = $status;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ function generatePartitions(partitions){
|
|||
var totalSpace = partitions[i].totalSpace;
|
||||
var percUsed = sprintf("%01.1f", spaceUsed/totalSpace*100);
|
||||
|
||||
var spaceUsedGb = sprintf("%01.1f", spaceUsed/Math.pow(10, 9));
|
||||
var totalSpaceGb = sprintf("%01.1f", totalSpace/Math.pow(10, 9));
|
||||
var spaceUsedGb = sprintf("%01.1f", spaceUsed/Math.pow(2, 30));
|
||||
var totalSpaceGb = sprintf("%01.1f", totalSpace/Math.pow(2, 30));
|
||||
|
||||
var row = sprintf(rowTemplate, i+1, i, spaceUsedGb, totalSpaceGb, percUsed, percUsed);
|
||||
var tr = $(row);
|
||||
|
@ -51,16 +51,17 @@ function success(data, textStatus, jqXHR){
|
|||
$(children[3]).text(s.cpu_perc);
|
||||
$(children[4]).text(sprintf('%01.1fMB (%s)', parseInt(s.memory_kb)/1000, s.memory_perc));
|
||||
}
|
||||
|
||||
generatePartitions(data.status.partitions);
|
||||
if (data.status.partitions){
|
||||
generatePartitions(data.status.partitions);
|
||||
}
|
||||
}
|
||||
|
||||
function updateStatus(){
|
||||
$.getJSON( "api/status/format/json", null, success);
|
||||
function updateStatus(getDiskInfo){
|
||||
$.getJSON( "api/status/format/json/diskinfo/"+getDiskInfo, null, success);
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
updateStatus();
|
||||
setInterval(updateStatus, 5000);
|
||||
updateStatus(true);
|
||||
setInterval(function(){updateStatus(false);}, 5000);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue