Use alternate, working test for relative ZM_DIR_EVENTS. Don't use human output from du when specifying mid to be consistent.

This commit is contained in:
Isaac Connor 2018-10-03 11:11:33 -04:00
parent 03f09bdc48
commit 12bed9b6ac
1 changed files with 6 additions and 4 deletions

View File

@ -110,14 +110,16 @@ class HostController extends AppController {
$zm_dir_events = ZM_DIR_EVENTS;
// Test to see if $zm_dir_events is relative or absolute
if ('/' === "" || strrpos($zm_dir_events, '/', -strlen($zm_dir_events)) !== TRUE) {
#if ('/' === "" || strrpos($zm_dir_events, '/', -strlen($zm_dir_events)) !== TRUE) {
if ( substr($zm_dir_events, 0, 1) != '/' ) {
// relative - so add the full path
$zm_dir_events = ZM_PATH_WEB . '/' . $zm_dir_events;
}
if ( $mid ) {
// Get disk usage for $mid
$usage = shell_exec("du -sh0 $zm_dir_events/$mid | awk '{print $1}'");
Logger::Debug("Executing du -s0 $zm_dir_events/$mid | awk '{print $1}'");
$usage = shell_exec("du -s0 $zm_dir_events/$mid | awk '{print $1}'");
} else {
$monitors = $this->Monitor->find('all', array(
'fields' => array('Id', 'Name', 'WebColour')