CC-4090: Make code style PSR compliant
-User.php -removed all trailing whitespace
This commit is contained in:
parent
3d243468a7
commit
ee3447f903
30 changed files with 1057 additions and 1037 deletions
|
@ -9,15 +9,15 @@ class Application_Model_Systemstatus
|
|||
$monit_password = $CC_CONFIG['monit_password'];
|
||||
|
||||
$url = "http://$p_ip:2812/_status?format=xml";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_USERPWD, "$monit_user:$monit_password");
|
||||
//wait a max of 3 seconds before aborting connection attempt
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
|
||||
$result = curl_exec($ch);
|
||||
|
||||
|
||||
$info = curl_getinfo($ch);
|
||||
curl_close($ch);
|
||||
|
||||
|
@ -32,7 +32,7 @@ class Application_Model_Systemstatus
|
|||
|
||||
return $docRoot;
|
||||
}
|
||||
|
||||
|
||||
public static function ExtractServiceInformation($p_docRoot, $p_serviceName){
|
||||
|
||||
$starting = array(
|
||||
|
@ -43,7 +43,7 @@ class Application_Model_Systemstatus
|
|||
"memory_perc"=>"0%",
|
||||
"memory_kb"=>"0",
|
||||
"cpu_perc"=>"0%");
|
||||
|
||||
|
||||
$notMonitored = array(
|
||||
"name"=>$p_serviceName,
|
||||
"process_id"=>"NOT MONITORED",
|
||||
|
@ -53,7 +53,7 @@ class Application_Model_Systemstatus
|
|||
"memory_kb"=>"0",
|
||||
"cpu_perc"=>"0%"
|
||||
);
|
||||
|
||||
|
||||
$notRunning = array(
|
||||
"name"=>$p_serviceName,
|
||||
"process_id"=>"FAILED",
|
||||
|
@ -65,7 +65,7 @@ class Application_Model_Systemstatus
|
|||
);
|
||||
$data = $notRunning;
|
||||
|
||||
|
||||
|
||||
if (!is_null($p_docRoot)){
|
||||
foreach ($p_docRoot->getElementsByTagName("service") AS $item)
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ class Application_Model_Systemstatus
|
|||
if ($process_id->length > 0){
|
||||
$data["name"] = $process_id->item(0)->nodeValue;
|
||||
}
|
||||
|
||||
|
||||
$process_id = $item->getElementsByTagName("pid");
|
||||
if ($process_id->length > 0){
|
||||
$data["process_id"] = $process_id->item(0)->nodeValue;
|
||||
|
@ -104,13 +104,13 @@ class Application_Model_Systemstatus
|
|||
if ($uptime->length > 0){
|
||||
$data["uptime_seconds"] = $uptime->item(0)->nodeValue;
|
||||
}
|
||||
|
||||
|
||||
$memory = $item->getElementsByTagName("memory");
|
||||
if ($memory->length > 0){
|
||||
$data["memory_perc"] = $memory->item(0)->getElementsByTagName("percenttotal")->item(0)->nodeValue."%";
|
||||
$data["memory_kb"] = $memory->item(0)->getElementsByTagName("kilobytetotal")->item(0)->nodeValue;
|
||||
}
|
||||
|
||||
|
||||
$cpu = $item->getElementsByTagName("cpu");
|
||||
if ($cpu->length > 0){
|
||||
$data["cpu_perc"] = $cpu->item(0)->getElementsByTagName("percent")->item(0)->nodeValue."%";
|
||||
|
@ -127,7 +127,7 @@ class Application_Model_Systemstatus
|
|||
foreach($keys as $key) {
|
||||
$data[$key] = "UNKNOWN";
|
||||
}
|
||||
|
||||
|
||||
$docRoot = self::GetMonitStatus("localhost");
|
||||
if (!is_null($docRoot)){
|
||||
foreach ($docRoot->getElementsByTagName("platform") AS $item)
|
||||
|
@ -140,7 +140,7 @@ class Application_Model_Systemstatus
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
@ -151,14 +151,14 @@ class Application_Model_Systemstatus
|
|||
return null;
|
||||
} else {
|
||||
$ip = $component->getDbIp();
|
||||
|
||||
|
||||
$docRoot = self::GetMonitStatus($ip);
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-playout");
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function GetLiquidsoapStatus(){
|
||||
|
||||
$component = CcServiceRegisterQuery::create()->findOneByDbName("pypo");
|
||||
|
@ -166,14 +166,14 @@ class Application_Model_Systemstatus
|
|||
return null;
|
||||
} else {
|
||||
$ip = $component->getDbIp();
|
||||
|
||||
|
||||
$docRoot = self::GetMonitStatus($ip);
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-liquidsoap");
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function GetMediaMonitorStatus(){
|
||||
|
||||
$component = CcServiceRegisterQuery::create()->findOneByDbName("media-monitor");
|
||||
|
@ -181,15 +181,15 @@ class Application_Model_Systemstatus
|
|||
return null;
|
||||
} else {
|
||||
$ip = $component->getDbIp();
|
||||
|
||||
|
||||
$docRoot = self::GetMonitStatus($ip);
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-media-monitor");
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetIcecastStatus(){
|
||||
|
||||
public static function GetIcecastStatus(){
|
||||
$docRoot = self::GetMonitStatus("localhost");
|
||||
$data = self::ExtractServiceInformation($docRoot, "icecast2");
|
||||
|
||||
|
@ -197,7 +197,7 @@ class Application_Model_Systemstatus
|
|||
}
|
||||
|
||||
public static function GetRabbitMqStatus(){
|
||||
|
||||
|
||||
if (isset($_SERVER["RABBITMQ_HOST"])){
|
||||
$rabbitmq_host = $_SERVER["RABBITMQ_HOST"];
|
||||
} else {
|
||||
|
@ -208,18 +208,18 @@ class Application_Model_Systemstatus
|
|||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public static function GetDiskInfo(){
|
||||
$partions = array();
|
||||
|
||||
|
||||
if (isset($_SERVER['AIRTIME_SRV'])){
|
||||
//connect to DB and find how much total space user has allocated.
|
||||
$totalSpace = Application_Model_Preference::GetDiskQuota();
|
||||
|
||||
|
||||
$storPath = Application_Model_MusicDir::getStorDir()->getDirectory();
|
||||
|
||||
|
||||
list($usedSpace,) = preg_split("/[\s]+/", exec("du -bs $storPath"));
|
||||
|
||||
|
||||
$partitions[$totalSpace]->totalSpace = $totalSpace;
|
||||
$partitions[$totalSpace]->totalFreeSpace = $totalSpace - $usedSpace;
|
||||
Logging::log($partitions[$totalSpace]->totalFreeSpace);
|
||||
|
@ -228,7 +228,7 @@ class Application_Model_Systemstatus
|
|||
* into the same partitions by comparing the partition sizes. */
|
||||
$musicDirs = Application_Model_MusicDir::getWatchedDirs();
|
||||
$musicDirs[] = Application_Model_MusicDir::getStorDir();
|
||||
|
||||
|
||||
foreach($musicDirs as $md){
|
||||
$totalSpace = disk_total_space($md->getDirectory());
|
||||
|
||||
|
@ -238,7 +238,7 @@ class Application_Model_Systemstatus
|
|||
$partitions[$totalSpace]->totalFreeSpace = disk_free_space($md->getDirectory());
|
||||
|
||||
}
|
||||
|
||||
|
||||
$partitions[$totalSpace]->dirs[] = $md->getDirectory();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue