Пример #1
0
 protected function internalFulfilled(kScope $scope)
 {
     $profileIds = array();
     foreach ($this->deliveryProfileIds as $profileId) {
         $profileIds[] = $profileId->getValue();
     }
     KalturaLog::debug("Delivery profile ids [" . print_r($profileIds, true) . "]");
     $requestOrigin = @$_SERVER['HTTP_X_FORWARDED_HOST'];
     if (!$requestOrigin) {
         $requestOrigin = @$_SERVER['HTTP_HOST'];
     }
     $deliveryProfiles = DeliveryProfilePeer::retrieveByPKs($profileIds);
     foreach ($deliveryProfiles as $deliveryProfile) {
         /**
          * @var DeliveryProfile $deliveryProfile
          */
         $recognizer = $deliveryProfile->getRecognizer();
         if ($recognizer && $recognizer->isRecognized($requestOrigin)) {
             return true;
         }
     }
     return false;
 }
Пример #2
0
 /**
  * This function returns the delivery object that matches a given storage profile and format
  * If one not found - returns null
  * @param DeliveryProfileDynamicAttributes $deliveryAttributes - containing requested storageId, entryId, format and media protocol
  * @return DeliveryProfile
  */
 public static function getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes $deliveryAttributes, FileSync $fileSync = null, asset $asset = null)
 {
     $storageId = $deliveryAttributes->getStorageId();
     $storageProfile = StorageProfilePeer::retrieveByPK($storageId);
     if (!$storageProfile) {
         KalturaLog::err('Couldn\'t retrieve storageId: ' . $storageId);
         return null;
     }
     $streamerType = $deliveryAttributes->getFormat();
     $deliveryIds = $storageProfile->getDeliveryProfileIds();
     if (!array_key_exists($streamerType, $deliveryIds)) {
         KalturaLog::err("Delivery ID can't be determined for storageId [{$storageId}] ( PartnerId [" . $storageProfile->getPartnerId() . "] ) and streamer type [ {$streamerType} ]");
         return null;
     }
     self::filterDeliveryProfilesArray($deliveryIds, $deliveryAttributes);
     $deliveries = DeliveryProfilePeer::retrieveByPKs($deliveryIds[$streamerType]);
     $delivery = self::selectByDeliveryAttributes($deliveries, $deliveryAttributes);
     if ($delivery) {
         KalturaLog::info("Delivery ID for storageId [{$storageId}] ( PartnerId [" . $storageProfile->getPartnerId() . "] ) and streamer type [{$streamerType}] is " . $delivery->getId());
         $delivery->setEntryId($deliveryAttributes->getEntryId());
         $delivery->setStorageId($storageId);
         $delivery->initDeliveryDynamicAttributes($fileSync, $asset);
     } else {
         KalturaLog::err("Delivery ID can't be determined for storageId [{$storageId}] ( PartnerId [" . $storageProfile->getPartnerId() . "] ) streamer type [{$streamerType}] and media protocol [" . $deliveryAttributes->getMediaProtocol() . "]");
     }
     return $delivery;
 }