Example #1
0
 /**
  * Selects a collection of ImportLogEntry objects pre-filled with all related objects.
  *
  * @param      Criteria  $c
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of ImportLogEntry objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     ImportLogEntryPeer::addSelectColumns($c);
     $startcol2 = ImportLogEntryPeer::NUM_COLUMNS - ImportLogEntryPeer::NUM_LAZY_LOAD_COLUMNS;
     ImportJobPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (ImportJobPeer::NUM_COLUMNS - ImportJobPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(ImportLogEntryPeer::JOB), array(ImportJobPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = ImportLogEntryPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = ImportLogEntryPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $omClass = ImportLogEntryPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             ImportLogEntryPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined ImportJob rows
         $key2 = ImportJobPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = ImportJobPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = ImportJobPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 ImportJobPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (ImportLogEntry) to the collection in $obj2 (ImportJob)
             $obj2->addImportLogEntry($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Example #2
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;
 }
Example #3
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);
Example #4
0
}

}
</style>
<?php 
if (isset($status_msg)) {
    ?>
	<div align="center" class="statusmsg"><?php 
    echo $status_msg;
    ?>
</div><br />
	<?php 
}
if (!isset($importJob)) {
    $c = new Criteria();
    $importJobs = ImportJobPeer::doSelect($c);
    if ($importJobs) {
        print_window_header("Defined Import Jobs", "100%");
        ?>
		There appears to be existing import jobs.  There should only be one running.  If there are multiple showing as running, you should cancel them or purge them.  Click on a job to 
		view it's progress and it's log.
		<table class="jobs">
		<tr>
			<td><strong>Name</strong></td>
			<td><strong>Description</strong></td>
			<td><strong>Start Time</strong></td>
			<td><strong>Status</strong></td>
			<td colspan="2"><strong>Actions</strong></td>
		</tr>
		<?php 
        foreach ($importJobs as $job) {
Example #5
0
 /**
  * Selects a collection of ImportError objects pre-filled with all related objects.
  *
  * @return     array Array of ImportError objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $c, $con = null)
 {
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     ImportErrorPeer::addSelectColumns($c);
     $startcol2 = ImportErrorPeer::NUM_COLUMNS - ImportErrorPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     ImportJobPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + ImportJobPeer::NUM_COLUMNS;
     $c->addJoin(ImportErrorPeer::JOB, ImportJobPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = ImportErrorPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         // Add objects for joined ImportJob rows
         $omClass = ImportJobPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getImportJob();
             // CHECKME
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addImportError($obj1);
                 // CHECKME
                 break;
             }
         }
         if ($newObject) {
             $obj2->initImportErrors();
             $obj2->addImportError($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Example #6
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ImportJobPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setName($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setDescription($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setConfig($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setStartTime($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setEndTime($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setStatus($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setStatusCode($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setStatusChangeTime($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setStats($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setCmd($arr[$keys[10]]);
     }
 }
Example #7
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(ImportJobPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(ImportJobPeer::DATABASE_NAME);
         $criteria->add(ImportJobPeer::ID, $pks, Criteria::IN);
         $objs = ImportJobPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #8
0
 /**
  * Get the associated ImportJob object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     ImportJob The associated ImportJob object.
  * @throws     PropelException
  */
 public function getImportJob(PropelPDO $con = null)
 {
     if ($this->aImportJob === null && $this->job !== null) {
         $c = new Criteria(ImportJobPeer::DATABASE_NAME);
         $c->add(ImportJobPeer::ID, $this->job);
         $this->aImportJob = ImportJobPeer::doSelectOne($c, $con);
         /* The following can be used additionally to
         		   guarantee the related object contains a reference
         		   to this object.  This level of coupling may, however, be
         		   undesirable since it could result in an only partially populated collection
         		   in the referenced object.
         		   $this->aImportJob->addImportLogEntrys($this);
         		 */
     }
     return $this->aImportJob;
 }