public static function retrieveByPartnerIdAndHostName($partnerId, $hostName) { $c = new Criteria(); $c->add(EdgeServerPeer::PARTNER_ID, $partnerId); $c->add(EdgeServerPeer::HOST_NAME, $hostName); return EdgeServerPeer::doSelectOne($c); }
public function getPlaybackHost() { $playbackHostName = $this->getPlaybackHostName() . "/" . self::EDGE_SERVER_DEFAULT_LIVE_CACHE_APPLICATION_NAME . "/"; if ($this->parent_id) { $parentEdge = EdgeServerPeer::retrieveByPK($this->parent_id); if ($parentEdge) { $playbackHostName = $playbackHostName . $parentEdge->getPlaybackHost(); } } return $playbackHostName; }
public static function retrieveOrderedEdgeServersArrayByPKs($pks, PropelPDO $con = null) { if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(EdgeServerPeer::DATABASE_NAME); $criteria->add(EdgeServerPeer::ID, $pks, Criteria::IN); $criteria->add(EdgeServerPeer::STATUS, EdgeServerStatus::ACTIVE); $orderBy = "FIELD (" . self::ID . "," . implode(",", $pks) . ")"; // first take the pattner_id and then the rest $criteria->addAscendingOrderByColumn($orderBy); $objs = EdgeServerPeer::doSelect($criteria, $con); } return $objs; }
public function applyDeliveryProfileDynamicAttributes(DeliveryProfileDynamicAttributes $deliveryAttributes) { $edgeServerIds = explode(',', $this->getEdgeServerIds()); $deliveryAttributes->setEdgeServerIds($edgeServerIds); //Check if there are any edge server that override the delivery profiles $edgeServers = EdgeServerPeer::retrieveByPKs($edgeServerIds); if (!count($edgeServers)) { return false; } $edgeDeliveryProfilesIds = array(); foreach ($edgeServers as $edgeServer) { if (!$edgeServer->getDeliveryProfileIds()) { continue; } $edgeDeliveryProfilesIds = array_merge($edgeDeliveryProfilesIds, explode(",", $edgeServer->getDeliveryProfileIds())); } if (count($edgeDeliveryProfilesIds)) { $deliveryAttributes->setDeliveryProfileIds($edgeDeliveryProfilesIds, false); } return true; }
/** * 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(EdgeServerPeer::DATABASE_NAME); $criteria->add(EdgeServerPeer::ID, $this->id); if ($this->alreadyInSave) { if ($this->isColumnModified(EdgeServerPeer::CUSTOM_DATA)) { if (!is_null($this->custom_data_md5)) { $criteria->add(EdgeServerPeer::CUSTOM_DATA, "MD5(cast(" . EdgeServerPeer::CUSTOM_DATA . " as char character set latin1)) = '{$this->custom_data_md5}'", Criteria::CUSTOM); } else { $criteria->add(EdgeServerPeer::CUSTOM_DATA, NULL, Criteria::ISNULL); } } if (count($this->modifiedColumns) == 2 && $this->isColumnModified(EdgeServerPeer::UPDATED_AT)) { $theModifiedColumn = null; foreach ($this->modifiedColumns as $modifiedColumn) { if ($modifiedColumn != EdgeServerPeer::UPDATED_AT) { $theModifiedColumn = $modifiedColumn; } } $atomicColumns = EdgeServerPeer::getAtomicColumns(); if (in_array($theModifiedColumn, $atomicColumns)) { $criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL); } } } return $criteria; }
public function getEdgeServerUrls($url) { if (!$url) { return null; } $edgeServerIds = $this->params->getEdgeServerIds(); $edgeServers = EdgeServerPeer::retrieveOrderedEdgeServersArrayByPKs($edgeServerIds); if (!count($edgeServers)) { KalturaLog::info("No active edge servers found to handle [{$url}]"); return null; } $edgeServer = array_shift($edgeServers); $url = $edgeServer->buildEdgePlaybackUrl($url); if (count($edgeServers)) { $this->params->setEdgeServerIds(array_diff($edgeServerIds, array($edgeServer->getId()))); } return $url; }
/** * @action list * @param KalturaEdgeServerFilter $filter * @param KalturaFilterPager $pager * @return KalturaEdgeServerListResponse */ public function listAction(KalturaEdgeServerFilter $filter = null, KalturaFilterPager $pager = null) { $c = new Criteria(); if (!$filter) { $filter = new KalturaEdgeServerFilter(); } $edgeSeverFilter = new EdgeServerFilter(); $filter->toObject($edgeSeverFilter); $edgeSeverFilter->attachToCriteria($c); $list = EdgeServerPeer::doSelect($c); if (!$pager) { $pager = new KalturaFilterPager(); } $pager->attachToCriteria($c); $response = new KalturaEdgeServerListResponse(); $response->totalCount = EdgeServerPeer::doCount($c); $response->objects = KalturaEdgeServerArray::fromDbArray($list, $this->getResponseProfile()); return $response; }
public function getFieldNameFromPeer($field_name) { $res = EdgeServerPeer::translateFieldName($field_name, $this->field_name_translation_type, BasePeer::TYPE_COLNAME); return $res; }
public function validateSystemNameDuplication($edgeId = null) { $c = KalturaCriteria::create(EdgeServerPeer::OM_CLASS); if ($edgeId) { $c->add(EdgeServerPeer::ID, $sourceObject->getId(), Criteria::NOT_EQUAL); } $c->add(EdgeServerPeer::SYSTEM_NAME, $this->systemName); $c->add(EdgeServerPeer::STATUS, array(EdgeServerStatus::ACTIVE, EdgeServerStatus::DISABLED), Criteria::IN); if (EdgeServerPeer::doCount($c)) { throw new KalturaAPIException(KalturaErrors::SYSTEM_NAME_ALREADY_EXISTS, $this->systemName); } }
/** * 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(EdgeServerPeer::DATABASE_NAME); $criteria->add(EdgeServerPeer::ID, $pks, Criteria::IN); $objs = EdgeServerPeer::doSelect($criteria, $con); } return $objs; }