Commit 8582802c77a4ea77b483189a90a86d2e5406a262
1 parent
dba37e9f
KTS-3314
"Disk usage dashlet doesn't work on Mac OS X" Fixed. The -B parameter doesn't exist for df on the mac, changed it to use -k (kB) and multiply by 1024. Committed by: Megan Watson Reviewed by: Jonathan Byrne git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8410 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
11 additions
and
1 deletions
plugins/housekeeper/DiskUsageDashlet.inc.php
| @@ -104,7 +104,11 @@ class DiskUsageDashlet extends KTBaseDashlet | @@ -104,7 +104,11 @@ class DiskUsageDashlet extends KTBaseDashlet | ||
| 104 | } | 104 | } |
| 105 | else | 105 | else |
| 106 | { | 106 | { |
| 107 | - $result = shell_exec($cmd." -B 1 2>&1"); | 107 | + if(strtolower(PHP_OS) == 'darwin'){ |
| 108 | + $result = shell_exec($cmd." -k 2>&1"); | ||
| 109 | + }else{ | ||
| 110 | + $result = shell_exec($cmd." -B 1 2>&1"); | ||
| 111 | + } | ||
| 108 | } | 112 | } |
| 109 | 113 | ||
| 110 | if (strpos($result, 'cannot read table of mounted file systems') !== false) | 114 | if (strpos($result, 'cannot read table of mounted file systems') !== false) |
| @@ -127,6 +131,12 @@ class DiskUsageDashlet extends KTBaseDashlet | @@ -127,6 +131,12 @@ class DiskUsageDashlet extends KTBaseDashlet | ||
| 127 | 131 | ||
| 128 | if ($size === 0) continue; | 132 | if ($size === 0) continue; |
| 129 | 133 | ||
| 134 | + if(strtolower(PHP_OS) == 'darwin'){ | ||
| 135 | + $size = $size * 1024; | ||
| 136 | + $used = $used * 1024; | ||
| 137 | + $avail = $avail * 1024; | ||
| 138 | + } | ||
| 139 | + | ||
| 130 | $colour = ''; | 140 | $colour = ''; |
| 131 | if ($usedp >= 100 - $this->urgentPercent) | 141 | if ($usedp >= 100 - $this->urgentPercent) |
| 132 | { | 142 | { |