Fixed memory datas on Arch #15

This commit is contained in:
ShevAbam 2015-02-05 18:29:16 +01:00
parent 3ed4c1d633
commit 086a1829e6
2 changed files with 11 additions and 6 deletions

View File

@ -245,7 +245,7 @@ $update = $Config->checkUpdate();
<table class="firstBold">
<tbody>
<tr>
<td class="w20p">Used</td>
<td class="w20p">Used %</td>
<td><div class="progressbar-wrap"><div class="progressbar" style="width: 0%;">0%</div></div></td>
</tr>
<tr>
@ -277,7 +277,7 @@ $update = $Config->checkUpdate();
<table class="firstBold">
<tbody>
<tr>
<td class="w20p">Used</td>
<td class="w20p">Used %</td>
<td><div class="progressbar-wrap"><div class="progressbar" style="width: 0%;">0%</div></div></td>
</tr>
<tr>

View File

@ -1,14 +1,19 @@
<?php
require 'Utils/Misc.class.php';
// Free
if (!($free = shell_exec('/usr/bin/free -to | grep Mem: | awk \'{print $4+$6+$7}\'')))
$free = 0;
if (shell_exec('cat /proc/meminfo'))
{
$free = 0;
$free = shell_exec('grep MemFree /proc/meminfo | awk \'{print $2}\'');
$buffers = shell_exec('grep Buffers /proc/meminfo | awk \'{print $2}\'');
$cached = shell_exec('grep Cached /proc/meminfo | awk \'{print $2}\'');
$free = (int)$free + (int)$buffers + (int)$cached;
}
// Total
if (!($total = shell_exec('/usr/bin/free -to | grep Mem: | awk \'{print $2}\'')))
if (!($total = shell_exec('grep MemTotal /proc/meminfo | awk \'{print $2}\'')))
{
$total = 0;
}