本文整理汇总了PHP中PartnerPeer类的典型用法代码示例。如果您正苦于以下问题:PHP PartnerPeer类的具体用法?PHP PartnerPeer怎么用?PHP PartnerPeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PartnerPeer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addAction
/**
* Allows you to add a new DrmProfile object
*
* @action add
* @param KalturaDrmProfile $drmProfile
* @return KalturaDrmProfile
*
* @throws KalturaErrors::PLUGIN_NOT_AVAILABLE_FOR_PARTNER
* @throws KalturaErrors::INVALID_PARTNER_ID
* @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL
* @throws DrmErrors::ACTIVE_PROVIDER_PROFILE_ALREADY_EXIST
*/
public function addAction(KalturaDrmProfile $drmProfile)
{
// check for required parameters
$drmProfile->validatePropertyNotNull('name');
$drmProfile->validatePropertyNotNull('status');
$drmProfile->validatePropertyNotNull('provider');
$drmProfile->validatePropertyNotNull('partnerId');
// validate values
if (!PartnerPeer::retrieveByPK($drmProfile->partnerId)) {
throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $drmProfile->partnerId);
}
if (!DrmPlugin::isAllowedPartner($drmProfile->partnerId)) {
throw new KalturaAPIException(KalturaErrors::PLUGIN_NOT_AVAILABLE_FOR_PARTNER, DrmPlugin::getPluginName(), $drmProfile->partnerId);
}
$dbDrmProfile = $drmProfile->toInsertableObject();
if (DrmProfilePeer::retrieveByProvider($dbDrmProfile->getProvider())) {
throw new KalturaAPIException(DrmErrors::ACTIVE_PROVIDER_PROFILE_ALREADY_EXIST, $drmProfile->provider);
}
// save in database
$dbDrmProfile->save();
// return the saved object
$drmProfile = KalturaDrmProfile::getInstanceByType($dbDrmProfile->getProvider());
$drmProfile->fromObject($dbDrmProfile, $this->getResponseProfile());
return $drmProfile;
}
示例2: execute
public function execute()
{
$this->forceSystemAuthentication();
myDbHelper::$use_alternative_con = null;
$partnerId = $this->getRequestParameter("partnerId", null);
$uiConfId = $this->getRequestParameter("uiConfId", null);
$page = $this->getRequestParameter("page", 1);
if ($partnerId !== null && $partnerId !== "") {
$pageSize = 50;
$c = new Criteria();
$c->add(widgetPeer::PARTNER_ID, $partnerId);
if ($uiConfId) {
$c->add(widgetPeer::UI_CONF_ID, $uiConfId);
}
$c->addDescendingOrderByColumn(widgetPeer::CREATED_AT);
$total = widgetPeer::doCount($c);
$lastPage = ceil($total / $pageSize);
$c->setOffset(($page - 1) * $pageSize);
$c->setLimit($pageSize);
$widgets = widgetPeer::doSelect($c);
} else {
$total = 0;
$lastPage = 0;
$widgets = array();
}
$this->uiConfId = $uiConfId;
$this->page = $page;
$this->lastPage = $lastPage;
$this->widgets = $widgets;
$this->partner = PartnerPeer::retrieveByPK($partnerId);
$this->partnerId = $partnerId;
}
示例3: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$allow_empty = $this->getP("allow_empty_field", false);
if ($allow_empty == "false" || $allow_empty === 0) {
$allow_empty = false;
}
$partner = new Partner();
$obj_wrapper = objectWrapperBase::getWrapperClass($partner, 0);
$updateable_fields = $obj_wrapper->getUpdateableFields();
// TODO - use fillObjectFromMapOrderedByFields instead
$fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $partner, "partner_", $updateable_fields, BasePeer::TYPE_PHPNAME, $allow_empty);
// check that mandatory fields were set
// TODO
if (count($fields_modified) > 0) {
$target_partner = PartnerPeer::retrieveByPK($partner_id);
if ($partner && $target_partner) {
if (@$fields_modified["adminEmail"] && $target_partner->getAdminEmail() != $fields_modified["adminEmail"]) {
myPartnerUtils::emailChangedEmail($partner_id, $target_partner->getAdminEmail(), $fields_modified["adminEmail"], $target_partner->getName(), PartnerPeer::KALTURAS_PARTNER_EMAIL_CHANGE);
}
$partner->setType($target_partner->getType());
baseObjectUtils::fillObjectFromObject($updateable_fields, $partner, $target_partner, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, $allow_empty);
$target_partner->save();
$this->addMsg("partner", objectWrapperBase::getWrapperClass($target_partner, objectWrapperBase::DETAIL_LEVEL_DETAILED));
$this->addDebug("added_fields", $fields_modified);
} else {
$this->addError(APIErrors::UNKNOWN_PARTNER_ID);
}
} else {
$this->addError(APIErrors::NO_FIELDS_SET_FOR_PARTNER);
}
}
示例4: traceEnabled
/**
* @param BaseObject $object
* @return bool
*/
public static function traceEnabled($partnerId, AuditTrail $auditTrail = null)
{
if (is_null($partnerId)) {
KalturaLog::info("Partner id is null");
return false;
}
if (!isset(self::$cachedPartnerEnabled[$partnerId])) {
$partner = PartnerPeer::retrieveByPK($partnerId);
if (!$partner) {
KalturaLog::info("Partner not found");
return false;
}
if (!$partner->getPluginEnabled(AuditPlugin::PLUGIN_NAME)) {
KalturaLog::info("Partner audit trail is disabled");
self::$cachedPartnerEnabled[$partnerId] = false;
} else {
self::$cachedPartnerEnabled[$partnerId] = true;
}
}
// validate only partner
if (is_null($auditTrail)) {
return self::$cachedPartnerEnabled[$partnerId];
}
$auditTrailConfig = self::getAuditTrailConfig($partnerId, $auditTrail->getObjectType());
if (is_null($auditTrailConfig)) {
KalturaLog::info("Audit trail config not found");
return false;
}
return $auditTrailConfig->actionEnabled($auditTrail->getAction());
}
示例5: myBatchPartnerUsage
public function myBatchPartnerUsage()
{
self::initDb();
$partners_exists = true;
$start_pos = 0;
$bulk_size = 500;
while ($partners_exists) {
$c = new Criteria();
// get only free partners
$c->addAnd(PartnerPeer::PARTNER_PACKAGE, 1);
$c->addAnd(PartnerPeer::MONITOR_USAGE, 1);
$c->setOffset($start_pos);
$c->setLimit($bulk_size);
$partners = PartnerPeer::doSelect($c);
if (!$partners) {
TRACE("No more partners. offset: {$start_pos} , limit: {$bulk_size} .");
$partners_exists = false;
} else {
TRACE("Looping " . ($start_pos + $bulk_size - 1) . " partners, offset: {$start_pos} .");
foreach ($partners as $partner) {
myPartnerUtils::doPartnerUsage($partner, true);
}
}
unset($partners);
$start_pos += $bulk_size;
}
}
示例6: getAssetUrl
public static function getAssetUrl(asset $asset, $servePlayManifest = false, $playManifestClientTag = null, $storageId = null, $urlParameters = '')
{
$partner = PartnerPeer::retrieveByPK($asset->getPartnerId());
if (!$partner) {
return null;
}
$syncKey = $asset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$externalStorageUrl = self::getExternalStorageUrl($partner, $asset, $syncKey, $servePlayManifest, $playManifestClientTag, $storageId);
if ($externalStorageUrl) {
return $externalStorageUrl;
}
if ($partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY) {
return null;
}
if ($asset instanceof flavorAsset && $servePlayManifest) {
$url = requestUtils::getApiCdnHost() . $asset->getPlayManifestUrl($playManifestClientTag, $storageId);
} else {
$urlManager = DeliveryProfilePeer::getDeliveryProfile($asset->getEntryId());
if ($asset instanceof flavorAsset) {
$urlManager->initDeliveryDynamicAttributes(null, $asset);
}
$profileAttributes = $urlManager->getDynamicAttributes();
$profileAttributes->setUrlParams($urlParameters);
$url = $urlManager->getFullAssetUrl($asset);
$url = preg_replace('/^https?:\\/\\//', '', $url);
$protocol = infraRequestUtils::getProtocol();
$deliveryProfileProtocols = $urlManager->getMediaProtocols();
if (!is_null($deliveryProfileProtocols) && !in_array($protocol, explode(',', $deliveryProfileProtocols))) {
$protocol = infraRequestUtils::PROTOCOL_HTTP;
}
$url = $protocol . "://" . $url;
}
return $url;
}
示例7: execute
public function execute()
{
$ksStr = $this->getP("ks");
if ($ksStr) {
$ksObj = null;
try {
$ksObj = ks::fromSecureString($ksStr);
} catch (Exception $e) {
}
if ($ksObj) {
$partner = PartnerPeer::retrieveByPK($ksObj->partner_id);
if (!$partner) {
KExternalErrors::dieError(KExternalErrors::PARTNER_NOT_FOUND);
}
if (!$partner->validateApiAccessControl()) {
KExternalErrors::dieError(KExternalErrors::SERVICE_ACCESS_CONTROL_RESTRICTED);
}
$ksObj->kill();
}
KalturaLog::info("Killing session with ks - [{$ksStr}], decoded - [" . base64_decode($ksStr) . "]");
} else {
KalturaLog::err('logoutAction called with no KS');
}
setcookie('pid', "", 0, "/");
setcookie('subpid', "", 0, "/");
setcookie('kmcks', "", 0, "/");
return sfView::NONE;
//redirection to kmc/kmc is done from java script
}
示例8: listByPartnerAction
/**
* @action listByPartner
* @param KalturaPartnerFilter $filter
* @param KalturaFilterPager $pager
* @return KalturaStorageProfileListResponse
*/
public function listByPartnerAction(KalturaPartnerFilter $filter = null, KalturaFilterPager $pager = null)
{
$c = new Criteria();
if (!is_null($filter)) {
$partnerFilter = new partnerFilter();
$filter->toObject($partnerFilter);
$partnerFilter->set('_gt_id', 0);
$partnerCriteria = new Criteria();
$partnerFilter->attachToCriteria($partnerCriteria);
$partnerCriteria->setLimit(1000);
$partnerCriteria->clearSelectColumns();
$partnerCriteria->addSelectColumn(PartnerPeer::ID);
$stmt = PartnerPeer::doSelectStmt($partnerCriteria);
if ($stmt->rowCount() < 1000) {
$partnerIds = $stmt->fetchAll(PDO::FETCH_COLUMN);
$c->add(StorageProfilePeer::PARTNER_ID, $partnerIds, Criteria::IN);
}
}
if (is_null($pager)) {
$pager = new KalturaFilterPager();
}
$totalCount = StorageProfilePeer::doCount($c);
$pager->attachToCriteria($c);
$list = StorageProfilePeer::doSelect($c);
$newList = KalturaStorageProfileArray::fromStorageProfileArray($list);
$response = new KalturaStorageProfileListResponse();
$response->totalCount = $totalCount;
$response->objects = $newList;
return $response;
}
示例9: execute
public function execute()
{
$this->getResponse()->setHttpHeader("Content-Type", "application/x-javascript");
$kshow_id = $this->getRequestParameter('kshow_id', 0);
$uid = kuser::ANONYMOUS_PUSER_ID;
$kshow = kshowPeer::retrieveByPK($kshow_id);
if (!$kshow) {
return sfView::ERROR;
}
// kshow_id might be a string (something like "15483str") but it will be returned using retriveByPK anyways
// lets make sure we pass just the id to the contribution wizard
$kshow_id = $kshow->getId();
$partner_id = $kshow->getPartnerId();
$partner = PartnerPeer::retrieveByPK($partner_id);
$subp_id = $kshow->getSubpId();
$partner_secret = $partner->getSecret();
$partner_name = $partner->getPartnerName();
$kaltura_services = new startsessionAction();
$kaltura_services->setInputParams(array("format" => kalturaWebserviceRenderer::RESPONSE_TYPE_PHP_ARRAY, "partner_id" => $partner_id, "subp_id" => $subp_id, "uid" => $uid, "secret" => $partner_secret));
$result = $kaltura_services->internalExecute();
$this->ks = @$result["result"]["ks"];
$this->widget_host = requestUtils::getHost();
$this->kshow_id = $kshow_id;
$this->uid = $uid;
$this->partner_id = $partner_id;
$this->subp_id = $subp_id;
$this->partner_name = $partner_name;
return sfView::SUCCESS;
}
示例10: addXMLBulkUploadJob
/**
* Add bulk upload job
* @param DropFolder $folder
* @param DropFolderFile $leadDropFolderFile
* @throws Exception
*/
private function addXMLBulkUploadJob(DropFolder $folder, DropFolderFile $leadDropFolderFile)
{
/* @var $leadDropFolderFile FeedDropFolderFile */
KalturaLog::info('Adding BulkUpload job');
try {
$coreBulkUploadType = BulkUploadXmlPlugin::getBulkUploadTypeCoreValue(BulkUploadXmlType::XML);
$objectId = $leadDropFolderFile->getId();
$objectType = DropFolderXmlBulkUploadPlugin::getBatchJobObjectTypeCoreValue(DropFolderBatchJobObjectType::DROP_FOLDER_FILE);
$partner = PartnerPeer::retrieveByPK($folder->getPartnerId());
$data = KalturaPluginManager::loadObject('kBulkUploadJobData', $coreBulkUploadType);
/* @var $data kBulkUploadJobData */
$data->setUploadedBy(kDropFolderXmlEventsConsumer::UPLOADED_BY);
KalturaLog::info("Feed XML path: " . $leadDropFolderFile->getFeedXmlPath());
$data->setFilePath($leadDropFolderFile->getFeedXmlPath());
$data->setFileName(basename($data->getFilePath()) . '.xml');
$objectData = new kBulkUploadEntryData();
KalturaLog::info('Conversion profile id: ' . $folder->getConversionProfileId());
$objectData->setConversionProfileId($folder->getConversionProfileId());
$data->setObjectData($objectData);
$job = kJobsManager::addBulkUploadJob($partner, $data, $coreBulkUploadType, $objectId, $objectType);
$this->setFileToProcessing($leadDropFolderFile);
return $job;
} catch (Exception $e) {
KalturaLog::err("Error adding BulkUpload job -" . $e->getMessage());
throw new Exception(DropFolderXmlBulkUploadPlugin::ERROR_ADDING_BULK_UPLOAD_MESSAGE, DropFolderXmlBulkUploadPlugin::getErrorCodeCoreValue(DropFolderXmlBulkUploadErrorCode::ERROR_ADDING_BULK_UPLOAD));
}
}
示例11: objectChanged
public function objectChanged(BaseObject $object, array $modifiedColumns)
{
/* @var $object Permission */
$partner = PartnerPeer::retrieveByPK($object->getPartnerId());
$this->partnerPermissionEnabled($partner);
return true;
}
示例12: addAction
/**
* Allows you to add a new DrmPolicy object
*
* @action add
* @param KalturaDrmPolicy $drmPolicy
* @return KalturaDrmPolicy
*
* @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL
*/
public function addAction(KalturaDrmPolicy $drmPolicy)
{
// check for required parameters
$drmPolicy->validatePropertyNotNull('name');
$drmPolicy->validatePropertyNotNull('status');
$drmPolicy->validatePropertyNotNull('provider');
$drmPolicy->validatePropertyNotNull('systemName');
$drmPolicy->validatePropertyNotNull('scenario');
$drmPolicy->validatePropertyNotNull('partnerId');
// validate values
$drmPolicy->validatePolicy();
if (!PartnerPeer::retrieveByPK($drmPolicy->partnerId)) {
throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $drmPolicy->partnerId);
}
if (!DrmPlugin::isAllowedPartner($drmPolicy->partnerId)) {
throw new KalturaAPIException(KalturaErrors::PLUGIN_NOT_AVAILABLE_FOR_PARTNER, DrmPlugin::getPluginName(), $drmPolicy->partnerId);
}
if (DrmPolicyPeer::retrieveBySystemName($drmPolicy->systemName)) {
throw new KalturaAPIException(DrmErrors::DRM_POLICY_DUPLICATE_SYSTEM_NAME, $drmPolicy->systemName);
}
// save in database
$dbDrmPolicy = $drmPolicy->toInsertableObject();
$dbDrmPolicy->save();
// return the saved object
$drmPolicy = KalturaDrmPolicy::getInstanceByType($dbDrmPolicy->getProvider());
$drmPolicy->fromObject($dbDrmPolicy, $this->getResponseProfile());
return $drmPolicy;
}
示例13: addAction
/**
* Add new Syndication Feed
*
* @action add
* @param KalturaBaseSyndicationFeed $syndicationFeed
* @return KalturaBaseSyndicationFeed
*/
public function addAction(KalturaBaseSyndicationFeed $syndicationFeed)
{
$syndicationFeed->validatePlaylistId();
if ($syndicationFeed instanceof KalturaGenericXsltSyndicationFeed) {
$syndicationFeed->validateXslt();
$syndicationFeedDB = new genericSyndicationFeed();
$syndicationFeedDB->setVersion(1);
} else {
$syndicationFeedDB = new syndicationFeed();
}
$syndicationFeed->partnerId = $this->getPartnerId();
$syndicationFeed->status = KalturaSyndicationFeedStatus::ACTIVE;
$syndicationFeed->toObject($syndicationFeedDB);
$syndicationFeedDB->save();
if ($syndicationFeed->addToDefaultConversionProfile) {
$partner = PartnerPeer::retrieveByPK($this->getPartnerId());
$c = new Criteria();
$c->addAnd(flavorParamsConversionProfilePeer::CONVERSION_PROFILE_ID, $partner->getDefaultConversionProfileId());
$c->addAnd(flavorParamsConversionProfilePeer::FLAVOR_PARAMS_ID, $syndicationFeed->flavorParamId);
$is_exist = flavorParamsConversionProfilePeer::doCount($c);
if (!$is_exist || $is_exist === 0) {
$fpc = new flavorParamsConversionProfile();
$fpc->setConversionProfileId($partner->getDefaultConversionProfileId());
$fpc->setFlavorParamsId($syndicationFeed->flavorParamId);
$fpc->save();
}
}
if ($syndicationFeed instanceof KalturaGenericXsltSyndicationFeed) {
$key = $syndicationFeedDB->getSyncKey(genericSyndicationFeed::FILE_SYNC_SYNDICATION_FEED_XSLT);
kFileSyncUtils::file_put_contents($key, $syndicationFeed->xslt);
}
$syndicationFeed->fromObject($syndicationFeedDB);
return $syndicationFeed;
}
示例14: 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
$hosts = array($partner->getCdnHost(), $partner->getRtmpUrl(), $partner->getIisHost());
foreach ($hosts as $host) {
if (!empty($host)) {
$mediaTypePathList[] = array('MediaType' => $mediaType, 'MediaPath' => $host . $serveFlavorUrl);
}
}
}
return self::purgeFromEdgeCast($mediaTypePathList, $partner);
}
示例15: myBatchPartnerUsage
public function myBatchPartnerUsage($partnerId = null)
{
self::initDb();
$partners_exists = true;
$start_pos = 0;
$bulk_size = 500;
while ($partners_exists) {
$c = new Criteria();
if (!is_null($partnerId)) {
$c->addAnd(PartnerPeer::ID, $partnerId);
}
$c->addAnd(PartnerPeer::PARTNER_PACKAGE, 1);
// get only free partners
$c->addAnd(PartnerPeer::MONITOR_USAGE, 1);
$c->addAnd(PartnerPeer::STATUS, Partner::PARTNER_STATUS_DELETED, CRITERIA::NOT_EQUAL);
$c->setOffset($start_pos);
$c->setLimit($bulk_size);
$partners = PartnerPeer::doSelect($c);
if (!$partners) {
KalturaLog::debug("No more partners. offset: {$start_pos} , limit: {$bulk_size} .");
$partners_exists = false;
} else {
KalturaLog::debug("Looping " . ($start_pos + $bulk_size - 1) . " partners, offset: {$start_pos} .");
foreach ($partners as $partner) {
myPartnerUtils::doPartnerUsage($partner, true);
}
}
unset($partners);
PartnerPeer::clearInstancePool();
$start_pos += $bulk_size;
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:32,代码来源:myBatchPartnerUsage.class.php