示例#1
0
 protected function getRemotePaths($entryId, $entryType = null)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry || $entryType !== null && $dbEntry->getType() != $entryType) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     if ($dbEntry->getStatus() != entryStatus::READY) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_NOT_READY, $entryId);
     }
     $c = new Criteria();
     $c->add(FileSyncPeer::OBJECT_TYPE, FileSyncObjectType::ENTRY);
     $c->add(FileSyncPeer::OBJECT_SUB_TYPE, entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
     $c->add(FileSyncPeer::OBJECT_ID, $entryId);
     $c->add(FileSyncPeer::VERSION, $dbEntry->getVersion());
     $c->add(FileSyncPeer::PARTNER_ID, $dbEntry->getPartnerId());
     $c->add(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY);
     $c->add(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_URL);
     $fileSyncs = FileSyncPeer::doSelect($c);
     $listResponse = new KalturaRemotePathListResponse();
     $listResponse->objects = KalturaRemotePathArray::fromDbArray($fileSyncs, $this->getResponseProfile());
     $listResponse->totalCount = count($listResponse->objects);
     return $listResponse;
 }
 /**
  * Get remote storage existing paths for the asset
  * 
  * @action getRemotePaths
  * @param string $id
  * @return KalturaRemotePathListResponse
  * @throws KalturaAttachmentErrors::ATTACHMENT_ASSET_ID_NOT_FOUND
  * @throws KalturaAttachmentErrors::ATTACHMENT_ASSET_IS_NOT_READY
  */
 public function getRemotePathsAction($id)
 {
     $assetDb = assetPeer::retrieveById($id);
     if (!$assetDb || !$assetDb instanceof AttachmentAsset) {
         throw new KalturaAPIException(KalturaAttachmentErrors::ATTACHMENT_ASSET_ID_NOT_FOUND, $id);
     }
     if ($assetDb->getStatus() != asset::ASSET_STATUS_READY) {
         throw new KalturaAPIException(KalturaAttachmentErrors::ATTACHMENT_ASSET_IS_NOT_READY);
     }
     $c = new Criteria();
     $c->add(FileSyncPeer::OBJECT_TYPE, FileSyncObjectType::ASSET);
     $c->add(FileSyncPeer::OBJECT_SUB_TYPE, asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     $c->add(FileSyncPeer::OBJECT_ID, $id);
     $c->add(FileSyncPeer::VERSION, $assetDb->getVersion());
     $c->add(FileSyncPeer::PARTNER_ID, $assetDb->getPartnerId());
     $c->add(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY);
     $c->add(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_URL);
     $fileSyncs = FileSyncPeer::doSelect($c);
     $listResponse = new KalturaRemotePathListResponse();
     $listResponse->objects = KalturaRemotePathArray::fromFileSyncArray($fileSyncs);
     $listResponse->totalCount = count($listResponse->objects);
     return $listResponse;
 }
 /**
  * Get remote storage existing paths for the asset
  * 
  * @action getRemotePaths
  * @param string $id
  * @return KalturaRemotePathListResponse
  * @throws KalturaErrors::THUMB_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::THUMB_ASSET_IS_NOT_READY
  */
 public function getRemotePathsAction($id)
 {
     $assetDb = assetPeer::retrieveById($id);
     if (!$assetDb || !$assetDb instanceof thumbAsset) {
         throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_ID_NOT_FOUND, $id);
     }
     if (kEntitlementUtils::getEntitlementEnforcement()) {
         $entry = entryPeer::retrieveByPK($assetDb->getEntryId());
         if (!$entry) {
             //we will throw thumb asset not found, as the user is not entitled, and should not know that the entry exists.
             throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_ID_NOT_FOUND, $id);
         }
     }
     if ($assetDb->getStatus() != asset::ASSET_STATUS_READY) {
         throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_IS_NOT_READY);
     }
     $c = new Criteria();
     $c->add(FileSyncPeer::OBJECT_TYPE, FileSyncObjectType::ASSET);
     $c->add(FileSyncPeer::OBJECT_SUB_TYPE, asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     $c->add(FileSyncPeer::OBJECT_ID, $id);
     $c->add(FileSyncPeer::VERSION, $assetDb->getVersion());
     $c->add(FileSyncPeer::PARTNER_ID, $assetDb->getPartnerId());
     $c->add(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY);
     $c->add(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_URL);
     $fileSyncs = FileSyncPeer::doSelect($c);
     $listResponse = new KalturaRemotePathListResponse();
     $listResponse->objects = KalturaRemotePathArray::fromFileSyncArray($fileSyncs);
     $listResponse->totalCount = count($listResponse->objects);
     return $listResponse;
 }