From 8d07a4a08f79ff67a9e73f5dbbfd2452de7e2b91 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 25 Mar 2019 11:58:04 -0400 Subject: [PATCH] Log useful error messages when can't mkdir the monitor events dir or the symlink to it. symlink is a warning because the symlink is just a user aid --- web/includes/actions/monitor.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/web/includes/actions/monitor.php b/web/includes/actions/monitor.php index 3fd76020c..cfb89a892 100644 --- a/web/includes/actions/monitor.php +++ b/web/includes/actions/monitor.php @@ -86,10 +86,15 @@ if ( $action == 'monitor' ) { unlink($OldStorage->Path().'/'.$saferOldName); $NewStorage = new ZM\Storage($_REQUEST['newMonitor']['StorageId']); - if ( ! file_exists($NewStorage->Path().'/'.$mid) ) - mkdir($NewStorage->Path().'/'.$mid, 0755); + if ( !file_exists($NewStorage->Path().'/'.$mid) ) { + if ( !mkdir($NewStorage->Path().'/'.$mid, 0755) ) { + Error('Unable to mkdir ' . $NewStorage->Path().'/'.$mid); + } + } $saferNewName = basename($_REQUEST['newMonitor']['Name']); - symlink($mid, $NewStorage->Path().'/'.$saferNewName); + if ( !symlink($NewStorage->Path().'/'.$mid, $NewStorage->Path().'/'.$saferNewName) ) { + Warning('Unable to symlink ' . $NewStorage->Path().'/'.$mid . ' to ' . $NewStorage->Path().'/'.$saferNewName); + } } if ( isset($changes['Width']) || isset($changes['Height']) ) { $newW = $_REQUEST['newMonitor']['Width'];