fix PHP 7.1 notices "non well formed numeric value" #52
This commit is contained in:
parent
f6dc271839
commit
725787bcf7
|
@ -14,7 +14,7 @@ else
|
||||||
|
|
||||||
$load = array_map(
|
$load = array_map(
|
||||||
function ($value, $cores) {
|
function ($value, $cores) {
|
||||||
$v = (int)($value * 100 / $cores);
|
$v = (int)((float)$value * 100 / $cores);
|
||||||
if ($v > 100)
|
if ($v > 100)
|
||||||
$v = 100;
|
$v = 100;
|
||||||
return $v;
|
return $v;
|
||||||
|
|
|
@ -17,6 +17,7 @@ if (!($total = shell_exec('grep MemTotal /proc/meminfo | awk \'{print $2}\'')))
|
||||||
{
|
{
|
||||||
$total = 0;
|
$total = 0;
|
||||||
}
|
}
|
||||||
|
$total = (int)$total;
|
||||||
|
|
||||||
// Used
|
// Used
|
||||||
$used = $total - $free;
|
$used = $total - $free;
|
||||||
|
|
|
@ -6,12 +6,14 @@ if (!($free = shell_exec('grep SwapFree /proc/meminfo | awk \'{print $2}\'')))
|
||||||
{
|
{
|
||||||
$free = 0;
|
$free = 0;
|
||||||
}
|
}
|
||||||
|
$free = (int)$free;
|
||||||
|
|
||||||
// Total
|
// Total
|
||||||
if (!($total = shell_exec('grep SwapTotal /proc/meminfo | awk \'{print $2}\'')))
|
if (!($total = shell_exec('grep SwapTotal /proc/meminfo | awk \'{print $2}\'')))
|
||||||
{
|
{
|
||||||
$total = 0;
|
$total = 0;
|
||||||
}
|
}
|
||||||
|
$total = (int)$total;
|
||||||
|
|
||||||
// Used
|
// Used
|
||||||
$used = $total - $free;
|
$used = $total - $free;
|
||||||
|
|
|
@ -35,7 +35,7 @@ if (!($totalSeconds = shell_exec('/usr/bin/cut -d. -f1 /proc/uptime')))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$uptime = Misc::getHumanTime($totalSeconds);
|
$uptime = Misc::getHumanTime((int)$totalSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last boot
|
// Last boot
|
||||||
|
|
Loading…
Reference in New Issue