From 096bc06d65783c6230d596987744a4e49dc7b2a9 Mon Sep 17 00:00:00 2001 From: Justin Theberge Date: Tue, 5 Apr 2016 08:59:03 -0400 Subject: [PATCH] Fix for high CPU usage caused by "PHP Warning" flooding the journal. PHP Warning: fgets() expects parameter 1 to be resource, boolean was given --- data.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data.php b/data.php index c1c24440..0b8d2bbb 100644 --- a/data.php +++ b/data.php @@ -156,11 +156,12 @@ $file="/etc/pihole/gravity.list"; $linecount = 0; $handle = fopen($file, "r"); - while(!feof($handle)){ + if(gettype($handle) == "resource") { + while(!feof($handle)){ $line = fgets($handle); $linecount++; + } } - fclose($handle); return $linecount;