本文整理汇总了PHP中kPluginableEnumsManager类的典型用法代码示例。如果您正苦于以下问题:PHP kPluginableEnumsManager类的具体用法?PHP kPluginableEnumsManager怎么用?PHP kPluginableEnumsManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了kPluginableEnumsManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getExcludeFileSyncMap
function getExcludeFileSyncMap()
{
$result = array();
$dcConfig = kConf::getMap("dc_config");
if (isset($dcConfig['sync_exclude_types'])) {
foreach ($dcConfig['sync_exclude_types'] as $syncExcludeType) {
$configObjectType = $syncExcludeType;
$configObjectSubType = null;
if (strpos($syncExcludeType, ':') > 0) {
list($configObjectType, $configObjectSubType) = explode(':', $syncExcludeType, 2);
}
// translate api dynamic enum, such as contentDistribution.EntryDistribution - {plugin name}.{object name}
if (!is_numeric($configObjectType)) {
$configObjectType = kPluginableEnumsManager::apiToCore('FileSyncObjectType', $configObjectType);
}
// translate api dynamic enum, including the enum type, such as conversionEngineType.mp4box.Mp4box - {enum class name}.{plugin name}.{object name}
if (!is_null($configObjectSubType) && !is_numeric($configObjectSubType)) {
list($enumType, $configObjectSubType) = explode('.', $configObjectSubType);
$configObjectSubType = kPluginableEnumsManager::apiToCore($enumType, $configObjectSubType);
}
if (!isset($result[$configObjectType])) {
$result[$configObjectType] = array();
}
if (!is_null($configObjectSubType)) {
$result[$configObjectType][] = $configObjectSubType;
}
}
}
return $result;
}
示例2: getData
public function getData(kHttpNotificationDispatchJobData $jobData = null)
{
$coreObject = unserialize($this->coreObject);
$apiObject = new $this->apiObjectType();
/* @var $apiObject KalturaObject */
$apiObject->fromObject($coreObject);
$httpNotificationTemplate = EventNotificationTemplatePeer::retrieveByPK($jobData->getTemplateId());
$notification = new KalturaHttpNotification();
$notification->object = $apiObject;
$notification->eventObjectType = kPluginableEnumsManager::coreToApi('EventNotificationEventObjectType', $httpNotificationTemplate->getObjectType());
$notification->eventNotificationJobId = $jobData->getJobId();
$notification->templateId = $httpNotificationTemplate->getId();
$notification->templateName = $httpNotificationTemplate->getName();
$notification->templateSystemName = $httpNotificationTemplate->getSystemName();
$notification->eventType = $httpNotificationTemplate->getEventType();
$data = '';
switch ($this->format) {
case KalturaResponseType::RESPONSE_TYPE_XML:
$serializer = new KalturaXmlSerializer($this->ignoreNull);
$data = '<notification>' . $serializer->serialize($notification) . '</notification>';
break;
case KalturaResponseType::RESPONSE_TYPE_PHP:
$serializer = new KalturaPhpSerializer($this->ignoreNull);
$data = $serializer->serialize($notification);
break;
case KalturaResponseType::RESPONSE_TYPE_JSON:
$serializer = new KalturaJsonSerializer($this->ignoreNull);
$data = $serializer->serialize($notification);
break;
}
return "data={$data}";
}
示例3: cloneAction
/**
* Allows you to clone exiting event notification template object and create a new one with similar configuration
*
* @action clone
* @param int $id source template to clone
* @param KalturaEventNotificationTemplate $eventNotificationTemplate overwrite configuration object
* @throws KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_NOT_FOUND
* @throws KalturaEventNotificationErrors::EVENT_NOTIFICATION_WRONG_TYPE
* @throws KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_DUPLICATE_SYSTEM_NAME
* @return KalturaEventNotificationTemplate
*/
public function cloneAction($id, KalturaEventNotificationTemplate $eventNotificationTemplate = null)
{
// get the source object
$dbEventNotificationTemplate = EventNotificationTemplatePeer::retrieveByPK($id);
if (!$dbEventNotificationTemplate) {
throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_NOT_FOUND, $id);
}
// copy into new db object
$newDbEventNotificationTemplate = $dbEventNotificationTemplate->copy();
// init new Kaltura object
$newEventNotificationTemplate = KalturaEventNotificationTemplate::getInstanceByType($newDbEventNotificationTemplate->getType());
$templateClass = get_class($newEventNotificationTemplate);
if ($eventNotificationTemplate && get_class($eventNotificationTemplate) != $templateClass && !is_subclass_of($eventNotificationTemplate, $templateClass)) {
throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_WRONG_TYPE, $id, kPluginableEnumsManager::coreToApi('EventNotificationTemplateType', $dbEventNotificationTemplate->getType()));
}
if ($eventNotificationTemplate) {
// update new db object with the overwrite configuration
$newDbEventNotificationTemplate = $eventNotificationTemplate->toUpdatableObject($newDbEventNotificationTemplate);
}
//Check uniqueness of new object's system name
$systemNameTemplates = EventNotificationTemplatePeer::retrieveBySystemName($newDbEventNotificationTemplate->getSystemName());
if (count($systemNameTemplates)) {
throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_DUPLICATE_SYSTEM_NAME, $newDbEventNotificationTemplate->getSystemName());
}
// save the new db object
$newDbEventNotificationTemplate->setPartnerId($this->getPartnerId());
$newDbEventNotificationTemplate->save();
// return the saved object
$newEventNotificationTemplate = KalturaEventNotificationTemplate::getInstanceByType($newDbEventNotificationTemplate->getType());
$newEventNotificationTemplate->fromObject($newDbEventNotificationTemplate, $this->getResponseProfile());
return $newEventNotificationTemplate;
}
示例4: getExclusiveJobs
protected function getExclusiveJobs(KalturaExclusiveLockKey $lockKey, $maxExecutionTime, $numberOfJobs, KalturaBatchJobFilter $filter = null, $jobType, $maxOffset = null)
{
$dbJobType = kPluginableEnumsManager::apiToCore('BatchJobType', $jobType);
if (!is_null($filter)) {
$jobsFilter = $filter->toFilter($dbJobType);
}
return kBatchExclusiveLock::getExclusiveJobs($lockKey->toObject(), $maxExecutionTime, $numberOfJobs, $dbJobType, $jobsFilter, $maxOffset);
}
示例5: dispatchAction
/**
* Dispatch integration task
*
* @action dispatch
* @param KalturaIntegrationJobData $data
* @param KalturaBatchJobObjectType $objectType
* @param string $objectId
* @throws KalturaIntegrationErrors::INTEGRATION_DISPATCH_FAILED
* @return int
*/
public function dispatchAction(KalturaIntegrationJobData $data, $objectType, $objectId)
{
$jobData = $data->toObject();
$coreObjectType = kPluginableEnumsManager::apiToCore('BatchJobObjectType', $objectType);
$job = kIntegrationFlowManager::addintegrationJob($coreObjectType, $objectId, $jobData);
if (!$job) {
throw new KalturaAPIException(KalturaIntegrationErrors::INTEGRATION_DISPATCH_FAILED, $objectType);
}
return $job->getId();
}
示例6: getRetryInterval
public static function getRetryInterval($job_type = null)
{
$job_type = kPluginableEnumsManager::coreToApi('BatchJobType', $job_type);
$job_type = str_replace('.', '_', $job_type);
// in Zend_Ini . is used to create hierarchy
$jobCheckAgainTimeouts = kConf::get('job_retry_intervals');
if (isset($jobCheckAgainTimeouts[$job_type])) {
return $jobCheckAgainTimeouts[$job_type];
}
return kConf::get('default_job_retry_interval');
}
示例7: fromSubType
/**
* @param int $subType
* @return string
*/
public function fromSubType($subType)
{
switch ($subType) {
case DropFolderType::FTP:
case DropFolderType::SFTP:
case DropFolderType::SCP:
case DropFolderType::S3:
return $subType;
default:
return kPluginableEnumsManager::coreToApi('DropFolderType', $subType);
}
}
示例8: fromSubType
/**
* @param int $subType
* @return string
*/
public function fromSubType($subType)
{
switch ($subType) {
case StorageProfileProtocol::SFTP:
case StorageProfileProtocol::FTP:
case StorageProfileProtocol::SCP:
case StorageProfileProtocol::S3:
case StorageProfileProtocol::KALTURA_DC:
return $subType;
default:
return kPluginableEnumsManager::coreToApi('StorageProfileProtocol', $subType);
}
}
示例9: toObject
public function toObject($object_to_fill = null, $props_to_skip = array())
{
$dbFilter = parent::toObject($object_to_fill, $props_to_skip);
$jobTypeAndSubTypeIn = $this->jobTypeAndSubTypeIn;
if (is_null($this->jobTypeAndSubTypeIn)) {
return $dbFilter;
}
$finalTypesAndSubTypes = array();
$arr = explode(BatchJobFilter::JOB_TYPE_AND_SUB_TYPE_MAIN_DELIMITER, $this->jobTypeAndSubTypeIn);
foreach ($arr as $jobTypeIn) {
list($jobType, $jobSubTypes) = explode(BatchJobFilter::JOB_TYPE_AND_SUB_TYPE_TYPE_DELIMITER, $jobTypeIn);
$jobType = kPluginableEnumsManager::apiToCore('BatchJobType', $jobType);
$finalTypesAndSubTypes[] = $jobType . BatchJobFilter::JOB_TYPE_AND_SUB_TYPE_TYPE_DELIMITER . $jobSubTypes;
}
$jobTypeAndSubTypeIn = implode(BatchJobFilter::JOB_TYPE_AND_SUB_TYPE_MAIN_DELIMITER, $finalTypesAndSubTypes);
$dbFilter->set('_in_job_type_and_sub_type', $jobTypeAndSubTypeIn);
return $dbFilter;
}
示例10: purgeAssetFromEdgeCast
private static function purgeAssetFromEdgeCast(asset $asset)
{
// get partner
$partnerId = $asset->getPartnerId();
$partner = PartnerPeer::retrieveByPK($partnerId);
if (!$partner) {
KalturaLog::err('Cannot find partner with id [' . $partnerId . ']');
return false;
}
$mediaType = $asset instanceof thumbAsset ? self::EDGE_SERVICE_HTTP_SMALL_OBJECT_MEDIA_TYPE : self::EDGE_SERVICE_HTTP_LARGE_OBJECT_MEDIA_TYPE;
$mediaTypePathList = array();
try {
$mediaTypePathList[] = array('MediaType' => $mediaType, 'MediaPath' => $asset->getDownloadUrl());
// asset download url
} catch (Exception $e) {
KalturaLog::err('Cannot get asset URL for asset id [' . $asset->getId() . '] - ' . $e->getMessage());
}
if ($asset instanceof flavorAsset) {
// get a list of all URLs leading to the asset for purging
$subPartnerId = $asset->getentry()->getSubpId();
$partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subPartnerId);
$assetId = $asset->getId();
$serveFlavorUrl = "{$partnerPath}/serveFlavor/entryId/" . $asset->getEntryId() . "/flavorId/{$assetId}" . '*';
// * wildcard should delete all serveFlavor urls
$types = array(kPluginableEnumsManager::apiToCore(EdgeCastDeliveryProfileType::EDGE_CAST_HTTP), kPluginableEnumsManager::apiToCore(EdgeCastDeliveryProfileType::EDGE_CAST_RTMP));
$deliveryProfile = $partner->getDeliveryProfileIds();
$deliveryProfileIds = array();
foreach ($deliveryProfile as $key => $value) {
$deliveryProfileIds = array_merge($deliveryProfileIds, $value);
}
$c = new Criteria();
$c->add(DeliveryProfilePeer::PARTNER_ID, $partnerId);
$c->add(DeliveryProfilePeer::ID, $deliveryProfileIds, Criteria::IN);
$c->addSelectColumn(DeliveryProfilePeer::HOST_NAME);
$stmt = PermissionPeer::doSelectStmt($c);
$hosts = $stmt->fetchAll(PDO::FETCH_COLUMN);
foreach ($hosts as $host) {
if (!empty($host)) {
$mediaTypePathList[] = array('MediaType' => $mediaType, 'MediaPath' => $host . $serveFlavorUrl);
}
}
}
return self::purgeFromEdgeCast($mediaTypePathList, $partner);
}
示例11: shouldConsumeJobStatusEvent
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob)
{
$jobTypes = array(ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE));
if (!in_array($dbBatchJob->getJobType(), $jobTypes)) {
// wrong job type
return false;
}
$data = $dbBatchJob->getData();
if (!$data instanceof kDistributionJobData) {
KalturaLog::err('Wrong job data type');
return false;
}
$crossKalturaCoreValueType = kPluginableEnumsManager::apiToCore('DistributionProviderType', CrossKalturaDistributionPlugin::getApiValue(CrossKalturaDistributionProviderType::CROSS_KALTURA));
if ($data->getProviderType() == $crossKalturaCoreValueType) {
return true;
}
// not the right provider
return false;
}
示例12: addAction
/**
* Adds new live stream entry.
* The entry will be queued for provision.
*
* @action add
* @param KalturaLiveStreamAdminEntry $liveStreamEntry Live stream entry metadata
* @param KalturaSourceType $sourceType Live stream source type
* @return KalturaLiveStreamAdminEntry The new live stream entry
*
* @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL
*/
function addAction(KalturaLiveStreamAdminEntry $liveStreamEntry, $sourceType = null)
{
//TODO: allow sourceType that belongs to LIVE entries only - same for mediaType
if ($sourceType) {
$liveStreamEntry->sourceType = $sourceType;
} else {
// default sourceType is AKAMAI_LIVE
$liveStreamEntry->sourceType = kPluginableEnumsManager::coreToApi('EntrySourceType', $this->getPartner()->getDefaultLiveStreamEntrySourceType());
}
// if the given password is empty, generate a random 8-character string as the new password
if ($liveStreamEntry->streamPassword == null || strlen(trim($liveStreamEntry->streamPassword)) <= 0) {
$tempPassword = sha1(md5(uniqid(rand(), true)));
$liveStreamEntry->streamPassword = substr($tempPassword, rand(0, strlen($tempPassword) - 8), 8);
}
// if no bitrate given, add default
if (is_null($liveStreamEntry->bitrates) || !$liveStreamEntry->bitrates->count) {
$liveStreamBitrate = new KalturaLiveStreamBitrate();
$liveStreamBitrate->bitrate = self::DEFAULT_BITRATE;
$liveStreamBitrate->width = self::DEFAULT_WIDTH;
$liveStreamBitrate->height = self::DEFAULT_HEIGHT;
$liveStreamEntry->bitrates = new KalturaLiveStreamBitrateArray();
$liveStreamEntry->bitrates[] = $liveStreamBitrate;
} else {
$bitrates = new KalturaLiveStreamBitrateArray();
foreach ($liveStreamEntry->bitrates as $bitrate) {
if (is_null($bitrate->bitrate)) {
$bitrate->bitrate = self::DEFAULT_BITRATE;
}
if (is_null($bitrate->width)) {
$bitrate->bitrate = self::DEFAULT_WIDTH;
}
if (is_null($bitrate->height)) {
$bitrate->bitrate = self::DEFAULT_HEIGHT;
}
$bitrates[] = $bitrate;
}
$liveStreamEntry->bitrates = $bitrates;
}
$dbEntry = $this->insertLiveStreamEntry($liveStreamEntry);
myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry, $this->getPartnerId(), null, null, null, $dbEntry->getId());
$liveStreamEntry->fromObject($dbEntry);
return $liveStreamEntry;
}
示例13: updatedJob
public function updatedJob(BatchJob $dbBatchJob, BatchJob $twinJob = null)
{
$data = $dbBatchJob->getData();
if (!$data instanceof kDistributionJobData) {
return true;
}
$attUverseCoreValueType = kPluginableEnumsManager::apiToCore('DistributionProviderType', AttUverseDistributionPlugin::getApiValue(AttUverseDistributionProviderType::ATT_UVERSE));
if ($data->getProviderType() != $attUverseCoreValueType) {
return true;
}
$jobTypesToFinish = array(ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE));
if (in_array($dbBatchJob->getJobType(), $jobTypesToFinish) && $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_FINISHED) {
return self::onDistributionJobFinished($dbBatchJob, $data, $twinJob);
}
if ($dbBatchJob->getJobType() == ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE) && $dbBatchJob->getStatus() == BatchJob::BATCHJOB_STATUS_PENDING) {
kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED);
}
return true;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:19,代码来源:kAttUverseDistributionEventConsumer.php
示例14: addAction
/**
* Add new Distribution Profile
*
* @action add
* @param KalturaDistributionProfile $distributionProfile
* @return KalturaDistributionProfile
* @throws ContentDistributionErrors::DISTRIBUTION_PROVIDER_NOT_FOUND
*/
function addAction(KalturaDistributionProfile $distributionProfile)
{
$distributionProfile->validatePropertyMinLength("name", 1);
$distributionProfile->validatePropertyNotNull("providerType");
if (is_null($distributionProfile->status)) {
$distributionProfile->status = KalturaDistributionProfileStatus::DISABLED;
}
$providerType = kPluginableEnumsManager::apiToCore('DistributionProviderType', $distributionProfile->providerType);
$dbDistributionProfile = DistributionProfilePeer::createDistributionProfile($providerType);
if (!$dbDistributionProfile) {
throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROVIDER_NOT_FOUND, $distributionProfile->providerType);
}
$distributionProfile->toInsertableObject($dbDistributionProfile);
$dbDistributionProfile->setPartnerId($this->impersonatedPartnerId);
$dbDistributionProfile->save();
$distributionProfile = KalturaDistributionProfileFactory::createKalturaDistributionProfile($dbDistributionProfile->getProviderType());
$distributionProfile->fromObject($dbDistributionProfile);
return $distributionProfile;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:27,代码来源:DistributionProfileService.php
示例15: updatedJob
public function updatedJob(BatchJob $dbBatchJob)
{
$data = $dbBatchJob->getData();
if (!$data instanceof kDistributionJobData) {
return true;
}
$doubleClickCoreValueType = kPluginableEnumsManager::apiToCore('DistributionProviderType', DoubleClickDistributionPlugin::getApiValue(DoubleClickDistributionProviderType::DOUBLECLICK));
if ($data->getProviderType() != $doubleClickCoreValueType) {
return true;
}
if ($dbBatchJob->getStatus() != BatchJob::BATCHJOB_STATUS_PENDING) {
return true;
}
$jobTypesToFinish = array(ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_FETCH_REPORT), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_ENABLE), ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DISABLE));
if (in_array($dbBatchJob->getJobType(), $jobTypesToFinish)) {
kJobsManager::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED);
}
return true;
}