Ejemplo n.º 1
0
/**
* Recursively compress the text files in the given directory and all directories under it
*     
* @param mixed $dir
*/
function CheckDir($dir, $startWith = '')
{
    $started = false;
    if (!strlen($startWith)) {
        $started = true;
    }
    // compress the text data files
    $f = scandir($dir);
    foreach ($f as $file) {
        if (!$started && $file == $startWith) {
            $started = true;
        }
        if ($started) {
            if (gz_is_file("{$dir}/{$file}/testinfo.json")) {
                CheckTest("{$dir}/{$file}");
            } elseif (is_dir("{$dir}/{$file}") && $file != '.' && $file != '..') {
                CheckDir("{$dir}/{$file}");
            }
        }
    }
}
Ejemplo n.º 2
0
/**
* Recursively check within a given day
* 
* @param mixed $dir
* @param mixed $baseID
* @param mixed $archived
*/
function CheckDay($dir, $baseID, $elapsedDays)
{
    if (is_dir($dir)) {
        $tests = scandir($dir);
        if (isset($tests) && is_array($tests) && count($tests)) {
            foreach ($tests as $test) {
                if ($test != '.' && $test != '..') {
                    // see if it is a test or a higher-level directory
                    if (is_file("{$dir}/{$test}/testinfo.ini") || is_file("{$dir}/{$test}/testinfo.json.gz") || is_file("{$dir}/{$test}/testinfo.json") || is_dir("{$dir}/{$test}/video_1")) {
                        CheckTest("{$dir}/{$test}", "{$baseID}_{$test}", $elapsedDays);
                    } else {
                        // check for bogus stray test directories
                        CheckDay("{$dir}/{$test}", "{$baseID}_{$test}", $elapsedDays);
                    }
                }
            }
        }
        @rmdir($dir);
    }
}
Ejemplo n.º 3
0
/**
* Recursively check within a given day
* 
* @param mixed $dir
* @param mixed $baseID
* @param mixed $archived
*/
function CheckDay($dir, $baseID, $elapsedDays)
{
    $tests = scandir($dir);
    foreach ($tests as $test) {
        if ($test != '.' && $test != '..') {
            // see if it is a test or a higher-level directory
            if (is_file("{$dir}/{$test}/testinfo.ini") || is_file("{$dir}/{$test}/testinfo.json.gz") || is_file("{$dir}/{$test}/testinfo.json")) {
                CheckTest("{$dir}/{$test}", "{$baseID}_{$test}", $elapsedDays);
            } else {
                CheckDay("{$dir}/{$test}", "{$baseID}_{$test}", $elapsedDays);
            }
        }
    }
    @rmdir($dir);
}