$zip->extractTo($extractPath); $zip->close(); } } } // compress the text data files if (isset($_FILES['file'])) { $f = scandir($testPath); foreach ($f as $textFile) { logMsg("Checking {$textFile}\n"); if (is_file("{$testPath}/{$textFile}")) { $parts = pathinfo($textFile); $ext = $parts['extension']; if (!strcasecmp($ext, 'txt') || !strcasecmp($ext, 'json') || !strcasecmp($ext, 'csv')) { if ($ini['sensitive'] && strpos($textFile, '_report')) { RemoveSensitiveHeaders("{$testPath}/{$textFile}"); } elseif (strpos($textFile, '_optimization')) { unlink("{$testPath}/{$textFile}"); } elseif (gz_compress("{$testPath}/{$textFile}")) { unlink("{$testPath}/{$textFile}"); } } } } } //CheckForSpam(); // make sure the test result is valid, otherwise re-run it if ($done && !$har && array_key_exists('job_file', $testInfo) && array_key_exists('max_retries', $testInfo) && $testInfo['max_retries'] > 1) { $testfile = null; $valid = true; $available_runs = 0;
function CompressTextFiles($testPath) { global $ini; $f = scandir($testPath); foreach ($f as $textFile) { if ($textFile != 'test.log') { logMsg("Checking {$textFile}\n"); if (is_file("{$testPath}/{$textFile}")) { $parts = pathinfo($textFile); $ext = $parts['extension']; if (!strcasecmp($ext, 'txt') || !strcasecmp($ext, 'json') || !strcasecmp($ext, 'log') || !strcasecmp($ext, 'csv')) { if (strpos($textFile, '_optimization')) { unlink("{$testPath}/{$textFile}"); } elseif (gz_compress("{$testPath}/{$textFile}")) { unlink("{$testPath}/{$textFile}"); } } if (isset($ini) && is_array($ini) && isset($ini['sensitive']) && $ini['sensitive'] && strpos($textFile, '_report')) { RemoveSensitiveHeaders($testPath . '/' . basename($textFile, '.gz')); } } } } }