本文整理汇总了PHP中myPartnerUtils::resetAllFilters方法的典型用法代码示例。如果您正苦于以下问题:PHP myPartnerUtils::resetAllFilters方法的具体用法?PHP myPartnerUtils::resetAllFilters怎么用?PHP myPartnerUtils::resetAllFilters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myPartnerUtils
的用法示例。
在下文中一共展示了myPartnerUtils::resetAllFilters方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initService
public function initService($serviceId, $serviceName, $actionName)
{
parent::initService($serviceId, $serviceName, $actionName);
if ($this->getPartnerId() != Partner::BATCH_PARTNER_ID) {
throw new KalturaAPIException(KalturaErrors::SERVICE_FORBIDDEN, $this->serviceName . '->' . $this->actionName);
}
myPartnerUtils::resetAllFilters();
}
示例2: dirname
<?php
require_once dirname(__FILE__) . '/../bootstrap.php';
$f = fopen("php://stdin", "r");
$count = 0;
$sphinxMgr = new kSphinxSearchManager();
$dbConf = kConf::getDB();
DbManager::setConfig($dbConf);
DbManager::initialize();
$connection = Propel::getConnection();
while ($s = trim(fgets($f))) {
$sep = strpos($s, "\t") ? "\t" : " ";
list($entryId, $plays, $views) = explode($sep, $s);
myPartnerUtils::resetAllFilters();
entryPeer::setDefaultCriteriaFilter();
$entry = entryPeer::retrieveByPK($entryId);
if (is_null($entry)) {
KalturaLog::err('Couldn\'t find entry [' . $entryId . ']');
continue;
}
if ($entry->getViews() != $views || $entry->getPlays() != $plays) {
$entry->setViews($views);
$entry->setPlays($plays);
KalturaLog::debug('Successfully saved entry [' . $entryId . ']');
try {
// update entry without setting the updated at
$updateSql = "UPDATE entry set views='{$views}',plays='{$plays}' WHERE id='{$entryId}'";
$stmt = $connection->prepare($updateSql);
$stmt->execute();
$affectedRows = $stmt->rowCount();
KalturaLog::log("AffectedRows: " . $affectedRows);
示例3: initService
public function initService($serviceId, $serviceName, $actionName)
{
// init service and action name
$this->serviceId = $serviceId;
$this->serviceName = $serviceName;
$this->actionName = $actionName;
// impersonated partner = partner parameter from the request
$this->impersonatedPartnerId = kCurrentContext::$partner_id;
$this->ks = kCurrentContext::$ks_object ? kCurrentContext::$ks_object : null;
// operating partner = partner from the request or the ks partner
$partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
// if there is no session, assume it's partner 0 using actions that doesn't require ks
if (is_null($partnerId)) {
$partnerId = 0;
}
$this->partner = PartnerPeer::retrieveByPK($partnerId);
if (!$this->partner) {
$this->partner = null;
}
// check if current aciton is allowed and if private partner data access is allowed
$allowPrivatePartnerData = false;
$actionPermitted = $this->isPermitted($allowPrivatePartnerData);
// action not permitted at all, not even kaltura network
if (!$actionPermitted) {
$e = new KalturaAPIException(APIErrors::SERVICE_FORBIDDEN, $this->serviceId . '->' . $this->actionName);
//TODO: should sometimes thorow MISSING_KS instead
header("X-Kaltura:error-" . $e->getCode());
header("X-Kaltura-App: exiting on error " . $e->getCode() . " - " . $e->getMessage());
throw $e;
}
// init partner filter parameters
$this->private_partner_data = $allowPrivatePartnerData;
$this->partnerGroup = kPermissionManager::getPartnerGroup($this->serviceId, $this->actionName);
if ($this->globalPartnerAllowed($this->actionName)) {
$this->partnerGroup = PartnerPeer::GLOBAL_PARTNER . ',' . trim($this->partnerGroup, ',');
}
// apply partner filters according to current context and permissions
myPartnerUtils::resetAllFilters();
myPartnerUtils::applyPartnerFilters($partnerId, $this->private_partner_data, $this->partnerGroup, $this->kalturaNetworkAllowed($this->actionName));
}
示例4: setPartnerFilters
/**
* apply partner filters according to current context and permissions
*
* @param int $partnerId
*/
protected function setPartnerFilters($partnerId)
{
myPartnerUtils::resetAllFilters();
myPartnerUtils::applyPartnerFilters($partnerId, $this->private_partner_data, $this->partnerGroup(), $this->kalturaNetworkAllowed($this->actionName));
}
示例5: executeMultiRequest
public function executeMultiRequest()
{
// several default params
$global_format = @$this->original_request_params["format"];
if (!$global_format) {
$global_format = kalturaWebserviceRenderer::RESPONSE_TYPE_XML;
}
$this->response_type = $global_format;
//
$multi_response = array();
while (($params = $this->getNextRequestParams($multi_response)) != null) {
// start by resetting the peers so there will be no effect from the previous "request"
myPartnerUtils::resetAllFilters();
// echo ( "Now executing request [{$this->current_action_index}}]<br>" );
$service_name = @$params["service"];
if (!$service_name) {
// error - cannot find service to execute !
// LOG & STOP !
break;
}
$service_name = strtolower(str_replace("_", "", $service_name));
if ($service_name == self::MULTI_END) {
break;
}
$clazz_name = $service_name . "Action";
$include_result = (include_once dirname(__FILE__) . "/../modules/partnerservices2/actions/{$clazz_name}.class.php");
if ($include_result) {
$myaction = new $clazz_name();
// request the response as
// becuase the format is global - it cannot be used per service anyway.
$params["format"] = kalturaWebserviceRenderer::RESPONSE_TYPE_PHP_ARRAY;
$myaction->setInputParams($params);
//$myaction->setResponseContext ( "response{$this->current_action_index}");
$response = $myaction->execute(false);
// foreach single action - pass false so no extra debug data will be outputed
// $this->addMsg ( "response{$this->current_action_index}" , $response );
$multi_response["response{$this->current_action_index}"] = $response;
$error = @$response["error"];
} else {
$error = "Invalid service [{$service_name}]";
}
if ($error != null) {
if ($this->stop_on_error == self::STOP_ON_FIRST_ERROR) {
// make the error public as well as in the specific response
// $this->addError( $error );
// $this->addError( "errornos_request" , $this->current_action_index );
//$this->setRawError( $error );
$this->addRawError($error);
$this->addRawError(array("errornos_request" => $this->current_action_index));
// $multi_response["error"] = $error;
// $multi_response["errornos_request"] = $this->current_action_index;
// don't continue iterating
break;
}
}
}
if (count($this->errors) > 0) {
if (!isset($multi_response["debug"])) {
$multi_response["debug"] = array();
}
// $this->addDebug ( "error_replacing" , $this->errors );
$multi_response["debug"] = $this->errors;
}
$this->setMsg($multi_response);
return $multi_response;
}
示例6: createNewPartner
/**
* Function creates new partner, saves all the required data to it, and copies objects & filesyncs of template content to its ID.
* @param string $partner_name
* @param string $contact
* @param string $email
* @param CommercialUseType $ID_is_for
* @param string $SDK_terms_agreement
* @param string $description
* @param string $website_url
* @param string $password
* @param Partner $partner
* @param int $templatePartnerId
* @return Partner
*/
private function createNewPartner($partner_name, $contact, $email, $ID_is_for, $SDK_terms_agreement, $description, $website_url, $password = null, $newPartner = null, $templatePartnerId = null)
{
$secret = md5($this->str_makerand(5, 10, true, false, true));
$admin_secret = md5($this->str_makerand(5, 10, true, false, true));
if (!$newPartner) {
$newPartner = new Partner();
}
if ($partner_name) {
$newPartner->setPartnerName($partner_name);
}
$newPartner->setAdminSecret($admin_secret);
$newPartner->setSecret($secret);
$newPartner->setAdminName($contact);
$newPartner->setAdminEmail($email);
$newPartner->setUrl1($website_url);
if ($ID_is_for === "commercial_use" || $ID_is_for === CommercialUseType::COMMERCIAL_USE) {
$newPartner->setCommercialUse(true);
} else {
//($ID_is_for == "non-commercial_use") || $ID_is_for === CommercialUseType::NON_COMMERCIAL_USE)
$newPartner->setCommercialUse(false);
}
$newPartner->setDescription($description);
$newPartner->setKsMaxExpiryInSeconds(86400);
$newPartner->setModerateContent(false);
$newPartner->setNotify(false);
$newPartner->setAppearInSearch(mySearchUtils::DISPLAY_IN_SEARCH_PARTNER_ONLY);
$newPartner->setIsFirstLogin(true);
/* fix drupal5 module partner type */
//var_dump($description);
if ($this->partnerParentId) {
// this is a child partner of some VAR/partner GROUP
$newPartner->setPartnerParentId($this->partnerParentId);
$newPartner->setMonitorUsage(PartnerFreeTrialType::NO_LIMIT);
$parentPartner = PartnerPeer::retrieveByPK($this->partnerParentId);
$newPartner->setPartnerPackage($parentPartner->getPartnerPackage());
}
if (substr_count($description, 'Drupal module|')) {
$newPartner->setType(102);
}
$newPartner->save();
// if name was left empty - which should not happen - use id as name
if (!$partner_name) {
$partner_name = $newPartner->getId();
}
$newPartner->setPartnerName($partner_name);
$newPartner->setPrefix($newPartner->getId());
$newPartner->setPartnerAlias(md5($newPartner->getId() . 'kaltura partner'));
// set default conversion profile for trial accounts
if ($newPartner->getType() == Partner::PARTNER_TYPE_KMC) {
$newPartner->setDefConversionProfileType(ConversionProfile::DEFAULT_TRIAL_COVERSION_PROFILE_TYPE);
}
$newPartner->save();
// remove the default criteria from all peers and recreate it with the right partner id
myPartnerUtils::resetAllFilters();
myPartnerUtils::applyPartnerFilters($newPartner->getId(), true);
$partner_id = $newPartner->getId();
widget::createDefaultWidgetForPartner($partner_id, $this->createNewSubPartner($newPartner));
$fromPartner = PartnerPeer::retrieveByPK($templatePartnerId ? $templatePartnerId : kConf::get("template_partner_id"));
if (!$fromPartner) {
KalturaLog::log("Template content partner was not found!");
} else {
$newPartner->setI18nTemplatePartnerId($templatePartnerId);
myPartnerUtils::copyTemplateContent($fromPartner, $newPartner, true);
}
if ($newPartner->getType() == Partner::PARTNER_TYPE_WORDPRESS) {
kPermissionManager::setPs2Permission($newPartner);
}
$newPartner->setKmcVersion(kConf::get('new_partner_kmc_version'));
$newPartner->save();
return $newPartner;
}