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:
parent
03f09bdc48
commit
12bed9b6ac
|
@ -101,8 +101,8 @@ class HostController extends AppController {
|
||||||
$this->loadModel('Monitor');
|
$this->loadModel('Monitor');
|
||||||
|
|
||||||
// If $mid is passed, see if it is valid
|
// If $mid is passed, see if it is valid
|
||||||
if ($mid) {
|
if ( $mid ) {
|
||||||
if (!$this->Monitor->exists($mid)) {
|
if ( !$this->Monitor->exists($mid) ) {
|
||||||
throw new NotFoundException(__('Invalid monitor'));
|
throw new NotFoundException(__('Invalid monitor'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,14 +110,16 @@ class HostController extends AppController {
|
||||||
$zm_dir_events = ZM_DIR_EVENTS;
|
$zm_dir_events = ZM_DIR_EVENTS;
|
||||||
|
|
||||||
// Test to see if $zm_dir_events is relative or absolute
|
// 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
|
// relative - so add the full path
|
||||||
$zm_dir_events = ZM_PATH_WEB . '/' . $zm_dir_events;
|
$zm_dir_events = ZM_PATH_WEB . '/' . $zm_dir_events;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $mid ) {
|
if ( $mid ) {
|
||||||
// Get disk usage for $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 {
|
} else {
|
||||||
$monitors = $this->Monitor->find('all', array(
|
$monitors = $this->Monitor->find('all', array(
|
||||||
'fields' => array('Id', 'Name', 'WebColour')
|
'fields' => array('Id', 'Name', 'WebColour')
|
||||||
|
|
Loading…
Reference in New Issue