From 63539fa16a31f790de4f7055340e0ee89f4f249f Mon Sep 17 00:00:00 2001 From: Justin Theberge Date: Wed, 6 Apr 2016 09:48:50 -0400 Subject: [PATCH] fix linecount --- data.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/data.php b/data.php index 0b8d2bbb..f0dc7dac 100644 --- a/data.php +++ b/data.php @@ -156,12 +156,9 @@ $file="/etc/pihole/gravity.list"; $linecount = 0; $handle = fopen($file, "r"); - if(gettype($handle) == "resource") { - while(!feof($handle)){ - $line = fgets($handle); - $linecount++; - } - } + while ($chunk = fread($handle, 1024000)) { + $linecount += substr_count($chunk, "\n"); + } fclose($handle); return $linecount;