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__);