From d847d66e9923386c309e293d57167f68dbae0523 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 26 Apr 2016 14:40:40 -0400 Subject: [PATCH 1/2] handle disk_free_space error --- web/includes/functions.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index ed9850ca3..15db5511a 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -1676,7 +1676,12 @@ function getDiskPercent() Error("disk_total_space returned false for " . ZM_DIR_EVENTS ); return 0; } - $space = round(($total - disk_free_space(ZM_DIR_EVENTS)) / $total * 100); + $free = disk_free_space(ZM_DIR_EVENTS); + if ( ! $free ) { + Error("disk_free_space returned false for " . ZM_DIR_EVENTS ); + return 0; + } + $space = round(($total - $free) / $total * 100); return( $space ); } From 5e20831030c11656cd42489f12fe5d92d1fc14fa Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 28 Apr 2016 09:29:40 -0400 Subject: [PATCH 2/2] Don't return of disk_free_space returns false, just log it. --- web/includes/functions.php | 1 - 1 file changed, 1 deletion(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 15db5511a..9a8264548 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -1679,7 +1679,6 @@ function getDiskPercent() $free = disk_free_space(ZM_DIR_EVENTS); if ( ! $free ) { Error("disk_free_space returned false for " . ZM_DIR_EVENTS ); - return 0; } $space = round(($total - $free) / $total * 100); return( $space );