本文整理汇总了PHP中entry::getStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP entry::getStatus方法的具体用法?PHP entry::getStatus怎么用?PHP entry::getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entry
的用法示例。
在下文中一共展示了entry::getStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeImpl
public function executeImpl(kshow $kshow, entry &$entry)
{
$genericWidget = "";
$myspaceWidget = "";
$kshow_id = $kshow->getId();
$entry_id = $entry->getId();
if (!$kshow->getPartnerId() && !$this->forceViewPermissions($kshow, $kshow_id, false, false)) {
die;
}
$this->kshow_category = $kshow->getTypeText();
$this->kshow_description = $kshow->getDescription();
$this->kshow_name = $kshow->getName();
$this->kshow_tags = $kshow->getTags();
$kdata = @$_REQUEST["kdata"];
if ($kdata == "null") {
$kdata = "";
}
$this->widget_type = @$_REQUEST["widget_type"];
list($genericWidget, $myspaceWidget) = myKshowUtils::getEmbedPlayerUrl($kshow_id, $entry_id, false, $kdata);
if ($entry_id == 1002) {
$this->share_url = requestUtils::getHost() . "/index.php/corp/kalturaPromo";
} else {
if ($kdata) {
$this->share_url = myKshowUtils::getWidgetCmdUrl($kdata, "share");
} else {
$this->share_url = myKshowUtils::getUrl($kshow_id) . "&entry_id={$entry_id}";
}
}
//list($status, $kmediaType, $kmediaData) = myContentRender::createPlayerMedia($entry); // myContentRender class removed, old code
$status = $entry->getStatus();
$kmediaType = $entry->getMediaType();
$kmediaData = "";
$this->message = $kmediaType == entry::ENTRY_MEDIA_TYPE_TEXT ? $kmediaData : "";
$this->generic_embed_code = $genericWidget;
$this->myspace_embed_code = $myspaceWidget;
$this->thumbnail = $entry ? $entry->getBigThumbnailPath(true) : "";
$this->kuser = $entry->getKuser();
$this->entry = $entry;
}
示例2: execute
public function execute()
{
$this->entryId = $this->getRequestParameter("entryId", null);
$this->flavorId = $this->getRequestParameter("flavorId", null);
$this->storageId = $this->getRequestParameter("storageId", null);
$this->maxBitrate = $this->getRequestParameter("maxBitrate", null);
$flavorIdsStr = $this->getRequestParameter("flavorIds", null);
if ($flavorIdsStr) {
$this->flavorIds = explode(",", $flavorIdsStr);
}
$this->entry = entryPeer::retrieveByPKNoFilter($this->entryId);
if (!$this->entry) {
KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND);
}
if (!$this->flavorId) {
$flavorParamId = $this->getRequestParameter("flavorParamId", null);
if ($flavorParamId) {
$flavorAsset = flavorAssetPeer::retrieveByEntryIdAndFlavorParams($entry->getId(), $flavorParamId);
if (!$flavorAsset) {
KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
}
$this->flavorId = $flavorAsset->getId();
}
}
$this->validateStorageId();
$this->protocol = $this->getRequestParameter("protocol", null);
if (!$this->protocol) {
$this->protocol = StorageProfile::PLAY_FORMAT_HTTP;
}
$this->format = $this->getRequestParameter("format");
if (!$this->format) {
$this->format = StorageProfile::PLAY_FORMAT_HTTP;
}
$this->cdnHost = $this->getRequestParameter("cdnHost", null);
$partner = $this->entry->getPartner();
if (!$this->cdnHost || $partner->getForceCdnHost()) {
$this->cdnHost = myPartnerUtils::getCdnHost($this->entry->getPartnerId(), $this->protocol);
}
if ($this->maxBitrate && (!is_numeric($this->maxBitrate) || $this->maxBitrate <= 0)) {
KExternalErrors::dieError(KExternalErrors::INVALID_MAX_BITRATE);
}
$ksStr = $this->getRequestParameter("ks");
$base64Referrer = $this->getRequestParameter("referrer");
$referrer = base64_decode($base64Referrer);
if (!is_string($referrer)) {
$referrer = "";
}
// base64_decode can return binary data
$securyEntryHelper = new KSecureEntryHelper($this->entry, $ksStr, $referrer);
if ($securyEntryHelper->shouldPreview()) {
$this->clipTo = $securyEntryHelper->getPreviewLength() * 1000;
} else {
$securyEntryHelper->validateForPlay($this->entry, $ksStr);
}
// grab seekFrom parameter and normalize url
$this->seekFrom = $this->getRequestParameter("seekFrom", -1);
if ($this->seekFrom <= 0) {
$this->seekFrom = -1;
}
if ($this->entry->getStatus() == entryStatus::DELETED) {
// because the fiter was turned off - a manual check for deleted entries must be done.
die;
}
$xml = null;
switch ($this->format) {
case StorageProfile::PLAY_FORMAT_HTTP:
$xml = $this->serveHttp();
break;
case StorageProfile::PLAY_FORMAT_RTMP:
$xml = $this->serveRtmp();
break;
case StorageProfile::PLAY_FORMAT_SILVER_LIGHT:
$xml = $this->serveSilverLight();
break;
case StorageProfile::PLAY_FORMAT_APPLE_HTTP:
$xml = $this->serveAppleHttp();
break;
case "url":
return $this->serveUrl();
break;
case "hdnetworksmil":
$xml = $this->serveHDNetwork();
break;
case "hdnetwork":
$duration = $this->entry->getDurationInt();
$mediaUrl = "<media url=\"" . requestUtils::getHost() . str_replace("f4m", "smil", str_replace("hdnetwork", "hdnetworksmil", $_SERVER["REQUEST_URI"])) . "\"/>";
$xml = $this->buildXml(self::PLAY_STREAM_TYPE_RECORDED, array(), 'video/x-flv', $duration, null, $mediaUrl);
break;
}
if ($this->format == StorageProfile::PLAY_FORMAT_APPLE_HTTP) {
header("Content-Type: text/plain; charset=UTF-8");
} else {
header("Content-Type: text/xml; charset=UTF-8");
header("Content-Disposition: inline; filename=manifest.xml");
}
echo $xml;
die;
}
示例3: handleEntry
private function handleEntry($onlyExtractThumb, $prefix, $type, $entry_id, $name = null, $tags = null, $entry = null)
{
KalturaLog::debug("handleEntry({$type}, {$entry_id}, {$name})");
$this->clear($prefix, $entry_id);
$kuser_id = $this->kuser_id;
$entry_data_prefix = $kuser_id . '_' . ($prefix == '' ? 'data' : rtrim($prefix, '_'));
$uploads = myContentStorage::getFSUploadsPath();
$content = myContentStorage::getFSContentRootPath();
$media_source = $this->getParam('entry_media_source');
$media_type = $this->getParam('entry_media_type');
$entry_url = $this->getParam('entry_url');
$entry_source_link = $this->getParam('entry_source_link');
$entry_fileName = $this->getParam('entry_data');
$entry_thumbNum = $this->getParam('entry_thumb_num', 0);
$entry_thumbUrl = $this->getParam('entry_thumb_url', '');
$should_copy = $this->getParam('should_copy', false);
$skip_conversion = $this->getParam('skip_conversion', false);
$webcam_suffix = $this->getParam('webcam_suffix', '');
$duration = $this->getParam('duration', null);
$entry_fullPath = "";
$ext = null;
$entry = null;
if ($entry_id) {
$entry = entryPeer::retrieveByPK($entry_id);
} else {
$entry = new entry();
}
$this->entry = $entry;
$entry_status = $entry->getStatus();
if (is_null($entry_status)) {
$entry_status = entryStatus::READY;
}
// by the end of this block of code $entry_fullPath will point to the location of the entry
// the entry status will be set (IMPORT / PRECONVERT / READY)
// a background image is always previewed by the user no matter what source he used
// so the entry is already in the /uploads directory
// continue tracking the file upload
$te = new TrackEntry();
$te->setEntryId($entry_id);
$te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_ADD_ENTRY);
KalturaLog::debug("handleEntry: media_source: {$media_source}, prefix: {$prefix}");
if ($media_source == entry::ENTRY_MEDIA_SOURCE_FILE || $prefix == 'bg_') {
$full_path = $this->getParam('entry_full_path');
if ($full_path) {
$entry_fullPath = $full_path;
} else {
$entry_fullPath = $uploads . $entry_data_prefix . strrchr($entry_fileName, '.');
}
if ($media_type == entry::ENTRY_MEDIA_TYPE_VIDEO || $media_type == entry::ENTRY_MEDIA_TYPE_AUDIO) {
$entry_status = entryStatus::PRECONVERT;
}
$te->setParam3Str($entry_fullPath);
$te->setDescription(__METHOD__ . ":" . __LINE__ . "::ENTRY_MEDIA_SOURCE_FILE");
} else {
if ($media_source == entry::ENTRY_MEDIA_SOURCE_WEBCAM) {
// set $entry_fileName to webcam output file and flag that conversion is not needed
$webcam_basePath = $content . '/content/webcam/' . ($webcam_suffix ? $webcam_suffix : 'my_recorded_stream_' . $kuser_id);
$entry_fullPath = $webcam_basePath . '.' . kWAMSWebcam::OUTPUT_FILE_EXT;
$ext = kWAMSWebcam::OUTPUT_FILE_EXT;
if (file_exists($entry_fullPath)) {
// continue tracking the webcam
$te->setParam3Str($entry_fullPath);
$te->setDescription(__METHOD__ . ":" . __LINE__ . "::ENTRY_MEDIA_SOURCE_WEBCAM");
} else {
KalturaLog::err("File [{$entry_fullPath}] does not exist");
$entry_status = entryStatus::ERROR_IMPORTING;
}
} else {
// if the url ends with .ext, we'll extract it this way
$urlext = strrchr($entry_url, '.');
// TODO: fix this patch
if (strlen($urlext) > 4) {
$urlext = '.jpg';
}
// if we got something wierd, assume we're downloading a jpg
$entry_fileName = $entry_data_prefix . $urlext;
KalturaLog::debug("handleEntry: media_type: {$media_type}");
if ($media_type == entry::ENTRY_MEDIA_TYPE_IMAGE) {
$duration = 0;
$entry_fullPath = $uploads . $entry_fileName;
if (!kFile::downloadUrlToFile($entry_url, $entry_fullPath)) {
KalturaLog::debug("Failed downloading file[{$entry_url}]");
$entry_status = entryStatus::ERROR_IMPORTING;
}
// track images
$te->setParam3Str($entry_fullPath);
$te->setDescription(__METHOD__ . ":" . __LINE__ . "::ENTRY_MEDIA_SOURCE_URL:ENTRY_MEDIA_TYPE_IMAGE");
} else {
if ($media_type == entry::ENTRY_MEDIA_TYPE_VIDEO) {
//fixme - we can extract during import
$ext = "flv";
} else {
$ext = "mp3";
}
$entry_status = entryStatus::IMPORT;
// track images
$te->setParam3Str($ext);
$te->setDescription(__METHOD__ . ":" . __LINE__ . "::ENTRY_MEDIA_SOURCE_URL:ENTRY_MEDIA_TYPE_VIDEO");
}
}
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:myInsertEntryHelper.class.php
示例4: addConvertProfileJob
/**
* @param BatchJob $batchJob
* @param entry $entry
* @param string $flavorAssetId
* @param string $inputFileSyncLocalPath
* @return BatchJob
*/
public static function addConvertProfileJob(BatchJob $parentJob = null, entry $entry, $flavorAssetId, $inputFileSyncLocalPath)
{
KalturaLog::debug("Parent job [" . ($parentJob ? $parentJob->getId() : 'none') . "] entry [" . $entry->getId() . "] flavor asset [{$flavorAssetId}] input file [{$inputFileSyncLocalPath}]");
if ($entry->getConversionQuality() == conversionProfile2::CONVERSION_PROFILE_NONE) {
$entry->setStatus(entryStatus::PENDING);
$entry->save();
KalturaLog::notice('Entry should not be converted');
return null;
}
$importingSources = false;
// if file size is 0, do not create conversion profile and set entry status as error converting
if (!file_exists($inputFileSyncLocalPath) || kFile::fileSize($inputFileSyncLocalPath) == 0) {
KalturaLog::debug("Input file [{$inputFileSyncLocalPath}] does not exist");
$partner = $entry->getPartner();
$conversionProfile = myPartnerUtils::getConversionProfile2ForEntry($entry->getId());
// load the asset params to the instance pool
$flavorIds = flavorParamsConversionProfilePeer::getFlavorIdsByProfileId($conversionProfile->getId());
assetParamsPeer::retrieveByPKs($flavorIds);
$conversionRequired = false;
$sourceFileRequiredStorages = array();
$sourceIncludedInProfile = false;
$flavorAsset = assetPeer::retrieveById($flavorAssetId);
$flavors = flavorParamsConversionProfilePeer::retrieveByConversionProfile($conversionProfile->getId());
KalturaLog::debug("Found flavors [" . count($flavors) . "] in conversion profile [" . $conversionProfile->getId() . "]");
foreach ($flavors as $flavor) {
/* @var $flavor flavorParamsConversionProfile */
if ($flavor->getFlavorParamsId() == $flavorAsset->getFlavorParamsId()) {
KalturaLog::debug("Flavor [" . $flavor->getFlavorParamsId() . "] is ingested source");
$sourceIncludedInProfile = true;
continue;
}
$flavorParams = assetParamsPeer::retrieveByPK($flavor->getFlavorParamsId());
if ($flavorParams instanceof liveParams || $flavor->getOrigin() == assetParamsOrigin::INGEST) {
KalturaLog::debug("Flavor [" . $flavor->getFlavorParamsId() . "] should be ingested");
continue;
}
if ($flavor->getOrigin() == assetParamsOrigin::CONVERT_WHEN_MISSING) {
$siblingFlavorAsset = assetPeer::retrieveByEntryIdAndParams($entry->getId(), $flavor->getFlavorParamsId());
if ($siblingFlavorAsset) {
KalturaLog::debug("Flavor [" . $flavor->getFlavorParamsId() . "] already ingested");
continue;
}
}
$sourceFileRequiredStorages[] = $flavorParams->getSourceRemoteStorageProfileId();
$conversionRequired = true;
break;
}
if ($conversionRequired) {
foreach ($sourceFileRequiredStorages as $storageId) {
if ($storageId == StorageProfile::STORAGE_KALTURA_DC) {
$key = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
list($syncFile, $local) = kFileSyncUtils::getReadyFileSyncForKey($key, true, false);
if ($syncFile && $syncFile->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL && $partner && $partner->getImportRemoteSourceForConvert()) {
KalturaLog::debug("Creates import job for remote file sync");
$url = $syncFile->getExternalUrl($entry->getId());
kJobsManager::addImportJob($parentJob, $entry->getId(), $partner->getId(), $url, $flavorAsset, null, null, true);
$importingSources = true;
continue;
}
} elseif ($flavorAsset->getExternalUrl($storageId)) {
continue;
}
kBatchManager::updateEntry($entry->getId(), entryStatus::ERROR_CONVERTING);
$flavorAsset = assetPeer::retrieveById($flavorAssetId);
$flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
$flavorAsset->setDescription('Entry of size 0 should not be converted');
$flavorAsset->save();
KalturaLog::err('Entry of size 0 should not be converted');
return null;
}
} else {
if ($flavorAsset->getStatus() == asset::FLAVOR_ASSET_STATUS_QUEUED) {
if ($sourceIncludedInProfile) {
$flavorAsset->setStatusLocalReady();
} else {
$flavorAsset->setStatus(asset::FLAVOR_ASSET_STATUS_DELETED);
$flavorAsset->setDeletedAt(time());
}
$flavorAsset->save();
if ($sourceIncludedInProfile) {
kBusinessPostConvertDL::handleConvertFinished(null, $flavorAsset);
}
}
return null;
}
}
if ($entry->getStatus() != entryStatus::READY) {
$entry->setStatus(entryStatus::PRECONVERT);
}
$jobData = new kConvertProfileJobData();
$jobData->setFlavorAssetId($flavorAssetId);
$jobData->setInputFileSyncLocalPath($inputFileSyncLocalPath);
$jobData->setExtractMedia(true);
//.........这里部分代码省略.........
示例5: calcStorageSize
public static function calcStorageSize(entry $entry)
{
if ($entry->getStatus() == entryStatus::DELETED) {
return 0;
}
$size = 0;
$entry_id = $entry->getId();
$entrySyncKeys = array($entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA), $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB), $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA_EDIT), $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ARCHIVE), $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DOWNLOAD), $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_OFFLINE_THUMB), $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM), $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC), $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_CONVERSION_LOG));
$flavorAssets = flavorAssetPeer::retrieveByEntryId($entry_id);
foreach ($flavorAssets as $flavorAsset) {
$entrySyncKeys[] = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$entrySyncKeys[] = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG);
}
foreach ($entrySyncKeys as $syncKey) {
$fileSync = kFileSyncUtils::getOriginFileSyncForKey($syncKey, false);
if (!$fileSync || $fileSync->getStatus() != FileSync::FILE_SYNC_STATUS_READY) {
continue;
}
$fileSize = $fileSync->getFileSize();
if ($fileSize > 0) {
$size += $fileSize;
}
}
return $size;
}
示例6: initEntry
protected function initEntry()
{
$this->entryId = $this->getRequestParameter("entryId", null);
// look for a valid token
$expiry = $this->getRequestParameter("expiry");
if ($expiry && $expiry <= time()) {
KExternalErrors::dieError(KExternalErrors::EXPIRED_TOKEN);
}
$urlToken = $this->getRequestParameter("kt");
if ($urlToken) {
if ($_SERVER["REQUEST_METHOD"] != "GET" || !self::validateKalturaToken($_SERVER["REQUEST_URI"], $urlToken)) {
KExternalErrors::dieError(KExternalErrors::INVALID_TOKEN);
}
}
// initalize the context
$ksStr = $this->getRequestParameter("ks");
if ($ksStr && !$urlToken) {
try {
kCurrentContext::initKsPartnerUser($ksStr);
} catch (Exception $ex) {
KExternalErrors::dieError(KExternalErrors::INVALID_KS);
}
} else {
$this->entry = kCurrentContext::initPartnerByEntryId($this->entryId);
if (!$this->entry || $this->entry->getStatus() == entryStatus::DELETED) {
KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND);
}
}
// no need for any further check if a token was used
if ($urlToken) {
return;
}
// enforce entitlement
kEntitlementUtils::initEntitlementEnforcement();
if (!$this->entry) {
$this->entry = entryPeer::retrieveByPKNoFilter($this->entryId);
if (!$this->entry || $this->entry->getStatus() == entryStatus::DELETED) {
KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND);
}
} else {
if (!kEntitlementUtils::isEntryEntitled($this->entry)) {
KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND);
}
}
// enforce access control
$base64Referrer = $this->getRequestParameter("referrer");
// replace space in the base64 string with + as space is invalid in base64 strings and caused
// by symfony calling str_parse to replace + with spaces.
// this happens only with params passed in the url path and not the query strings. specifically the ~ char at
// a columns divided by 3 causes this issue (e.g. http://www.xyzw.com/~xxx)
$referrer = base64_decode(str_replace(" ", "+", $base64Referrer));
if (!is_string($referrer)) {
$referrer = "";
}
// base64_decode can return binary data
$this->secureEntryHelper = new KSecureEntryHelper($this->entry, $ksStr, $referrer, accessControlContextType::PLAY);
if ($this->secureEntryHelper->shouldPreview()) {
$this->clipTo = $this->secureEntryHelper->getPreviewLength() * 1000;
} else {
$this->secureEntryHelper->validateForPlay();
}
}
示例7: validateConversionProfile
public function validateConversionProfile(entry $sourceObject = null)
{
if (is_null($this->conversionProfileId)) {
return;
}
if ($sourceObject && $sourceObject->getStatus() != entryStatus::NO_CONTENT) {
throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_ENTRY_STATUS, $this->getFormattedPropertyNameWithClassName('conversionProfileId'), $sourceObject->getStatus());
}
if ($this->conversionProfileId != conversionProfile2::CONVERSION_PROFILE_NONE) {
$conversionProfile = conversionProfile2Peer::retrieveByPK($this->conversionProfileId);
if (!$conversionProfile || $conversionProfile->getType() != ConversionProfileType::MEDIA) {
throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $this->conversionProfileId);
}
}
}
示例8: createNotificationBulkDownloadSucceeded
private static function createNotificationBulkDownloadSucceeded(BatchJob $dbBatchJob, entry $entry, flavorAsset $flavorAsset, FileSyncKey $syncKey)
{
$localPath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
$downloadUrl = $flavorAsset->getDownloadUrl();
$notificationData = array("puserId" => $entry->getPuserId(), "entryId" => $entry->getId(), "entryIntId" => $entry->getIntId(), "entryVersion" => $entry->getVersion(), "fileFormat" => $flavorAsset->getFileExt(), "archivedFile" => $localPath, "downoladPath" => $localPath, "conversionQuality" => $entry->getConversionQuality(), "downloadUrl" => $downloadUrl);
$extraData = array("data" => json_encode($notificationData), "partner_id" => $entry->getPartnerId(), "puser_id" => $entry->getPuserId(), "entry_id" => $entry->getId(), "entry_int_id" => $entry->getIntId(), "entry_version" => $entry->getVersion(), "file_format" => $flavorAsset->getFileExt(), "archived_file" => $localPath, "downolad_path" => $localPath, "target" => $localPath, "conversion_quality" => $entry->getConversionQuality(), "download_url" => $downloadUrl, "status" => $entry->getStatus(), "abort" => $dbBatchJob->getExecutionStatus() == BatchJobExecutionStatus::ABORTED, "message" => $dbBatchJob->getMessage(), "description" => $dbBatchJob->getDescription(), "job_type" => BatchJobType::DOWNLOAD, "status" => BatchJob::BATCHJOB_STATUS_FINISHED, "progress" => 100, "debug" => __LINE__);
myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_BATCH_JOB_SUCCEEDED, $dbBatchJob, $dbBatchJob->getPartnerId(), null, null, $extraData, $dbBatchJob->getEntryId());
}
示例9: validateEntryForRestoreDelete
protected function validateEntryForRestoreDelete(entry $entry, array $fileSyncs, array $assets)
{
if ($entry->getStatus() != entryStatus::DELETED) {
return false;
}
foreach ($fileSyncs as $fileSync) {
if ($fileSync->getStatus() != FileSync::FILE_SYNC_STATUS_DELETED) {
return false;
}
}
foreach ($assets as $asset) {
if ($asset->getStatus() != asset::ASSET_STATUS_DELETED) {
return false;
}
}
return true;
}
示例10: getEntryMrssXml
/**
* @param entry $entry
* @param SimpleXMLElement $mrss
* @param kMrssParameters $mrssParams
* @return SimpleXMLElement
*/
public static function getEntryMrssXml(entry $entry, SimpleXMLElement $mrss = null, kMrssParameters $mrssParams = null)
{
if ($mrss === null) {
$mrss = new SimpleXMLElement('<item/>');
}
$mrss->addChild('entryId', $entry->getId());
if ($entry->getReferenceID()) {
$mrss->addChild('referenceID', $entry->getReferenceID());
}
$mrss->addChild('createdAt', $entry->getCreatedAt(null));
$mrss->addChild('updatedAt', $entry->getUpdatedAt(null));
$mrss->addChild('title', self::stringToSafeXml($entry->getName()));
if ($mrssParams && !is_null($mrssParams->getLink())) {
$mrss->addChild('link', $mrssParams->getLink() . $entry->getId());
}
$mrss->addChild('type', $entry->getType());
$mrss->addChild('licenseType', $entry->getLicenseType());
$mrss->addChild('userId', $entry->getPuserId(true));
$mrss->addChild('name', self::stringToSafeXml($entry->getName()));
$mrss->addChild('status', self::stringToSafeXml($entry->getStatus()));
$mrss->addChild('description', self::stringToSafeXml($entry->getDescription()));
$thumbnailUrl = $mrss->addChild('thumbnailUrl');
$thumbnailUrl->addAttribute('url', $entry->getThumbnailUrl());
if (trim($entry->getTags(), " \r\n\t")) {
$tags = $mrss->addChild('tags');
foreach (explode(',', $entry->getTags()) as $tag) {
$tags->addChild('tag', self::stringToSafeXml($tag));
}
}
$categories = explode(',', $entry->getCategories());
foreach ($categories as $category) {
$category = trim($category);
if ($category) {
$categoryNode = $mrss->addChild('category', self::stringToSafeXml($category));
if (strrpos($category, '>') > 0) {
$categoryNode->addAttribute('name', self::stringToSafeXml(substr($category, strrpos($category, '>') + 1)));
} else {
$categoryNode->addAttribute('name', self::stringToSafeXml($category));
}
}
}
$mrss->addChild('partnerData', self::stringToSafeXml($entry->getPartnerData()));
if ($entry->getAccessControlId()) {
$mrss->addChild('accessControlId', $entry->getAccessControlId());
}
if ($entry->getConversionProfileId()) {
$mrss->addChild('conversionProfileId', $entry->getConversionProfileId());
}
if ($entry->getStartDate(null)) {
$mrss->addChild('startDate', $entry->getStartDate(null));
}
if ($entry->getEndDate(null)) {
$mrss->addChild('endDate', $entry->getEndDate(null));
}
switch ($entry->getType()) {
case entryType::MEDIA_CLIP:
self::appendMediaEntryMrss($entry, $mrss);
break;
case entryType::MIX:
self::appendMixEntryMrss($entry, $mrss);
break;
case entryType::PLAYLIST:
self::appendPlaylistEntryMrss($entry, $mrss);
break;
case entryType::DATA:
self::appendDataEntryMrss($entry, $mrss);
break;
case entryType::LIVE_STREAM:
self::appendLiveStreamEntryMrss($entry, $mrss);
break;
default:
break;
}
$assets = assetPeer::retrieveReadyByEntryId($entry->getId());
foreach ($assets as $asset) {
if ($mrssParams && !is_null($mrssParams->getFilterByFlavorParams()) && $asset->getFlavorParamsId() != $mrssParams->getFilterByFlavorParams()) {
continue;
}
if ($asset instanceof flavorAsset) {
self::appendFlavorAssetMrss($asset, $mrss, $mrssParams);
}
if ($asset instanceof thumbAsset) {
self::appendThumbAssetMrss($asset, $mrss);
}
}
$mrssContributors = self::getMrssContributors();
if (count($mrssContributors)) {
foreach ($mrssContributors as $mrssContributor) {
$mrssContributor->contribute($entry, $mrss, $mrssParams);
}
}
if ($mrssParams && $mrssParams->getIncludePlayerTag()) {
$uiconfId = !is_null($mrssParams->getPlayerUiconfId()) ? '/ui_conf_id/' . $mrssParams->getPlayerUiconfId() : '';
$playerUrl = 'http://' . kConf::get('www_host') . '/kwidget/wid/_' . $entry->getPartnerId() . '/entry_id/' . $entry->getId() . '/ui_conf' . ($uiconfId ? "/{$uiconfId}" : '');
//.........这里部分代码省略.........
示例11: getEntryMrssXml
/**
* @param entry $entry
* @param SimpleXMLElement $mrss
* @param kMrssParameters $mrssParams
* @params string $features
* @return SimpleXMLElement
*/
public static function getEntryMrssXml(entry $entry, SimpleXMLElement $mrss = null, kMrssParameters $mrssParams = null, $features = null)
{
$instanceKey = self::generateInstanceKey($entry->getId(), $mrssParams, $features);
if (is_null($mrss)) {
$mrss = self::getInstanceFromPool($instanceKey);
if ($mrss) {
return $mrss;
}
$encoding = 'UTF-8';
if ($mrssParams && !is_null($mrssParams->getEncoding())) {
$encoding = $mrssParams->getEncoding();
}
if ($encoding) {
$mrss = new SimpleXMLElement('<?xml version="1.0" encoding="' . $encoding . '"?><item/>');
} else {
$mrss = new SimpleXMLElement('<item/>');
}
}
$mrss->addChild('entryId', $entry->getId());
if ($entry->getReferenceID()) {
$mrss->addChild('referenceID', self::stringToSafeXml($entry->getReferenceID()));
}
$mrss->addChild('createdAt', $entry->getCreatedAt(null));
$mrss->addChild('updatedAt', $entry->getUpdatedAt(null));
$mrss->addChild('title', self::stringToSafeXml($entry->getName()));
if ($mrssParams && !is_null($mrssParams->getLink())) {
$mrss->addChild('link', $mrssParams->getLink() . $entry->getId());
}
$mrss->addChild('type', $entry->getType());
$mrss->addChild('licenseType', $entry->getLicenseType());
$mrss->addChild('userId', $entry->getPuserId());
$mrss->addChild('name', self::stringToSafeXml($entry->getName()));
$mrss->addChild('status', self::stringToSafeXml($entry->getStatus()));
$mrss->addChild('description', self::stringToSafeXml($entry->getDescription()));
$thumbnailUrl = $mrss->addChild('thumbnailUrl');
$thumbnailUrl->addAttribute('url', $entry->getThumbnailUrl());
if (trim($entry->getTags(), " \r\n\t")) {
$tags = $mrss->addChild('tags');
foreach (explode(',', $entry->getTags()) as $tag) {
$tags->addChild('tag', self::stringToSafeXml($tag));
}
}
$categories = explode(',', $entry->getCategories());
if (count($features) && in_array(ObjectFeatureType::CATEGORY_ENTRIES, $features)) {
$partner = PartnerPeer::retrieveByPK(kCurrentContext::getCurrentPartnerId());
$partnerEntitlement = $partner->getDefaultEntitlementEnforcement();
kEntitlementUtils::initEntitlementEnforcement($partner->getId(), false);
$categories = array();
$categoryEntries = categoryEntryPeer::retrieveActiveByEntryId($entry->getId());
$categoryIds = array();
foreach ($categoryEntries as $categoryEntry) {
$categoryIds[] = $categoryEntry->getCategoryId();
}
$entryCats = categoryPeer::retrieveByPKs($categoryIds);
foreach ($entryCats as $entryCat) {
$categories[] = $entryCat->getFullName();
}
if ($partnerEntitlement) {
kEntitlementUtils::initEntitlementEnforcement($partner->getId(), true);
}
$keyToDelete = array_search(ObjectFeatureType::CATEGORY_ENTRIES, $features);
unset($features[$keyToDelete]);
}
foreach ($categories as $category) {
$category = trim($category);
if ($category) {
$categoryNode = $mrss->addChild('category', self::stringToSafeXml($category));
if (strrpos($category, '>') > 0) {
$categoryNode->addAttribute('name', self::stringToSafeXml(substr($category, strrpos($category, '>') + 1)));
} else {
$categoryNode->addAttribute('name', self::stringToSafeXml($category));
}
}
}
$mrss->addChild('partnerData', self::stringToSafeXml($entry->getPartnerData()));
if ($entry->getAccessControlId()) {
$mrss->addChild('accessControlId', $entry->getAccessControlId());
}
if ($entry->getConversionProfileId()) {
$mrss->addChild('conversionProfileId', $entry->getConversionProfileId());
}
if ($entry->getStartDate(null)) {
$mrss->addChild('startDate', $entry->getStartDate(null));
}
if ($entry->getEndDate(null)) {
$mrss->addChild('endDate', $entry->getEndDate(null));
}
switch ($entry->getType()) {
case entryType::MEDIA_CLIP:
self::appendMediaEntryMrss($entry, $mrss);
break;
case entryType::MIX:
self::appendMixEntryMrss($entry, $mrss);
//.........这里部分代码省略.........
示例12: replaceResource
/**
* @param KalturaResource $resource
* @param entry $dbEntry
* @param int $conversionProfileId
*/
protected function replaceResource(KalturaResource $resource, entry $dbEntry, $conversionProfileId = null, $advancedOptions = null)
{
if ($advancedOptions) {
$dbEntry->setReplacementOptions($advancedOptions->toObject());
$dbEntry->save();
}
if ($dbEntry->getStatus() == KalturaEntryStatus::NO_CONTENT || $dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
$resource->validateEntry($dbEntry);
if ($conversionProfileId) {
$dbEntry->setConversionQuality($conversionProfileId);
$dbEntry->save();
}
$kResource = $resource->toObject();
$this->attachResource($kResource, $dbEntry);
} else {
$kResource = $resource->toObject();
if ($kResource instanceof kOperationResource && $this->isResourceKClip($kResource)) {
$internalResource = $kResource->getResource();
if ($dbEntry->getIsTrimDisabled() && $internalResource instanceof kFileSyncResource && $dbEntry->getId() == $internalResource->getOriginEntryId()) {
throw new KalturaAPIException(KalturaErrors::ENTRY_CANNOT_BE_TRIMMED);
}
}
$tempMediaEntry = new KalturaMediaEntry();
$tempMediaEntry->type = $dbEntry->getType();
$tempMediaEntry->mediaType = $dbEntry->getMediaType();
if (!$conversionProfileId) {
$originalConversionProfileId = $dbEntry->getConversionQuality();
$conversionProfile = conversionProfile2Peer::retrieveByPK($originalConversionProfileId);
if (is_null($conversionProfile) || $conversionProfile->getType() != ConversionProfileType::MEDIA) {
$defaultConversionProfile = myPartnerUtils::getConversionProfile2ForPartner($this->getPartnerId());
if (!is_null($defaultConversionProfile)) {
$conversionProfileId = $defaultConversionProfile->getId();
}
} else {
$conversionProfileId = $originalConversionProfileId;
}
}
if ($conversionProfileId) {
$tempMediaEntry->conversionProfileId = $conversionProfileId;
}
$this->replaceResourceByEntry($dbEntry, $resource, $tempMediaEntry);
}
$resource->entryHandled($dbEntry);
}
示例13: reExportEntry
/**
* for each storage profile check if it still fulfills the export rules and decide if it should be exported or deleted
*
* @param entry $entry
*
*/
public static function reExportEntry(entry $entry)
{
if (!PermissionPeer::isValidForPartner(PermissionName::FEATURE_REMOTE_STORAGE_RULE, $entry->getPartnerId())) {
return;
}
if ($entry->getStatus() == entryStatus::NO_CONTENT) {
return;
}
$storageProfiles = StorageProfilePeer::retrieveExternalByPartnerId($entry->getPartnerId());
foreach ($storageProfiles as $profile) {
/* @var $profile StorageProfile */
KalturaLog::debug('Checking entry [' . $entry->getId() . ']re-export to storage [' . $profile->getId() . ']');
$scope = $profile->getScope();
$scope->setEntryId($entry->getId());
if ($profile->triggerFitsReadyAsset($entry->getId()) && $profile->fulfillsRules($scope)) {
self::tryExportEntry($entry, $profile);
} else {
self::deleteExportedEntry($entry, $profile);
}
}
}
示例14: replaceResource
/**
* @param KalturaResource $resource
* @param entry $dbEntry
* @param int $conversionProfileId
*/
protected function replaceResource(KalturaResource $resource, entry $dbEntry, $conversionProfileId = null)
{
if (!$this->getPartner()->getWamsAccountName() || !$this->getPartner()->getWamsAccountKey()) {
exit;
}
if ($dbEntry->getStatus() == KalturaEntryStatus::NO_CONTENT || $dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
$resource->validateEntry($dbEntry);
if ($conversionProfileId) {
$dbEntry->setConversionQuality($conversionProfileId);
$dbEntry->save();
}
$kResource = $resource->toObject();
$this->attachResource($kResource, $dbEntry);
} else {
$partner = $this->getPartner();
if (!$partner->getEnabledService(PermissionName::FEATURE_ENTRY_REPLACEMENT)) {
KalturaLog::notice("Replacement is not allowed to the partner permission [FEATURE_ENTRY_REPLACEMENT] is needed");
throw new KalturaAPIException(KalturaErrors::FEATURE_FORBIDDEN, PermissionName::FEATURE_ENTRY_REPLACEMENT);
}
if ($dbEntry->getReplacingEntryId()) {
throw new KalturaAPIException(KalturaErrors::ENTRY_REPLACEMENT_ALREADY_EXISTS);
}
$resource->validateEntry($dbEntry);
$tempMediaEntry = new KalturaMediaEntry();
$tempMediaEntry->type = $dbEntry->getType();
$tempMediaEntry->mediaType = $dbEntry->getMediaType();
$tempMediaEntry->conversionProfileId = $dbEntry->getConversionQuality();
if ($conversionProfileId) {
$tempMediaEntry->conversionProfileId = $conversionProfileId;
}
$tempDbEntry = $this->prepareEntryForInsert($tempMediaEntry);
$tempDbEntry->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM);
$tempDbEntry->setPartnerId($dbEntry->getPartnerId());
$tempDbEntry->setReplacedEntryId($dbEntry->getId());
$tempDbEntry->save();
$dbEntry->setReplacingEntryId($tempDbEntry->getId());
$dbEntry->setReplacementStatus(entryReplacementStatus::NOT_READY_AND_NOT_APPROVED);
if (!$partner->getEnabledService(PermissionName::FEATURE_ENTRY_REPLACEMENT_APPROVAL)) {
$dbEntry->setReplacementStatus(entryReplacementStatus::APPROVED_BUT_NOT_READY);
}
$dbEntry->save();
$kResource = $resource->toObject();
$this->attachResource($kResource, $tempDbEntry);
}
$resource->entryHandled($dbEntry);
}
示例15: replaceResource
/**
* @param KalturaResource $resource
* @param entry $dbEntry
* @param int $conversionProfileId
*/
protected function replaceResource(KalturaResource $resource, entry $dbEntry, $conversionProfileId = null, $advancedOptions = null)
{
if ($advancedOptions) {
$dbEntry->setReplacementOptions($advancedOptions->toObject());
$dbEntry->save();
}
if ($dbEntry->getStatus() == KalturaEntryStatus::NO_CONTENT || $dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
$resource->validateEntry($dbEntry);
if ($conversionProfileId) {
$dbEntry->setConversionQuality($conversionProfileId);
$dbEntry->save();
}
$kResource = $resource->toObject();
$this->attachResource($kResource, $dbEntry);
} else {
$tempMediaEntry = new KalturaMediaEntry();
$tempMediaEntry->type = $dbEntry->getType();
$tempMediaEntry->mediaType = $dbEntry->getMediaType();
if (!$conversionProfileId) {
$originalConversionProfileId = $dbEntry->getConversionQuality();
$conversionProfile = conversionProfile2Peer::retrieveByPK($originalConversionProfileId);
if (is_null($conversionProfile) || $conversionProfile->getType() != ConversionProfileType::MEDIA) {
$defaultConversionProfile = myPartnerUtils::getConversionProfile2ForPartner($this->getPartnerId());
if (!is_null($defaultConversionProfile)) {
$conversionProfileId = $defaultConversionProfile->getId();
}
} else {
$conversionProfileId = $originalConversionProfileId;
}
}
if ($conversionProfileId) {
$tempMediaEntry->conversionProfileId = $conversionProfileId;
}
$this->replaceResourceByEntry($dbEntry, $resource, $tempMediaEntry);
}
$resource->entryHandled($dbEntry);
}