Beispiel #1
0
 /**
  * @action pingDatabase
  * @return bool Always true if database available and writeable
  */
 function pingDatabaseAction()
 {
     $hostname = infraRequestUtils::getHostname();
     $server = ApiServerPeer::retrieveByHostname($hostname);
     if (!$server) {
         $server = new ApiServer();
         $server->setHostname($hostname);
     }
     $server->setUpdatedAt(time());
     if (!$server->save()) {
         return false;
     }
     return true;
 }
Beispiel #2
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)
 {
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(ApiServerPeer::DATABASE_NAME);
         $criteria->add(ApiServerPeer::ID, $pks, Criteria::IN);
         $objs = ApiServerPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Beispiel #3
0
 /**
  * Builds a Criteria object containing the primary key for this object.
  *
  * Unlike buildCriteria() this method includes the primary key values regardless
  * of whether or not they have been modified.
  *
  * @return     Criteria The Criteria object containing value(s) for primary key(s).
  */
 public function buildPkeyCriteria()
 {
     $criteria = new Criteria(ApiServerPeer::DATABASE_NAME);
     $criteria->add(ApiServerPeer::ID, $this->id);
     if ($this->alreadyInSave && count($this->modifiedColumns) == 2 && $this->isColumnModified(ApiServerPeer::UPDATED_AT)) {
         $theModifiedColumn = null;
         foreach ($this->modifiedColumns as $modifiedColumn) {
             if ($modifiedColumn != ApiServerPeer::UPDATED_AT) {
                 $theModifiedColumn = $modifiedColumn;
             }
         }
         $atomicColumns = ApiServerPeer::getAtomicColumns();
         if (in_array($theModifiedColumn, $atomicColumns)) {
             $criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL);
         }
     }
     return $criteria;
 }
Beispiel #4
0
 /**
  * @param string $hostname
  * @param PropelPDO $con
  * @return ApiServer
  */
 public static function retrieveByHostname($hostname, PropelPDO $con = null)
 {
     $criteria = new Criteria(ApiServerPeer::DATABASE_NAME);
     $criteria->add(ApiServerPeer::HOSTNAME, $hostname);
     return ApiServerPeer::doSelectOne($criteria, $con);
 }