Example #1
0
            // No need to show
            //$success = "Restarted Export Job";
        }
    }
    if (isset($_GET['delete'])) {
        // We want to delete the job!
        $exportJob->delete();
        unset($_GET['id']);
        unset($exportJob);
        $success = "Removed Job";
    }
}
if (isset($_GET['request']) && $_GET['request'] == 'status') {
    // We're our AJAX client wanting status information
    $result = array();
    $exportJob = ExportJobPeer::retrieveByPK($_GET['id']);
    if (!$exportJob) {
        $result['error'] = "Invalid job specified.";
        print json_encode($result);
        exit;
    }
    // Okay, let's populate the status
    $result['start_time'] = $exportJob->getStartTime();
    $result['status_code'] = $exportJob->getStatusCode();
    $result['status_text'] = $exportJob->getStatus();
    $result['status_change_time'] = $exportJob->getStatusChangeTime();
    // Build elapsed time
    if (!in_array($exportJob->getStatusCode(), array(ExportJob::STATUS_FAILED, ExportJob::STATUS_FINISHED))) {
        $target = time();
    } else {
        $target = strtotime($result['status_change_time']);
Example #2
0
 * 42 - SUCCESS WHEN FORKING SCRIPT
 */
set_time_limit(0);
// Remove time limit
if (pcntl_fork()) {
    // Fork process
    exit(42);
    // This marks a successful fork, so we should return success to the caller
}
posix_setsid();
// Make child process session leader
// Okay, we're now in our own execution space.  Let's begin
// We need to restart Propel to regain access to the DB
Propel::init(LILAC_FS_ROOT . "includes/lilac-conf.php");
if (isset($argv[1]) && is_numeric($argv[1])) {
    $exportJob = ExportJobPeer::retrieveByPK($argv[1]);
    if (!$exportJob) {
        print "Job with id: " . $argv[1] . " not found.\n";
        exit(20);
    }
    $exportJob->clearLog();
    // Okay, let's get the ExportConfig
    $config = $exportJob->getConfig();
    $config = unserialize($config);
    $engineClass = $config->getEngineClass();
    if (!class_exists($engineClass) || !is_subclass_of($engineClass, "ExportEngine")) {
        $exportJob->addError("Export Engine of type " . $engineClass . " not found.");
        exit(30);
    }
} else {
    print "No job id provided.\n";