Beispiel #1
0
$now = time();
/**
* Loop through all of the test directories checking on the status of the
* individual tests and marking directories that are ready for further
* processing.
*/
archive_scan_dirs(function ($info) {
    global $now, $bucket_base, $download_path;
    $dir = $info['dir'];
    $id = $info['id'];
    $dir_lock = Lock("archive-{$id}", false, 86400);
    if (isset($dir_lock)) {
        if (is_file("{$dir}/testing.complete") && is_file("{$dir}/har.complete")) {
            $suffix = '';
            // Re-archive anything that was archived > 30 days ago but still hasn't shown up as a valid archive
            if (is_file("{$dir}/archive.dat") && !ArchiveExists("{$dir}/archive.dat")) {
                $modified = filemtime("{$dir}/archive.dat");
                if ($modified > 0 && $modified < $now && $now - $modified > 2592000) {
                    $suffix = '_' . date('ymd');
                    unlink("{$dir}/archive.dat");
                }
            }
            $archiveDir = "{$dir}/archive";
            if (is_dir($archiveDir)) {
                delTree($archiveDir);
            }
            if (!is_file("{$dir}/archive.dat")) {
                $children = array();
                $files = scandir($dir);
                if ($files !== FALSE) {
                    foreach ($files as $file) {
Beispiel #2
0
    }
    // See if all of the individual processing steps are done.  If so, mark mrocessing as complete.
    echo "Checking {$dir}\n";
    if (is_file("{$dir}/testing.complete") && is_file("{$dir}/har.complete") && is_file("{$dir}/archive.dat") && ArchiveExists("{$dir}/archive.dat")) {
        MarkDone($dir);
    } else {
        if (!is_file("{$dir}/testing.complete")) {
            echo "  Missing {$dir}/testing.complete\n";
        }
        if (!is_file("{$dir}/har.complete")) {
            echo "  Missing {$dir}/har.complete\n";
        }
        if (!is_file("{$dir}/archive.dat")) {
            echo "  Missing {$dir}/archive.dat\n";
        } else {
            if (!ArchiveExists("{$dir}/archive.dat")) {
                echo "  Archive not valid\n";
            }
        }
    }
});
/**
* Update the state of the current crawl
* 
*/
function UpdateCrawlState()
{
    $ret = false;
    global $gMysqlServer;
    global $gMysqlDb;
    global $gMysqlUsername;