Beispiel #1
0
function CronProcess($path, $maxAllowedAge)
{
    $file = $path . 'testinfo.ini';
    if (is_file($file)) {
        $testInfo = GetTestInfo($path);
        if ($testInfo) {
            if (array_key_exists('archived', $testInfo) && $testInfo['archived']) {
                $currentTime = time();
                $timestamp = filemtime($file);
                if ($maxAllowedAge < $currentTime - $timestamp) {
                    // Remove the expired test results from the
                    echo "{$path}: expired and deleted.\r\n";
                    delTree($path);
                }
            } else {
                $info = parse_ini_file($file, true);
                if (isset($info['test']['completeTime'])) {
                    // Deal with the pre-existing test results. Upload them into
                    // remote storage.
                    require_once 'storage/storage.inc';
                    $id = $info['test']['id'];
                    StoreResults($id);
                    // StoreResults always generates zipped testinfo.json. We
                    // delete the unzipped version if there is here.
                    if (is_file($path . 'testinfo.json')) {
                        unlink($path . 'testinfo.json');
                    }
                    echo "test {$id} is uploaded.\r\n";
                }
            }
        }
    } else {
        $paths = glob($path . '*', GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT);
        foreach ($paths as $path) {
            CronProcess($path, $maxAllowedAge);
        }
    }
}
Beispiel #2
0
        // update the similarity values for the raw results
        foreach ($url as $url_result) {
            if (isset($url_result['id']) && isset($url_result['sim'])) {
                foreach ($results as &$original_result) {
                    if (isset($original_result['id']) && $original_result['id'] == $url_result['id']) {
                        $original_result['sim'] = $url_result['sim'];
                        break;
                    }
                }
            }
        }
    }
}
// clear the progress text
echo "\r                                                                          \r";
StoreResults($results);
foreach ($counts as $label => $count) {
    echo "{$label}: {$count}\r\n";
}
function AllTestsComplete(&$url)
{
    $all_complete = true;
    foreach ($url as $result) {
        //if (!isset($result['result']) || (isset($result['resubmit']) && $result['resubmit'])) {
        if (!isset($result['result'])) {
            $all_complete = false;
            break;
        }
    }
    return $all_complete;
}