예제 #1
0
//
register_shutdown_function('ProcessSubmissionsErrorHandler', $projectid, $pid);
echo "projectid='{$projectid}'\n";
echo "pid='{$pid}'\n";
echo "force='{$force}'\n";
if ($multi) {
    // multi processing, so lock was acquired in do_submit.php
    $lockAcquired = true;
} else {
    $lockAcquired = AcquireProcessingLock($projectid, $force, $pid);
}
if ($lockAcquired) {
    echo "AcquireProcessingLock returned true\n";
    ResetApparentlyStalledSubmissions($projectid);
    echo "Done with ResetApparentlyStalledSubmissions\n";
    ProcessSubmissions($projectid, $pid, $multi);
    echo "Done with ProcessSubmissions\n";
    DeleteOldSubmissionRecords($projectid);
    echo "Done with DeleteOldSubmissionRecords\n";
    if (ReleaseProcessingLock($projectid, $pid, $multi)) {
        echo "ReleasedProcessingLock returned true\n";
    } else {
        echo "ReleasedProcessingLock returned false\n";
    }
} else {
    echo "AcquireProcessingLock returned false\n";
    echo "Another process is already processing or there was a locking error\n";
}
echo "end processSubmissions.php\n";
echo '</pre>';
ob_end_flush();
예제 #2
0
function ProcessSubmissionsErrorHandler($projectid)
{
    $needs_clean_up = false;
    if ($error = error_get_last()) {
        switch ($error['type']) {
            case E_ERROR:
            case E_CORE_ERROR:
            case E_COMPILE_ERROR:
            case E_USER_ERROR:
                $needs_clean_up = true;
                break;
        }
    }
    if ($needs_clean_up) {
        // Mark the current submission, if any, as 'failed with error'
        //
        global $PHP_ERROR_SUBMISSION_ID;
        if (0 != $PHP_ERROR_SUBMISSION_ID) {
            $now_utc = gmdate(FMT_DATETIMESTD);
            pdo_query("UPDATE submission SET status=4, finished='{$now_utc}', " . "lastupdated='{$now_utc}' WHERE id='" . $PHP_ERROR_SUBMISSION_ID . "'");
            add_last_sql_error("ProcessSubmissionsErrorHandler-1");
            echo "ProcessSubmissionsErrorHandler: error processing submission id {$PHP_ERROR_SUBMISSION_ID}\n";
            add_log("error processing submission id {$PHP_ERROR_SUBMISSION_ID}", 'ProcessSubmissionsErrorHandler', LOG_ERR, $projectid);
        }
        // Call ReleaseProcessingLock since an error occurred before the expected
        // call to it at the bottom of the script:
        //
        if (ReleaseProcessingLock($projectid)) {
            echo "ProcessSubmissionsErrorHandler: ReleasedProcessingLock({$projectid}) returned true\n";
        } else {
            echo "ProcessSubmissionsErrorHandler: ReleasedProcessingLock({$projectid}) returned false\n";
        }
    }
    // Call the main CDash error handler for its default logging behavior:
    //
    PHPErrorHandler($projectid);
}