本文整理汇总了PHP中kFileSyncUtils类的典型用法代码示例。如果您正苦于以下问题:PHP kFileSyncUtils类的具体用法?PHP kFileSyncUtils怎么用?PHP kFileSyncUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了kFileSyncUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLocalThumbFilePath
public function getLocalThumbFilePath($version, $width, $height, $type, $bgcolor = "ffffff", $crop_provider = null, $quality = 0, $src_x = 0, $src_y = 0, $src_w = 0, $src_h = 0, $vid_sec = -1, $vid_slice = 0, $vid_slices = -1, $density = 0, $stripProfiles = false, $flavorId = null, $fileName = null)
{
if ($this->getStatus() == entryStatus::DELETED || $this->getModerationStatus() == moderation::MODERATION_STATUS_BLOCK) {
KalturaLog::log("rejected live stream entry - not serving thumbnail");
KExternalErrors::dieError(KExternalErrors::ENTRY_DELETED_MODERATED);
}
$contentPath = myContentStorage::getFSContentRootPath();
$liveEntryExist = false;
$liveThumbEntry = null;
$liveThumbEntryId = null;
$partner = $this->getPartner();
if ($partner) {
$liveThumbEntryId = $partner->getLiveThumbEntryId();
}
if ($liveThumbEntryId) {
$liveThumbEntry = entryPeer::retrieveByPK($liveThumbEntryId);
}
if ($liveThumbEntry && $liveThumbEntry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
$fileSyncVersion = $partner->getLiveThumbEntryVersion();
$liveEntryKey = $liveThumbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $fileSyncVersion);
$contentPath = kFileSyncUtils::getLocalFilePathForKey($liveEntryKey);
if ($contentPath) {
$msgPath = $contentPath;
$liveEntryExist = true;
} else {
KalturaLog::err('no local file sync for audio entry id');
}
}
if (!$liveEntryExist) {
$msgPath = $contentPath . "content/templates/entry/thumbnail/live_thumb.jpg";
}
return myEntryUtils::resizeEntryImage($this, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices, $msgPath, $density, $stripProfiles);
}
示例2: addEcSeek
private function addEcSeek($url, $syncKey)
{
$seekTime = $this->params->getSeekFromTime();
if (!empty($seekTime)) {
// remove default seekFrom parameter
$url = preg_replace('/seekFrom\\/-?[0-9]*\\/?/', '', $url);
$url = rtrim($url, '/');
// check if seekFromTime is set to something significant
if ($seekTime > 0) {
// check if flv or not
$extension = $this->params->getFileExtension();
$containerFormat = $this->params->getContainerFormat();
$notFlvFormat = $extension && strtolower($extension) != 'flv' || $containerFormat && strtolower($containerFormat) != 'flash video';
if ($notFlvFormat) {
// not flv - add ec_seek value in seconds
$url .= '?ec_seek=' . $seekTime / 1000;
// convert milliseconds to seconds
} else {
// flv - add ec_seek value in bytes
$url .= '?ec_seek=' . $this->getSeekFromBytes(kFileSyncUtils::getLocalFilePathForKey($syncKey));
}
}
}
return $url;
}
示例3: getFlavorAssetUrl
/**
* @param flavorAsset $flavorAsset
* @return string
*/
public function getFlavorAssetUrl(flavorAsset $flavorAsset)
{
$entry = $flavorAsset->getentry();
$partnerId = $entry->getPartnerId();
$subpId = $entry->getSubpId();
$flavorAssetId = $flavorAsset->getId();
$partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subpId);
$this->setFileExtension($flavorAsset->getFileExt());
$url = "/s{$partnerPath}/serveFlavor/flavorId/{$flavorAssetId}";
if ($this->clipTo) {
$url .= "/clipTo/{$this->clipTo}";
}
if ($this->extention) {
$url .= "/name/{$flavorAssetId}.{$this->extention}";
}
$url = str_replace('\\', '/', $url);
if ($this->protocol != StorageProfile::PLAY_FORMAT_RTMP) {
$url .= '?novar=0';
$url .= '&e=' . (time() + 120);
$secret = $this->getMediaVault();
$fullUrl = $this->protocol . '://' . $this->domain . $url;
$url .= '&h=' . md5($secret . $fullUrl);
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$seekFromBytes = $this->getSeekFromBytes(kFileSyncUtils::getLocalFilePathForKey($syncKey));
if ($seekFromBytes) {
$url .= '&fs=' . $seekFromBytes;
}
} else {
$url .= '/forceproxy/true';
}
return $url;
}
示例4: syncAction
/**
* @action sync
* @param int $fileSyncId
* @param file $fileData
* @return KalturaFileSync
*/
function syncAction($fileSyncId, $fileData)
{
$dbFileSync = FileSyncPeer::retrieveByPK($fileSyncId);
if (!$dbFileSync) {
throw new APIException(APIErrors::INVALID_FILE_SYNC_ID, $fileSyncId);
}
$key = kFileSyncUtils::getKeyForFileSync($dbFileSync);
kFileSyncUtils::moveFromFile($fileData['tmp_name'], $key, false);
list($file_root, $real_path) = kPathManager::getFilePathArr($key);
$full_path = $file_root . $real_path;
chmod($full_path, 0644);
if (file_exists($full_path)) {
$dbFileSync->setFileRoot($file_root);
$dbFileSync->setFilePath($real_path);
$dbFileSync->setFileSizeFromPath($full_path);
$dbFileSync->setStatus(FileSync::FILE_SYNC_STATUS_READY);
} else {
$dbFileSync->setFileSize(-1);
$dbFileSync->setStatus(FileSync::FILE_SYNC_STATUS_ERROR);
}
$dbFileSync->save();
$fileSync = new KalturaFileSync();
$fileSync->fromObject($dbFileSync);
return $fileSync;
}
示例5: execute
public function execute()
{
$this->forceSystemAuthentication();
myDbHelper::$use_alternative_con = null;
//myDbHelper::DB_HELPER_CONN_PROPEL2
$uiConfId = $this->getRequestParameter("id");
$uiConf = uiConfPeer::retrieveByPK($uiConfId);
$subTypes = array(uiconf::FILE_SYNC_UICONF_SUB_TYPE_DATA, uiconf::FILE_SYNC_UICONF_SUB_TYPE_FEATURES);
foreach ($subTypes as $subType) {
if ($subType == uiconf::FILE_SYNC_UICONF_SUB_TYPE_DATA) {
echo "Data:" . PHP_EOL;
} else {
if ($subType == uiconf::FILE_SYNC_UICONF_SUB_TYPE_FEATURES) {
echo "Features:" . PHP_EOL;
}
}
$syncKey = $uiConf->getSyncKey($subType);
if (kFileSyncUtils::file_exists($syncKey)) {
echo "File sync already exists." . PHP_EOL;
} else {
list($rootPath, $filePath) = $uiConf->generateFilePathArr($subType);
$fullPath = $rootPath . $filePath;
if (file_exists($fullPath)) {
kFileSyncUtils::createSyncFileForKey($syncKey);
echo "Created successfully." . PHP_EOL;
} else {
echo "File not found:" . PHP_EOL;
echo $fullPath . PHP_EOL;
echo "Not creating file sync." . PHP_EOL;
}
}
echo PHP_EOL;
}
die;
}
示例6: __construct
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaDailymotionDistributionProfile) {
return;
}
$flavorAssets = flavorAssetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
// if we have specific flavor assets for this distribution, grab the first one
$flavorAsset = reset($flavorAssets);
} else {
// take the source asset
$flavorAsset = flavorAssetPeer::retrieveOriginalReadyByEntryId($distributionJobData->entryDistribution->entryId);
}
if ($flavorAsset) {
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->videoAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, true);
}
$thumbAssets = thumbAssetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets)) {
$syncKey = reset($thumbAssets)->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->thumbAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, true);
}
}
示例7: entryHandled
public function entryHandled(entry $dbEntry)
{
parent::entryHandled($dbEntry);
$originalFlavorAsset = assetPeer::retrieveOriginalByEntryId($dbEntry->getId());
$syncKey = $originalFlavorAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$sourceFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
// call mediaInfo for file
$dbMediaInfo = new mediaInfo();
try {
$mediaInfoParser = new KMediaInfoMediaParser($sourceFilePath, kConf::get('bin_path_mediainfo'));
$mediaInfo = $mediaInfoParser->getMediaInfo();
$dbMediaInfo = $mediaInfo->toInsertableObject($dbMediaInfo);
$dbMediaInfo->setFlavorAssetId($originalFlavorAsset->getId());
$dbMediaInfo->save();
} catch (Exception $e) {
KalturaLog::err("Getting media info: " . $e->getMessage());
$dbMediaInfo = null;
}
// fix flavor asset according to mediainfo
if ($dbMediaInfo) {
KDLWrap::ConvertMediainfoCdl2FlavorAsset($dbMediaInfo, $originalFlavorAsset);
$flavorTags = KDLWrap::CDLMediaInfo2Tags($dbMediaInfo, array(flavorParams::TAG_WEB, flavorParams::TAG_MBR));
$originalFlavorAsset->setTags(implode(',', array_unique($flavorTags)));
}
$originalFlavorAsset->setStatusLocalReady();
$originalFlavorAsset->save();
$dbEntry->setStatus(entryStatus::READY);
$dbEntry->save();
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:29,代码来源:KalturaWebcamTokenResource.php
示例8: doGetFlavorAssetUrl
/**
* @param flavorAsset $flavorAsset
* @return string
*/
protected function doGetFlavorAssetUrl(flavorAsset $flavorAsset)
{
$entry = $flavorAsset->getentry();
$partnerId = $entry->getPartnerId();
$subpId = $entry->getSubpId();
$flavorAssetId = $flavorAsset->getId();
$partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subpId);
$this->setFileExtension($flavorAsset->getFileExt());
$versionString = $this->getFlavorVersionString($flavorAsset);
$url = "/s{$partnerPath}/serveFlavor/entryId/" . $flavorAsset->getEntryId() . "{$versionString}/flavorId/{$flavorAssetId}";
if ($this->clipTo) {
$url .= "/clipTo/{$this->clipTo}";
}
if ($this->extention) {
$url .= "/name/a.{$this->extention}";
}
$url = str_replace('\\', '/', $url);
if ($this->protocol != StorageProfile::PLAY_FORMAT_RTMP) {
$url .= '?novar=0';
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$seekFromBytes = $this->getSeekFromBytes(kFileSyncUtils::getLocalFilePathForKey($syncKey));
if ($seekFromBytes) {
$url .= '&fs=' . $seekFromBytes;
}
} else {
if ($this->extention && strtolower($this->extention) != 'flv' || $this->containerFormat && strtolower($this->containerFormat) != 'flash video') {
$url = "mp4:{$url}";
}
}
return $url;
}
示例9: parseAction
/**
* Parse content of caption asset and index it
*
* @action parse
* @param string $captionAssetId
* @throws KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND
*/
function parseAction($captionAssetId)
{
$captionAsset = assetPeer::retrieveById($captionAssetId);
if (!$captionAsset) {
throw new KalturaAPIException(KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND, $captionAssetId);
}
$captionAssetItems = CaptionAssetItemPeer::retrieveByAssetId($captionAssetId);
foreach ($captionAssetItems as $captionAssetItem) {
/* @var $captionAssetItem CaptionAssetItem */
$captionAssetItem->delete();
}
$syncKey = $captionAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$content = kFileSyncUtils::file_get_contents($syncKey, true, false);
if (!$content) {
return;
}
$captionsContentManager = kCaptionsContentManager::getCoreContentManager($captionAsset->getContainerFormat());
$itemsData = $captionsContentManager->parse($content);
foreach ($itemsData as $itemData) {
$item = new CaptionAssetItem();
$item->setCaptionAssetId($captionAsset->getId());
$item->setEntryId($captionAsset->getEntryId());
$item->setPartnerId($captionAsset->getPartnerId());
$item->setStartTime($itemData['startTime']);
$item->setEndTime($itemData['endTime']);
$item->setContent(utf8_encode($itemData['content']));
$item->save();
}
}
示例10: addParseCaptionAssetJob
/**
* @param CaptionAsset $captionAsset
* @param BatchJob $parentJob
* @throws kCoreException FILE_NOT_FOUND
* @return BatchJob
*/
public function addParseCaptionAssetJob(CaptionAsset $captionAsset, BatchJob $parentJob = null)
{
$syncKey = $captionAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
if (!$fileSync) {
if (!PermissionPeer::isValidForPartner(CaptionPermissionName::IMPORT_REMOTE_CAPTION_FOR_INDEXING, $captionAsset->getPartnerId())) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if (!$fileSync) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
$fullPath = myContentStorage::getFSUploadsPath() . '/' . $captionAsset->getId() . '.tmp';
if (!kFile::downloadUrlToFile($fileSync->getExternalUrl($captionAsset->getEntryId()), $fullPath)) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
kFileSyncUtils::moveFromFile($fullPath, $syncKey, true, false, true);
}
$jobData = new kParseCaptionAssetJobData();
$jobData->setCaptionAssetId($captionAsset->getId());
$batchJob = null;
if ($parentJob) {
$batchJob = $parentJob->createChild();
} else {
$batchJob = new BatchJob();
$batchJob->setEntryId($captionAsset->getEntryId());
$batchJob->setPartnerId($captionAsset->getPartnerId());
}
return kJobsManager::addJob($batchJob, $jobData, CaptionSearchPlugin::getBatchJobTypeCoreValue(CaptionSearchBatchJobType::PARSE_CAPTION_ASSET));
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:36,代码来源:kCaptionSearchFlowManager.php
示例11: __construct
/**
* Called on the server side and enables you to populate the object with any data from the DB
*
* @param KalturaDistributionJobData $distributionJobData
*/
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaQuickPlayDistributionProfile) {
return;
}
$this->videoFilePaths = new KalturaStringArray();
$this->thumbnailFilePaths = new KalturaStringArray();
// loads all the flavor assets that should be submitted to the remote destination site
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
$entry = entryPeer::retrieveByPK($distributionJobData->entryDistribution->entryId);
foreach ($flavorAssets as $asset) {
$syncKey = $asset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$str = new KalturaString();
$str->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->videoFilePaths[] = $str;
}
}
foreach ($thumbAssets as $asset) {
$syncKey = $asset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$str = new KalturaString();
$str->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->thumbnailFilePaths[] = $str;
}
}
$feed = new QuickPlayFeed($distributionJobData, $this, $flavorAssets, $thumbAssets, $entry);
$this->xml = $feed->getXml();
}
示例12: __construct
/**
* Called on the server side and enables you to populate the object with any data from the DB
*
* @param KalturaDistributionJobData $distributionJobData
*/
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaFreewheelGenericDistributionProfile) {
return;
}
$this->videoAssetFilePaths = new KalturaStringArray();
// loads all the flavor assets that should be submitted to the remote destination site
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
foreach ($flavorAssets as $flavorAsset) {
$videoAssetFilePath = new KalturaString();
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$videoAssetFilePath->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->videoAssetFilePaths[] = $videoAssetFilePath;
}
$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets)) {
$thumbAsset = reset($thumbAssets);
$syncKey = $thumbAssets->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->thumbAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
// entry cue points
$c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
$c->add(CuePointPeer::PARTNER_ID, $distributionJobData->entryDistribution->partnerId);
$c->add(CuePointPeer::ENTRY_ID, $distributionJobData->entryDistribution->entryId);
$c->add(CuePointPeer::TYPE, AdCuePointPlugin::getCuePointTypeCoreValue(AdCuePointType::AD));
$c->addAscendingOrderByColumn(CuePointPeer::START_TIME);
$cuePointsDb = CuePointPeer::doSelect($c);
$this->cuePoints = KalturaCuePointArray::fromDbArray($cuePointsDb);
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:38,代码来源:KalturaFreewheelGenericDistributionJobProviderData.php
示例13: __construct
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaUverseDistributionProfile) {
return;
}
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
// if we have specific flavor assets for this distribution, grab the first one
$flavorAsset = reset($flavorAssets);
} else {
// take the source asset
$flavorAsset = assetPeer::retrieveOriginalReadyByEntryId($distributionJobData->entryDistribution->entryId);
}
if ($flavorAsset) {
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$this->localAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
}
$entryDistributionDb = EntryDistributionPeer::retrieveByPK($distributionJobData->entryDistributionId);
if ($entryDistributionDb) {
$this->remoteAssetUrl = $entryDistributionDb->getFromCustomData(UverseEntryDistributionCustomDataField::REMOTE_ASSET_URL);
$this->remoteAssetFileName = $entryDistributionDb->getFromCustomData(UverseEntryDistributionCustomDataField::REMOTE_ASSET_FILE_NAME);
} else {
KalturaLog::err('Entry distribution [' . $distributionJobData->entryDistributionId . '] not found');
}
}
示例14: validateEntry
public function validateEntry(entry $dbEntry)
{
parent::validateEntry($dbEntry);
$this->validatePropertyNotNull('entryId');
$srcEntry = entryPeer::retrieveByPK($this->entryId);
if (!$srcEntry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $this->entryId);
}
if ($srcEntry->getMediaType() == KalturaMediaType::IMAGE) {
return parent::validateEntry($dbEntry);
}
$srcFlavorAsset = null;
if (is_null($this->flavorParamsId)) {
$srcFlavorAsset = assetPeer::retrieveOriginalByEntryId($this->entryId);
if (!$srcFlavorAsset) {
throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING);
}
} else {
$srcFlavorAsset = assetPeer::retrieveByEntryIdAndParams($this->entryId, $this->flavorParamsId);
if (!$srcFlavorAsset) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $this->assetId);
}
}
$key = $srcFlavorAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$c = FileSyncPeer::getCriteriaForFileSyncKey($key);
$c->addAnd(FileSyncPeer::FILE_TYPE, array(FileSync::FILE_SYNC_FILE_TYPE_FILE, FileSync::FILE_SYNC_FILE_TYPE_LINK), Criteria::IN);
$fileSyncs = FileSyncPeer::doSelect($c);
foreach ($fileSyncs as $fileSync) {
$fileSync = kFileSyncUtils::resolve($fileSync);
if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_FILE) {
return;
}
}
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
}
示例15: copyLiveMetadata
protected function copyLiveMetadata(baseEntry $object, $liveEntryId)
{
$recordedEntryId = $object->getId();
$partnerId = $object->getPartnerId();
$metadataProfiles = MetadataProfilePeer::retrieveAllActiveByPartnerId($partnerId, MetadataObjectType::ENTRY);
foreach ($metadataProfiles as $metadataProfile) {
$originMetadataObj = MetadataPeer::retrieveByObject($metadataProfile->getId(), MetadataObjectType::ENTRY, $liveEntryId);
if ($originMetadataObj) {
$metadataProfileId = $metadataProfile->getId();
$metadataProfileVersion = $metadataProfile->getVersion();
$destMetadataObj = new Metadata();
$destMetadataObj->setPartnerId($partnerId);
$destMetadataObj->setMetadataProfileId($metadataProfileId);
$destMetadataObj->setMetadataProfileVersion($metadataProfileVersion);
$destMetadataObj->setObjectType(MetadataObjectType::ENTRY);
$destMetadataObj->setObjectId($recordedEntryId);
$destMetadataObj->setStatus(KalturaMetadataStatus::VALID);
$originMetadataKey = $originMetadataObj->getSyncKey(Metadata::FILE_SYNC_METADATA_DATA);
$originXml = kFileSyncUtils::file_get_contents($originMetadataKey, true, false);
// validate object exists
$object = kMetadataManager::getObjectFromPeer($destMetadataObj);
if ($object) {
$destMetadataObj->save();
} else {
KalturaLog::err('invalid object type');
continue;
}
$destMetadataKey = $destMetadataObj->getSyncKey(Metadata::FILE_SYNC_METADATA_DATA);
kFileSyncUtils::file_put_contents($destMetadataKey, $originXml);
}
}
}