本文整理汇总了PHP中Partner::getDefaultConversionProfileId方法的典型用法代码示例。如果您正苦于以下问题:PHP Partner::getDefaultConversionProfileId方法的具体用法?PHP Partner::getDefaultConversionProfileId怎么用?PHP Partner::getDefaultConversionProfileId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Partner
的用法示例。
在下文中一共展示了Partner::getDefaultConversionProfileId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: constructJobData
/**
* Function constructs a core object of type kBulkUploadJobData
* @param int $conversionProfileId
* @param string $filePath
* @param string $userId
* @param int $bulkUploadType
* @param string $uploadedBy
* @param string $fileName
* @throws KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND
*/
protected function constructJobData($filePath, $fileName, Partner $partner, $puserId, $uploadedBy, $conversionProfileId = null, $coreBulkUploadType = null)
{
$data = KalturaPluginManager::loadObject('kBulkUploadJobData', $coreBulkUploadType);
if (is_null($data)) {
throw new KalturaAPIException(KalturaErrors::BULK_UPLOAD_BULK_UPLOAD_TYPE_NOT_VALID, $coreBulkUploadType);
}
$data->setFilePath($filePath);
$data->setUserId($puserId);
$data->setUploadedBy($uploadedBy);
$data->setFileName($fileName);
if (!$conversionProfileId) {
$conversionProfileId = $partner->getDefaultConversionProfileId();
}
$kmcVersion = $partner->getKmcVersion();
$check = null;
if ($kmcVersion < 2) {
$check = ConversionProfilePeer::retrieveByPK($conversionProfileId);
} else {
$check = conversionProfile2Peer::retrieveByPK($conversionProfileId);
}
if (!$check) {
throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId);
}
$objectData = new kBulkUploadEntryData();
$objectData->setConversionProfileId($conversionProfileId);
$data->setObjectData($objectData);
return $data;
}
示例2: copyConversionProfiles
public static function copyConversionProfiles(Partner $fromPartner, Partner $toPartner, $permissionRequiredOnly = false)
{
$copiedList = array();
KalturaLog::log("Copying conversion profiles from partner [" . $fromPartner->getId() . "] to partner [" . $toPartner->getId() . "]");
$c = new Criteria();
$c->add(conversionProfile2Peer::PARTNER_ID, $fromPartner->getId());
$conversionProfiles = conversionProfile2Peer::doSelect($c);
foreach ($conversionProfiles as $conversionProfile) {
/* @var $conversionProfile conversionProfile2 */
if ($permissionRequiredOnly && !count($conversionProfile->getRequiredCopyTemplatePermissions())) {
continue;
}
if (!self::isPartnerPermittedForCopy($toPartner, $conversionProfile->getRequiredCopyTemplatePermissions())) {
continue;
}
$newConversionProfile = $conversionProfile->copy();
$newConversionProfile->setPartnerId($toPartner->getId());
try {
$newConversionProfile->save();
} catch (Exception $e) {
KalturaLog::info("Exception occured, conversion profile was not copied. Message: [" . $e->getMessage() . "]");
continue;
}
KalturaLog::log("Copied [" . $conversionProfile->getId() . "], new id is [" . $newConversionProfile->getId() . "]");
$copiedList[$conversionProfile->getId()] = $newConversionProfile->getId();
$c = new Criteria();
$c->add(flavorParamsConversionProfilePeer::CONVERSION_PROFILE_ID, $conversionProfile->getId());
$fpcpList = flavorParamsConversionProfilePeer::doSelect($c);
foreach ($fpcpList as $fpcp) {
$flavorParamsId = $fpcp->getFlavorParamsId();
$flavorParams = assetParamsPeer::retrieveByPK($flavorParamsId);
if ($flavorParams && $flavorParams->getPartnerId() === 0) {
$newFpcp = $fpcp->copy();
$newFpcp->setConversionProfileId($newConversionProfile->getId());
$newFpcp->save();
}
}
}
// make sure conversion profile is set on the new partner in case it was missed/skiped in the conversionProfile2::copy method
if (!$toPartner->getDefaultConversionProfileId()) {
$fromPartnerDefaultProfile = $fromPartner->getDefaultConversionProfileId();
if ($fromPartnerDefaultProfile && key_exists($fromPartnerDefaultProfile, $copiedList)) {
$toPartner->setDefaultConversionProfileId($copiedList[$fromPartnerDefaultProfile]);
}
}
if (!$toPartner->getDefaultLiveConversionProfileId()) {
$fromPartnerDefaultLiveProfile = $fromPartner->getDefaultLiveConversionProfileId();
if ($fromPartnerDefaultLiveProfile && key_exists($fromPartnerDefaultLiveProfile, $copiedList)) {
$toPartner->setDefaultLiveConversionProfileId($copiedList[$fromPartnerDefaultLiveProfile]);
}
}
$toPartner->save();
}
示例3: addBulkUploadJob
/**
* Function adds bulk upload job to the queue
* @param Partner $partner
* @param kBulkUploadJobData $jobData
* @param string $bulkUploadType
* @throws APIException
* @return BatchJob
*/
public static function addBulkUploadJob(Partner $partner, kBulkUploadJobData $jobData, $bulkUploadType = null, $objectId = null, $objectType = null)
{
KalturaLog::debug("adding BulkUpload job");
$job = new BatchJob();
$job->setPartnerId($partner->getId());
$job->setJobType(BatchJobType::BULKUPLOAD);
$job->setJobSubType($bulkUploadType);
if (!is_null($objectId) && !is_null($objectType)) {
$job->setObjectId($objectId);
$job->setObjectType($objectType);
}
if (is_null($jobData)) {
throw new APIException(APIErrors::BULK_UPLOAD_BULK_UPLOAD_TYPE_NOT_VALID, $bulkUploadType);
}
$job->setStatus(BatchJob::BATCHJOB_STATUS_DONT_PROCESS);
$job = kJobsManager::addJob($job, $jobData, BatchJobType::BULKUPLOAD, $bulkUploadType);
if (!is_null($jobData->getFilePath())) {
$syncKey = $job->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOAD);
// kFileSyncUtils::file_put_contents($syncKey, file_get_contents($csvFileData["tmp_name"]));
try {
kFileSyncUtils::moveFromFile($jobData->getFilePath(), $syncKey, true);
} catch (Exception $e) {
KalturaLog::err($e);
throw new APIException(APIErrors::BULK_UPLOAD_CREATE_CSV_FILE_SYNC_ERROR);
}
$filePath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
$jobData->setFilePath($filePath);
}
if (!$jobData->getBulkUploadObjectType()) {
$jobData->setBulkUploadObjectType(BulkUploadObjectType::ENTRY);
}
if ($jobData->getBulkUploadObjectType() == BulkUploadObjectType::ENTRY && !$jobData->getObjectData()->getConversionProfileId()) {
$jobData->setConversionProfileId($partner->getDefaultConversionProfileId());
$kmcVersion = $partner->getKmcVersion();
$check = null;
if ($kmcVersion < 2) {
$check = ConversionProfilePeer::retrieveByPK($jobData->getConversionProfileId());
} else {
$check = conversionProfile2Peer::retrieveByPK($jobData->getConversionProfileId());
}
if (!$check) {
throw new APIException(APIErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $jobData->getConversionProfileId());
}
}
$job->setData($jobData);
return kJobsManager::updateBatchJob($job, BatchJob::BATCHJOB_STATUS_PENDING);
}
示例4: copyConversionProfiles
public static function copyConversionProfiles(Partner $fromPartner, Partner $toPartner)
{
$copiedList = array();
KalturaLog::log("Copying conversion profiles from partner [" . $fromPartner->getId() . "] to partner [" . $toPartner->getId() . "]");
$c = new Criteria();
$c->add(conversionProfile2Peer::PARTNER_ID, $fromPartner->getId());
$conversionProfiles = conversionProfile2Peer::doSelect($c);
foreach ($conversionProfiles as $conversionProfile) {
$newConversionProfile = $conversionProfile->copy();
$newConversionProfile->setPartnerId($toPartner->getId());
$newConversionProfile->save();
KalturaLog::log("Copied [" . $conversionProfile->getId() . "], new id is [" . $newConversionProfile->getId() . "]");
$copiedList[$conversionProfile->getId()] = $newConversionProfile->getId();
$c = new Criteria();
$c->add(flavorParamsConversionProfilePeer::CONVERSION_PROFILE_ID, $conversionProfile->getId());
$fpcpList = flavorParamsConversionProfilePeer::doSelect($c);
foreach ($fpcpList as $fpcp) {
$flavorParamsId = $fpcp->getFlavorParamsId();
$flavorParams = assetParamsPeer::retrieveByPK($flavorParamsId);
if ($flavorParams && $flavorParams->getPartnerId() === 0) {
$newFpcp = $fpcp->copy();
$newFpcp->setConversionProfileId($newConversionProfile->getId());
$newFpcp->save();
}
}
}
$toPartner->save();
// make sure conversion profile is set on the new partner in case it was missed/skiped in the conversionProfile2::copy method
if (!$toPartner->getDefaultConversionProfileId()) {
$fromPartnerDefaultProfile = $fromPartner->getDefaultConversionProfileId();
if ($fromPartnerDefaultProfile && key_exists($fromPartnerDefaultProfile, $copiedList)) {
$toPartner->setDefaultConversionProfileId($copiedList[$fromPartnerDefaultProfile]);
$toPartner->save();
}
}
}