From c4e261906defd2e24aa03023cac604ad7619cdfb Mon Sep 17 00:00:00 2001 From: jonnyboy Date: Fri, 25 Jan 2013 20:00:11 +0100 Subject: [PATCH] changed function to get nzb count - faster --- bin/monitor.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/monitor.php b/bin/monitor.php index 49dde1a53..e8db109a1 100755 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -64,19 +64,18 @@ $_DB_PASSWORD = escapeshellarg(getenv('DB_PASSWORD')); $_DB_NAME = getenv('DB_NAME'); function getFileCount($directory) { - $include = array('*.nzb','*.NZB'); + $include = "*.{nzb,NZB}"; $filecount=0; - foreach (glob($directory . "*",GLOB_ONLYDIR) as $subDir){ - $filecount += getFileCount($subDir . "/"); - } - foreach($include as $fileEnd){ - if (glob($directory . $fileEnd) != false) { - $filecount += count(glob($directory . $fileEnd)); - } + foreach (glob($directory . "*",GLOB_ONLYDIR|GLOB_MARK) as $subDir){ + $filecount += getFileCount($subDir); } + $filecount += count(glob($directory . $include,GLOB_BRACE)); return $filecount; } + + + $_nzbs_to_import_begin=getFileCount($array['NZBS']); $_current_path = dirname(__FILE__);