changed function to get nzb count - faster

This commit is contained in:
jonnyboy
2013-01-25 20:00:11 +01:00
parent 1908a41469
commit c4e261906d
+7 -8
View File
@@ -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__);