Пример #1
0
 /**
  * Get the associated ImportJob object
  *
  * @param      Connection Optional Connection object.
  * @return     ImportJob The associated ImportJob object.
  * @throws     PropelException
  */
 public function getImportJob($con = null)
 {
     // include the related Peer class
     include_once 'om/BaseImportJobPeer.php';
     if ($this->aImportJob === null && $this->job !== null) {
         $this->aImportJob = ImportJobPeer::retrieveByPK($this->job, $con);
         /* The following can be used instead of the line above to
         		   guarantee the related object contains a reference
         		   to this object, but this level of coupling
         		   may be undesirable in many circumstances.
         		   As it can lead to a db query with many results that may
         		   never be used.
         		   $obj = ImportJobPeer::retrieveByPK($this->job, $con);
         		   $obj->addImportJobs($this);
         		 */
     }
     return $this->aImportJob;
 }
Пример #2
0
        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");
// disable instance pooling.  Should reduce memory footprint required for this
// job.
Propel::disableInstancePooling();
// Load engines
ImportEngine::getAvailableEngines();
if (isset($argv[1]) && is_numeric($argv[1])) {
    $importJob = ImportJobPeer::retrieveByPK($argv[1]);
    if (!$importJob) {
        print "Job with id: " . $argv[1] . " not found.\n";
        exit(20);
    }
    $importJob->setStartTime(time());
    $importJob->clearLog();
    $importJob->save();
    // Okay, let's get the ImportConfig
    $config = $importJob->getConfig();
    $config = unserialize($config);
    $engineClass = $config->getEngineClass();
    if (!class_exists($engineClass) || !is_subclass_of($engineClass, "ImportEngine")) {
        $importJob->addError("Import Engine of type " . $engineClass . " not found.");
        $importJob->setStatus("Failed - Import Engine does not exist ({$engineClass})");
        $importJob->setStatusCode(ImportJob::STATUS_FAILED);
Пример #3
0
            // No need to show
            //$success = "Restarted Import Job";
        }
    }
    if (isset($_GET['delete'])) {
        // We want to delete the job!
        $importJob->delete();
        unset($_GET['id']);
        unset($importJob);
        $success = "Removed Job";
    }
}
if (isset($_GET['request']) && $_GET['request'] == 'status') {
    // We're our AJAX client wanting status information
    $result = array();
    $importJob = ImportJobPeer::retrieveByPK($_GET['id']);
    if (!$importJob) {
        $result['error'] = "Invalid job specified.";
        print json_encode($result);
        exit;
    }
    // Okay, let's populate the status
    $result['start_time'] = $importJob->getStartTime();
    $result['status_code'] = $importJob->getStatusCode();
    $result['status_text'] = $importJob->getStatus();
    $result['status_change_time'] = $importJob->getStatusChangeTime();
    // Build elapsed time
    if (!in_array($importJob->getStatusCode(), array(ImportJob::STATUS_FAILED, ImportJob::STATUS_FINISHED))) {
        $target = time();
    } else {
        $target = strtotime($result['status_change_time']);