Пример #1
0
 /**
  * Action for manually exporting an asset
  * @param string $assetId
  * @param int $storageProfileId
  * @throws KalturaErrors::INVALID_FLAVOR_ASSET_ID
  * @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
  * @throws KalturaErrors::INTERNAL_SERVERL_ERROR
  * @return KalturaFlavorAsset The exported asset
  */
 protected function exportAction($assetId, $storageProfileId)
 {
     $dbAsset = assetPeer::retrieveById($assetId);
     if (!$dbAsset) {
         throw new KalturaAPIException(KalturaErrors::INVALID_FLAVOR_ASSET_ID, $assetId);
     }
     $dbStorageProfile = StorageProfilePeer::retrieveByPK($storageProfileId);
     if (!$dbStorageProfile) {
         throw new KalturaAPIException(KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND, $storageProfileId);
     }
     $scope = $dbStorageProfile->getScope();
     $scope->setEntryId($dbAsset->getEntryId());
     if (!$dbStorageProfile->fulfillsRules($scope)) {
         throw new KalturaAPIException(KalturaErrors::STORAGE_PROFILE_RULES_NOT_FULFILLED, $storageProfileId);
     }
     $exported = kStorageExporter::exportFlavorAsset($dbAsset, $dbStorageProfile);
     if ($exported !== true) {
         //TODO: implement export errors
         throw new KalturaAPIException(KalturaErrors::INTERNAL_SERVERL_ERROR);
     }
     return $this->getAction($assetId);
 }