public function applyDeliveryProfileDynamicAttributes(DeliveryProfileDynamicAttributes $deliveryAttributes)
 {
     $edgeServerIds = explode(',', $this->getEdgeServerIds());
     $edgeServers = ServerNodePeer::retrieveOrderedServerNodesArrayByPKs($edgeServerIds);
     if (!count($edgeServers)) {
         return false;
     }
     foreach ($edgeServers as $edgeServer) {
         $activeEdgeServerIds[] = $edgeServer->getId();
     }
     $deliveryAttributes->setEdgeServerIds($activeEdgeServerIds);
     return true;
 }
Example #2
0
 public function getDeliveryServerNodeUrl($removeAfterUse = false)
 {
     $deliveryUrl = null;
     $deliveryNodeIds = $this->params->getEdgeServerIds();
     $deliveryNodes = ServerNodePeer::retrieveOrderedServerNodesArrayByPKs($deliveryNodeIds);
     if (!count($deliveryNodes)) {
         KalturaLog::debug("No active delivery nodes found among the requested edge list: " . print_r($deliveryNodeIds, true));
         return null;
     }
     /* @var $deliveryNode EdgeServerNode */
     $deliveryNode = array_shift($deliveryNodes);
     $deliveryUrl = $deliveryNode->getPlaybackHost($this->params->getMediaProtocol(), $this->params->getFormat(), $this->getType());
     if (count($deliveryNodes) && $removeAfterUse) {
         $this->params->setEdgeServerIds(array_diff($deliveryNodeIds, array($deliveryNode->getId())));
     }
     return $deliveryUrl;
 }