本文整理汇总了PHP中kFileSyncUtils::fileSync_exists方法的典型用法代码示例。如果您正苦于以下问题:PHP kFileSyncUtils::fileSync_exists方法的具体用法?PHP kFileSyncUtils::fileSync_exists怎么用?PHP kFileSyncUtils::fileSync_exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kFileSyncUtils
的用法示例。
在下文中一共展示了kFileSyncUtils::fileSync_exists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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');
}
}
示例2: __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();
}
示例3: __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 KalturaHuluDistributionProfile) {
return;
}
// loads all the flavor assets that should be submitted to the remote destination site
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
$flavorAsset = reset($flavorAssets);
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->videoAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets)) {
$thumbAsset = reset($thumbAssets);
$syncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->thumbAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
$additionalAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->assetIds));
$this->captionLocalPaths = new KalturaStringArray();
if (count($additionalAssets)) {
$captionAssetFilePathArray = array();
foreach ($additionalAssets as $additionalAsset) {
$assetType = $additionalAsset->getType();
$syncKey = $additionalAsset->getSyncKey(CaptionAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
if ($assetType == CaptionPlugin::getAssetTypeCoreValue(CaptionAssetType::CAPTION) || $assetType == AttachmentPlugin::getAssetTypeCoreValue(AttachmentAssetType::ATTACHMENT)) {
$string = new KalturaString();
$string->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->captionLocalPaths[] = $string;
}
}
}
}
$tempFieldValues = unserialize($this->fieldValues);
$pattern = '/[^A-Za-z0-9_\\-]/';
$seriesTitle = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::SERIES_TITLE]);
$seasonNumber = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::SEASON_NUMBER]);
$videoEpisodeNumber = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::VIDEO_EPISODE_NUMBER]);
$videoTitle = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::VIDEO_TITLE]);
$this->fileBaseName = $seriesTitle . '-' . $seasonNumber . '-' . $videoEpisodeNumber . '-' . $videoTitle;
// 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);
}
示例4: __construct
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaYahooDistributionProfile) {
return;
}
//Flavor Assets
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
$videoAssetFilePathArray = array();
foreach ($flavorAssets as $flavorAsset) {
if ($flavorAsset) {
/* @var $flavorAsset flavorAsset */
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$id = $flavorAsset->getId();
//$this->videoAssetFilePath[$id] = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$videoAssetFilePathArray[$id] = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
}
}
$this->videoAssetFilePath = serialize($videoAssetFilePathArray);
}
//Thumbnails
$c = new Criteria();
$c->addAnd(assetPeer::ID, explode(',', $distributionJobData->entryDistribution->thumbAssetIds), Criteria::IN);
$c->addAscendingOrderByColumn(assetPeer::ID);
$thumbAssets = assetPeer::doSelect($c);
//$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets) >= 2) {
if ($thumbAssets[0]->getWidth() <= $thumbAssets[1]->getWidth()) {
$smallThumbAsset = $thumbAssets[0];
$largeThumbAsset = $thumbAssets[1];
} else {
$smallThumbAsset = $thumbAssets[1];
$largeThumbAsset = $thumbAssets[0];
}
$syncKey = $smallThumbAsset->getSyncKey(thumbAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$this->smallThumbPath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
$syncKey = $largeThumbAsset->getSyncKey(thumbAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$this->largeThumbPath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
}
}
示例5: uiConfCopied
/**
* @param uiConf $fromObject
* @param uiConf $toObject
*/
protected function uiConfCopied(uiConf $fromObject, uiConf $toObject)
{
$fileAssets = FileAssetPeer::retrieveByObject(FileAssetObjectType::UI_CONF, $fromObject->getId());
foreach ($fileAssets as $fileAsset) {
/* @var $fileAsset FileAsset */
$newFileAssets = $fileAsset->copy();
$newFileAssets->setObjectId($toObject->getId());
$newFileAssets->incrementVersion();
$newFileAssets->save();
$syncKey = $fileAsset->getSyncKey(FileAsset::FILE_SYNC_ASSET);
$newSyncKey = $newFileAssets->getSyncKey(FileAsset::FILE_SYNC_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
kFileSyncUtils::softCopy($syncKey, $newSyncKey);
}
}
}
示例6: serveAction
/**
* Serves thumbnail by its id
*
* @action serve
* @serverOnly
* @param string $thumbAssetId
*
* @throws KalturaErrors::THUMB_ASSET_IS_NOT_READY
* @throws KalturaErrors::THUMB_ASSET_ID_NOT_FOUND
*/
public function serveAction($thumbAssetId)
{
$thumbAsset = thumbAssetPeer::retrieveById($thumbAssetId);
if (!$thumbAsset) {
throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_ID_NOT_FOUND, $thumbAssetId);
}
$ext = $thumbAsset->getFileExt();
if (is_null($ext)) {
$ext = 'jpg';
}
$fileName = $thumbAsset->getEntryId() . "_" . $thumbAsset->getId() . ".{$ext}";
$syncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (!kFileSyncUtils::fileSync_exists($syncKey)) {
throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_IS_NOT_READY, $thumbAsset);
}
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
return $this->serveThumbToFile($fileSync, $local, $fileName);
}
示例7: copyEventNotificationTemplates
/**
* @param Partner $fromPartner
* @param Partner $toPartner
*/
protected function copyEventNotificationTemplates(Partner $fromPartner, Partner $toPartner, $permissionRequiredOnly = false)
{
$fromPartnerId = $fromPartner->getId();
$toPartnerId = $toPartner->getId();
KalturaLog::debug("Copy event-notification templates from [{$fromPartnerId}] to [{$toPartnerId}]");
$c = new Criteria();
$c->add(EventNotificationTemplatePeer::PARTNER_ID, $fromPartnerId);
$systemNameCriteria = new Criteria();
$systemNameCriteria->add(EventNotificationTemplatePeer::PARTNER_ID, $toPartnerId);
$systemNameCriteria->add(EventNotificationTemplatePeer::STATUS, EventNotificationTemplateStatus::ACTIVE);
$eventNotificationTemplates = EventNotificationTemplatePeer::doSelect($c);
foreach ($eventNotificationTemplates as $eventNotificationTemplate) {
/* @var $eventNotificationTemplate EventNotificationTemplate */
if ($permissionRequiredOnly && !count($eventNotificationTemplate->getRequiredCopyTemplatePermissions())) {
continue;
}
if (!myPartnerUtils::isPartnerPermittedForCopy($toPartner, $eventNotificationTemplate->getRequiredCopyTemplatePermissions())) {
continue;
}
if ($eventNotificationTemplate->getSystemName()) {
$c = clone $systemNameCriteria;
$c->add(EventNotificationTemplatePeer::SYSTEM_NAME, $eventNotificationTemplate->getSystemName());
if (EventNotificationTemplatePeer::doCount($c)) {
continue;
}
}
$newEventNotificationTemplate = $eventNotificationTemplate->copy();
$newEventNotificationTemplate->setPartnerId($toPartnerId);
$newEventNotificationTemplate->save();
if ($eventNotificationTemplate instanceof ISyncableFile) {
$key = $eventNotificationTemplate->getSyncKey(1);
if (kFileSyncUtils::fileSync_exists($key)) {
kFileSyncUtils::createSyncFileLinkForKey($newEventNotificationTemplate->getSyncKey(1), $key);
}
}
}
}
示例8: __construct
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaMetroPcsDistributionProfile) {
return;
}
$distributedFlavorIds = null;
$distributedThumbIds = null;
//Flavor Assets
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
$videoAssetFilePathArray = array();
foreach ($flavorAssets as $flavorAsset) {
if ($flavorAsset) {
/* @var $flavorAsset flavorAsset */
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$id = $flavorAsset->getId();
$videoAssetFilePathArray[$id] = kFileSyncUtils::getLocalFilePathForKey($syncKey, true);
}
}
}
$this->assetLocalPaths = serialize($videoAssetFilePathArray);
}
//thumbnails
$thumbnails = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbnails)) {
$thumbUrlsArray = array();
foreach ($thumbnails as $thumb) {
$thumbUrlsArray[$thumb->getId()] = self::getAssetUrl($thumb);
}
$this->thumbUrls = serialize($thumbUrlsArray);
}
}
示例9: serveFile
/**
* @param ISyncableFile $syncable
* @param int $fileSubType
* @param string $fileName
* @param bool $forceProxy
* @throws KalturaErrors::FILE_DOESNT_EXIST
*/
protected function serveFile(ISyncableFile $syncable, $fileSubType, $fileName, $entryId = null, $forceProxy = false)
{
/* @var $fileSync FileSync */
$syncKey = $syncable->getSyncKey($fileSubType);
if (!kFileSyncUtils::fileSync_exists($syncKey)) {
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
}
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
header("Content-Disposition: attachment; filename=\"{$fileName}\"");
if ($local) {
$filePath = $fileSync->getFullPath();
$wamsAssetId = $fileSync->getWamsAssetId();
if (empty($wamsAssetId)) {
$mimeType = kFile::mimeType($filePath);
kFile::dumpFile($filePath, $mimeType);
} else {
kWAMS::getInstance($fileSync->getPartnerId())->dumpFile($wamsAssetId, pathinfo($filePath, PATHINFO_EXTENSION));
}
} else {
if (in_array($fileSync->getDc(), kDataCenterMgr::getDcIds())) {
$remoteUrl = kDataCenterMgr::getRedirectExternalUrl($fileSync);
KalturaLog::info("Redirecting to [{$remoteUrl}]");
if ($forceProxy) {
kFile::dumpApiRequest($remoteUrl);
} else {
//TODO find or build function which redurects the API request with all its parameters without using curl.
// or redirect if no proxy
header("Location: {$remoteUrl}");
die;
}
} else {
$remoteUrl = $fileSync->getExternalUrl($entryId);
header("Location: {$remoteUrl}");
die;
}
}
}
示例10: createIsmManifestFileSyncLinkFromReplacingEntry
private static function createIsmManifestFileSyncLinkFromReplacingEntry($tempEntry, $realEntry)
{
$tempEntryIsmSyncKey = $tempEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
$tempEntryIsmcSyncKey = $tempEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
if (kFileSyncUtils::fileSync_exists($tempEntryIsmSyncKey) && kFileSyncUtils::fileSync_exists($tempEntryIsmcSyncKey)) {
$ismVersion = $realEntry->incrementIsmVersion();
$realEntryIsmSyncKey = $realEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM, $ismVersion);
kFileSyncUtils::createSyncFileLinkForKey($realEntryIsmSyncKey, $tempEntryIsmSyncKey);
$realEntryIsmcSyncKey = $realEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC, $ismVersion);
kFileSyncUtils::createSyncFileLinkForKey($realEntryIsmcSyncKey, $tempEntryIsmcSyncKey);
}
}
示例11: copyEntryData
public static function copyEntryData(entry $entry, entry $targetEntry)
{
// for any type that does not require assets:
$shouldCopyDataForNonClip = true;
if ($entry->getType() == entryType::MEDIA_CLIP) {
$shouldCopyDataForNonClip = false;
}
if ($entry->getType() == entryType::PLAYLIST) {
$shouldCopyDataForNonClip = false;
}
$shouldCopyDataForClip = false;
// only images get their data copied
if ($entry->getType() == entryType::MEDIA_CLIP) {
if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_AUDIO) {
$shouldCopyDataForClip = true;
}
}
if ($shouldCopyDataForNonClip || $shouldCopyDataForClip) {
// copy the data
$from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
// replaced__getDataPath
$to = $targetEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
// replaced__getDataPath
KalturaLog::log("copyEntriesByType - copying entry data [" . $from . "] to [" . $to . "]");
kFileSyncUtils::softCopy($from, $to);
}
$ismFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
if (kFileSyncUtils::fileSync_exists($ismFrom)) {
$ismTo = $targetEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
KalturaLog::log("copying entry ism [" . $ismFrom . "] to [" . $ismTo . "]");
kFileSyncUtils::softCopy($ismFrom, $ismTo);
}
$ismcFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
if (kFileSyncUtils::fileSync_exists($ismcFrom)) {
$ismcTo = $targetEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
KalturaLog::log("copying entry ism [" . $ismcFrom . "] to [" . $ismcTo . "]");
kFileSyncUtils::softCopy($ismcFrom, $ismcTo);
}
$from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
// replaced__getThumbnailPath
$considerCopyThumb = true;
// if entry is image - data is thumbnail, and it was copied
if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
$considerCopyThumb = false;
}
// if entry is not clip, and there is no file in both DCs - nothing to copy
if ($entry->getType() != entryType::MEDIA_CLIP && !kFileSyncUtils::file_exists($from, true)) {
$considerCopyThumb = false;
}
if ($considerCopyThumb) {
$skipThumb = false;
// don't attempt to copy a thumbnail for images - it's the same as the data which was just created
if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_AUDIO) {
// check if audio entry has real thumb, if not - don't copy thumb.
$originalFileSync = kFileSyncUtils::getOriginFileSyncForKey($from, false);
if (!$originalFileSync) {
$skipThumb = true;
}
}
if (!$skipThumb) {
$to = $targetEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
// replaced__getThumbnailPath
KalturaLog::log("copyEntriesByType - copying entry thumbnail [" . $from . "] to [" . $to . "]");
kFileSyncUtils::softCopy($from, $to);
}
}
// added by Tan-Tan 12/01/2010 to support falvors copy
$sourceAssets = assetPeer::retrieveByEntryId($entry->getId());
foreach ($sourceAssets as $sourceAsset) {
$sourceAsset->copyToEntry($targetEntry->getId(), $targetEntry->getPartnerId());
}
}
示例12: objectAdded
public function objectAdded(BaseObject $object, BatchJob $raisedJob = null)
{
$entry = $object->getentry();
if ($object->getStatus() == asset::FLAVOR_ASSET_STATUS_QUEUED || $object->getStatus() == asset::FLAVOR_ASSET_STATUS_IMPORTING) {
if (!$object instanceof flavorAsset) {
$object->setStatus(asset::FLAVOR_ASSET_STATUS_READY);
$object->save();
} elseif ($object->getIsOriginal()) {
if ($entry->getType() == entryType::MEDIA_CLIP) {
$syncKey = $object->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
// Get the asset fileSync.
// For URL typed sync - assume remote and use the relative file path.
// For the other types - use the ordinary kFileSyncUtils::getLocalFilePathForKey.
$fsArr = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
$fs = $fsArr[0];
if ($fs->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL) {
$path = $fs->getFilePath();
} else {
$path = kFileSyncUtils::getLocalFilePathForKey($syncKey);
}
kJobsManager::addConvertProfileJob($raisedJob, $entry, $object->getId(), $path);
}
}
} else {
$object->setStatus(asset::FLAVOR_ASSET_STATUS_VALIDATING);
$object->save();
}
}
if ($object->getStatus() == asset::FLAVOR_ASSET_STATUS_READY && $object instanceof thumbAsset) {
if ($object->getFlavorParamsId()) {
kFlowHelper::generateThumbnailsFromFlavor($object->getEntryId(), $raisedJob, $object->getFlavorParamsId());
} else {
if ($object->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
kBusinessConvertDL::setAsDefaultThumbAsset($object);
}
}
return true;
}
if ($object->getIsOriginal() && $entry->getStatus() == entryStatus::NO_CONTENT) {
$entry->setStatus(entryStatus::PENDING);
$entry->save();
}
return true;
}
示例13: array
if (in_array($entry->getId(), $processedIds)) {
continue;
}
$processedIds[] = $entry->getId();
$lastCreatedAt = $entry->getCreatedAt(null);
$keys = array();
$keys[] = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
$keys[] = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
$flavors = assetPeer::retrieveReadyFlavorsByEntryId($entry->getId());
foreach ($flavors as $flavor) {
if (!$flavorParamsArr || in_array($flavor->getFlavorParamsId(), $flavorParamsArr)) {
$keys[] = $flavor->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
}
}
foreach ($keys as $index => $key) {
if (!kFileSyncUtils::fileSync_exists($key)) {
unset($keys[$index]);
continue;
}
if (kFileSyncUtils::getReadyExternalFileSyncForKey($key, $storageProfileId)) {
unset($keys[$index]);
}
if (!kFileSyncUtils::getReadyInternalFileSyncForKey($key)) {
echo 'file sync key does not have an internal file -' . serialize($key) . PHP_EOL;
unset($keys[$index]);
}
}
if (!count($keys)) {
echo $entry->getId() . " - has no keys to export\n";
continue;
}
示例14: copyEntry
public static function copyEntry(entry $entry, Partner $toPartner = null, $dontCopyUsers = false)
{
KalturaLog::log("copyEntry - Copying entry [" . $entry->getId() . "] to partner [" . $toPartner->getId() . "]");
$newEntry = $entry->copy();
$newEntry->setIntId(null);
if ($toPartner instanceof Partner) {
$newEntry->setPartnerId($toPartner->getId());
$newEntry->setSubpId($toPartner->getId() * 100);
$newEntry->setAccessControlId($toPartner->getDefaultAccessControlId());
$flavorParamsStr = $entry->getFlavorParamsIds();
$flavorParams = explode(',', $flavorParamsStr);
$newFlavorParams = array();
foreach ($flavorParams as $flavorParamsId) {
$newFlavorParamsId = kObjectCopyHandler::getMappedId('flavorParams', $flavorParamsId);
if (is_null($newFlavorParamsId)) {
$newFlavorParamsId = $flavorParamsId;
}
$newFlavorParams[] = $newFlavorParamsId;
}
$newEntry->setFlavorParamsIds(implode(',', $newFlavorParams));
}
$newKuser = null;
if (!$dontCopyUsers) {
// copy the kuser (if the same puser id exists its kuser will be used)
kuserPeer::setUseCriteriaFilter(false);
$kuser = $entry->getKuser();
$newKuser = kuserPeer::createKuserForPartner($newEntry->getPartnerId(), $kuser->getPuserId());
$newEntry->setKuserId($newKuser->getId());
kuserPeer::setUseCriteriaFilter(true);
}
// copy the kshow
kshowPeer::setUseCriteriaFilter(false);
$kshow = $entry->getKshow();
if ($kshow) {
$newKshow = $kshow->copy();
$newKshow->setIntId(null);
$newKshow->setPartnerId($toPartner->getId());
$newKshow->setSubpId($toPartner->getId() * 100);
if ($newKuser) {
$newKshow->setProducerId($newKuser->getId());
}
$newKshow->save();
$newEntry->setKshowId($newKshow->getId());
}
kshowPeer::setUseCriteriaFilter(true);
// reset the statistics
myEntryUtils::resetEntryStatistics($newEntry);
// set the new partner id into the default category criteria filter
$defaultCategoryFilter = categoryPeer::getCriteriaFilter()->getFilter();
$oldPartnerId = $defaultCategoryFilter->get(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $newEntry->getPartnerId());
// save the entry
$newEntry->save();
// restore the original partner id in the default category criteria filter
$defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $oldPartnerId);
KalturaLog::log("copyEntry - New entry [" . $newEntry->getId() . "] was created");
// for any type that does not require assets:
$shouldCopyDataForNonClip = $entry->getType() != entryType::MEDIA_CLIP;
$shouldCopyDataForClip = false;
// only images get their data copied
if ($entry->getType() == entryType::MEDIA_CLIP) {
if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_AUDIO) {
$shouldCopyDataForClip = true;
}
}
if ($shouldCopyDataForNonClip || $shouldCopyDataForClip) {
// copy the data
$from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
// replaced__getDataPath
$to = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
// replaced__getDataPath
KalturaLog::log("copyEntriesByType - copying entry data [" . $from . "] to [" . $to . "]");
kFileSyncUtils::softCopy($from, $to);
}
$ismFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
if (kFileSyncUtils::fileSync_exists($ismFrom)) {
$ismTo = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
KalturaLog::log("copying entry ism [" . $ismFrom . "] to [" . $ismTo . "]");
kFileSyncUtils::softCopy($ismFrom, $ismTo);
}
$ismcFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
if (kFileSyncUtils::fileSync_exists($ismcFrom)) {
$ismcTo = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
KalturaLog::log("copying entry ism [" . $ismcFrom . "] to [" . $ismcTo . "]");
kFileSyncUtils::softCopy($ismcFrom, $ismcTo);
}
$from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
// replaced__getThumbnailPath
$considerCopyThumb = true;
// if entry is image - data is thumbnail, and it was copied
if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
$considerCopyThumb = false;
}
// if entry is not clip, and there is no file in both DCs - nothing to copy
if ($entry->getType() != entryType::MEDIA_CLIP && !kFileSyncUtils::file_exists($from, true)) {
$considerCopyThumb = false;
}
if ($considerCopyThumb) {
//.........这里部分代码省略.........
示例15: copyToEntry
public function copyToEntry($entryId = null, $partnerId = null)
{
$newFlavorAsset = $this->copy();
//this is the first version of the new asset.
$newFlavorAsset->incrementVersion();
if ($partnerId) {
$newFlavorAsset->setPartnerId($partnerId);
}
if ($entryId) {
$newFlavorAsset->setEntryId($entryId);
}
$newFlavorAsset->save();
$flavorParamsOutput = assetParamsOutputPeer::retrieveByAssetId($this->getId());
if ($flavorParamsOutput) {
$newFlavorParamsOutput = $flavorParamsOutput->copy();
$newFlavorParamsOutput->setPartnerId($newFlavorAsset->getPartnerId());
$newFlavorParamsOutput->setEntryId($newFlavorAsset->getEntryId());
$newFlavorParamsOutput->setFlavorAssetId($newFlavorAsset->getId());
$newFlavorParamsOutput->save();
}
$mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($this->getId());
if ($mediaInfo) {
$newMediaInfo = $mediaInfo->copy();
$newMediaInfo->setFlavorAssetId($newFlavorAsset->getId());
$newMediaInfo->setFlavorAssetVersion($newFlavorAsset->getVersion());
$newMediaInfo->save();
}
$assetSyncKey = $this->getSyncKey(self::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$convertLogSyncKey = $this->getSyncKey(self::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG);
$ismSyncKey = $this->getSyncKey(self::FILE_SYNC_ASSET_SUB_TYPE_ISM);
$ismcSyncKey = $this->getSyncKey(self::FILE_SYNC_ASSET_SUB_TYPE_ISMC);
$newAssetSyncKey = $newFlavorAsset->getSyncKey(self::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$newConvertLogSyncKey = $newFlavorAsset->getSyncKey(self::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG);
$newIsmSyncKey = $newFlavorAsset->getSyncKey(self::FILE_SYNC_ASSET_SUB_TYPE_ISM);
$newIsmcSyncKey = $newFlavorAsset->getSyncKey(self::FILE_SYNC_ASSET_SUB_TYPE_ISMC);
if (kFileSyncUtils::fileSync_exists($assetSyncKey)) {
kFileSyncUtils::softCopy($assetSyncKey, $newAssetSyncKey);
}
if (kFileSyncUtils::fileSync_exists($convertLogSyncKey)) {
kFileSyncUtils::softCopy($convertLogSyncKey, $newConvertLogSyncKey);
}
if (kFileSyncUtils::fileSync_exists($ismSyncKey)) {
kFileSyncUtils::softCopy($ismSyncKey, $newIsmSyncKey);
}
if (kFileSyncUtils::fileSync_exists($ismcSyncKey)) {
kFileSyncUtils::softCopy($ismcSyncKey, $newIsmcSyncKey);
}
kEventsManager::raiseEvent(new kObjectAddedEvent($newFlavorAsset));
return $newFlavorAsset;
}