本文整理汇总了PHP中kCurrentContext::isApiV3Context方法的典型用法代码示例。如果您正苦于以下问题:PHP kCurrentContext::isApiV3Context方法的具体用法?PHP kCurrentContext::isApiV3Context怎么用?PHP kCurrentContext::isApiV3Context使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kCurrentContext
的用法示例。
在下文中一共展示了kCurrentContext::isApiV3Context方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getKuserByPartnerAndUid
/**
* @param int $partnerId
* @param string $puserId
* @param bool $ignore_puser_kuser
* @return kuser
*/
public static function getKuserByPartnerAndUid($partnerId, $puserId, $ignorePuserKuser = false)
{
if (!$ignorePuserKuser && !kCurrentContext::isApiV3Context()) {
$puserKuser = PuserKuserPeer::retrieveByPartnerAndUid($partnerId, 0, $puserId, true);
if ($puserKuser) {
return $puserKuser->getKuser();
}
}
$c = new Criteria();
$c->add(self::PARTNER_ID, $partnerId);
$c->add(self::PUSER_ID, $puserId);
return self::doSelectOne($c);
}
示例2: getKuserByPartnerAndUid
/**
* @param int $partnerId
* @param string $puserId
* @param bool $ignore_puser_kuser
* @return kuser
*/
public static function getKuserByPartnerAndUid($partnerId, $puserId, $ignorePuserKuser = false)
{
if (!$ignorePuserKuser && !kCurrentContext::isApiV3Context()) {
$puserKuser = PuserKuserPeer::retrieveByPartnerAndUid($partnerId, 0, $puserId, true);
if ($puserKuser) {
return $puserKuser->getKuser();
}
}
$c = new Criteria();
$c->add(self::PARTNER_ID, $partnerId);
$c->add(self::PUSER_ID, $puserId);
// in case of more than one deleted kusers - get the last one
$c->addDescendingOrderByColumn(kuserPeer::UPDATED_AT);
return self::doSelectOne($c);
}
示例3: getPuserId
public function getPuserId()
{
if (kCurrentContext::isApiV3Context()) {
return parent::getPuserId();
}
$puser_id = $this->getFromCustomData("puserId");
if ($this->m_puser_id) {
return $this->m_puser_id;
} else {
if ($this->getKuserId()) {
$puser_id = PuserKuserPeer::getPuserIdFromKuserId($this->getPartnerId(), $this->getKuserId());
$this->putInCustomData("puserId", $puser_id);
$this->m_puser_id = $puser_id;
}
}
return $puser_id;
}
示例4: getPuserId
public function getPuserId()
{
$puserId = parent::getPuserId();
if (is_null($puserId) && !kCurrentContext::isApiV3Context()) {
$puserId = PuserKuserPeer::getPuserIdFromKuserId($this->getPartnerId(), $this->getId());
}
return $puserId;
}
示例5: updatedJob
/**
* @param BatchJob $dbBatchJob
* @param BatchJob $twinJob
* @return bool true if should continue to the next consumer
*/
public function updatedJob(BatchJob $dbBatchJob, BatchJob $twinJob = null)
{
// virus scan only works in api_v3 context because it uses dynamic enums
if (!class_exists('kCurrentContext') || !kCurrentContext::isApiV3Context()) {
return true;
}
if ($dbBatchJob->getJobType() == VirusScanPlugin::getBatchJobTypeCoreValue(VirusScanBatchJobType::VIRUS_SCAN)) {
$dbBatchJob = $this->updatedVirusScan($dbBatchJob, $dbBatchJob->getData(), $twinJob);
}
return true;
}
示例6: getObjectClass
/**
* @param string $baseClass
* @param string $enumValue
* @return string
*/
public static function getObjectClass($baseClass, $enumValue)
{
// virus scan only works in api_v3 context because it uses dynamic enums
if (!class_exists('kCurrentContext') || !kCurrentContext::isApiV3Context()) {
return null;
}
if ($baseClass == 'kJobData') {
if ($enumValue == self::getBatchJobTypeCoreValue(VirusScanBatchJobType::VIRUS_SCAN)) {
return 'kVirusScanJobData';
}
}
if ($baseClass == 'KalturaJobData') {
if ($enumValue == self::getApiValue(VirusScanBatchJobType::VIRUS_SCAN)) {
return 'KalturaVirusScanJobData';
}
}
return null;
}
示例7: createNotification
//.........这里部分代码省略.........
// elseif ( $nofity_send_type == self::NOTIFICATION_MGR_SEND_SYNCH )
// {
// $not->setStatus( BatchJob::BATCHJOB_STATUS_FINISHED );
// }
//
// // return the notification to the caller
// $retrun_notification = ( $nofity_send_type == self::NOTIFICATION_MGR_SEND_SYNCH || $nofity_send_type == self::NOTIFICATION_MGR_SEND_BOTH );
//
////echo "retrun_notification: $retrun_notification<br>";
//
// $not->setPartnerId( $partner_id );
// $not->setPuserId( $puser_id );
// $not->setDc ( kDataCenterMgr::getCurrentDcId() );
// if ( $object_data instanceof BaseObject )
// {
// $not->setObjectId($object_data->getId() );
// $not->setData( self::createNotificationData ( $notification_type , $object_data, $extra_notification_data ) );
//
// if ( $object_data instanceof entry )
// {
// if (defined("KALTURA_API_V3"))
// $puser_id = $object_data->getKuser()->getPuserId();
// else
// $puser_id = PuserKuserPeer::getByKuserId( $object_data->getKuserId() , 1 );
//
// $not->setPuserId( $puser_id );
//
// }
// }
// else
// {
// // in this case all we have is the object data which is the id
// // this is probably the case of some delete and we mifght not have the object in hand but only the id
// $not->setObjectId( $object_data );
// }
// $not->save();
// Added by Tan-Tan, Nov 2009 to support the new batches
// if ( $nofity_send_type == self::NOTIFICATION_MGR_SEND_ASYNCH || $nofity_send_type == self::NOTIFICATION_MGR_SEND_BOTH)
// {
//
// // the notification should be in status pending so it will be sent in the
// $job->setStatus( BatchJob::BATCHJOB_STATUS_PENDING );
// }
// else
$dontSend = false;
if ($nofity_send_type == self::NOTIFICATION_MGR_SEND_SYNCH) {
$dontSend = true;
}
// return the notification to the caller
$retrun_notification = $nofity_send_type == self::NOTIFICATION_MGR_SEND_SYNCH || $nofity_send_type == self::NOTIFICATION_MGR_SEND_BOTH;
$objectId = null;
$notificationData = null;
if ($object_data instanceof BaseObject) {
$objectId = $object_data->getId();
$notificationData = self::createNotificationData($notification_type, $object_data, $extra_notification_data);
if ($object_data instanceof entry) {
if (kCurrentContext::isApiV3Context()) {
$kuser = $object_data->getKuser();
if ($kuser) {
$puser_id = $kuser->getPuserId();
} else {
$puser_id = null;
KalturaLog::log(__CLASS__ . '::' . __METHOD__ . ' [line: ' . __LINE__ . '] could not find kuser [' . $object_data->getKuserId() . '] from object [' . $object_data->getId() . ']');
}
} else {
$puser_id = PuserKuserPeer::getByKuserId($object_data->getKuserId(), 1);
// in flatten (or maybe other old batches), KALTURA_API_V3 is not defined, but entry user could have
// been created through api v3, in that case there will not be a record in puser_kuser table
if (is_null($puser_id)) {
$puser_id = $object_data->getPuserId();
// if entry was created on PS2 and from some reason puserId is still missing
if (is_null($puser_id)) {
$kuser = kuserPeer::retrieveByPK($object_data->getKuserId());
if ($kuser) {
$puser_id = $kuser->getPuserId();
}
}
}
if (is_null($puser_id)) {
KalturaLog::log(__CLASS__ . '::' . __METHOD__ . ' [line: ' . __LINE__ . '] could not get puser_id out of api_v3 context puserId from entry:[' . $object_data->getPuserId() . '] kuser ID:[' . $object_data->getKuserId() . '] entry:[' . $object_data->getId() . ']');
}
}
}
} else {
// in this case all we have is the object data which is the id
// this is probably the case of some delete and we mifght not have the object in hand but only the id
$objectId = $object_data;
}
$job = kJobsManager::addNotificationJob(null, $entry_id, $partner_id, $notification_type, $nofity_send_type, $puser_id, $objectId, $notificationData);
if ($retrun_notification) {
// return the notification id, notification object , url & the serialized data
$partner = PartnerPeer::retrieveByPK($partner_id);
list($url, $signature_key) = self::getPartnerNotificationInfo($partner);
list($params, $raw_signature) = self::prepareNotificationData($url, $signature_key, $job, $prefix);
$serialized_params = http_build_query($params, "", "&");
return array($job->getId(), $job, $url, $params, $serialized_params);
} else {
return $job->getId();
}
}
示例8: array
/**
return array('status' => $status, 'message' => $message, 'objects' => $objects);
objects - array of
'thumb'
'title'
'description'
'id' - unique id to be passed to getMediaInfo
*/
public function searchMedia($media_type, $searchText, $page, $pageSize, $authData = null, $extraData = null)
{
$page_size = $pageSize > 20 ? 20 : $pageSize;
$page--;
if ($page < 0) {
$page = 0;
}
$status = "ok";
$message = '';
$objects = array();
$should_serach = true;
if (kCurrentContext::isApiV3Context()) {
$kuser = kuserPeer::getKuserByPartnerAndUid(self::$partner_id, self::$puser_id);
$should_serach = true;
$kuser_id = $kuser->getId();
} else {
$puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid(self::$partner_id, self::$subp_id, self::$puser_id, true);
if (!$puser_kuser) {
// very bad - does not exist in system
$should_serach = false;
} else {
$kuser = $puser_kuser->getKuser();
if (!$kuser) {
$should_serach = false;
} else {
$kuser_id = $kuser->getId();
}
}
}
// echo "[" . self::$partner_id . "],[". self::$subp_id . "],[" . self::$puser_id . "],[$kuser_id]";
if ($should_serach) {
$c = KalturaCriteria::create(entryPeer::OM_CLASS);
$c->add(entryPeer::KUSER_ID, $kuser_id);
$c->add(entryPeer::MEDIA_TYPE, $media_type);
$c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
// $keywords_array = mySearchUtils::getKeywordsFromStr ( $searchText );
$filter = new entryFilter();
$filter->setPartnerSearchScope(self::$partner_id);
$filter->addSearchMatchToCriteria($c, $searchText, entry::getSearchableColumnName());
$c->setLimit($pageSize);
$c->setOffset($page * $pageSize);
$entry_results = entryPeer::doSelect($c);
//JoinAll( $c );
$number_of_results = $c->getRecordsCount();
$number_of_pages = (int) ($number_of_results / $pageSize);
if ($number_of_results % $pageSize != 0) {
$number_of_pages += 1;
}
// if there are some left-overs - there must be a nother page
// add thumbs when not image or video
$should_add_thumbs = $media_type != entry::ENTRY_MEDIA_TYPE_AUDIO;
foreach ($entry_results as $entry) {
/* @var $entry entry */
// send the id as the url
$object = array("id" => $entry->getId(), "url" => $entry->getDataUrl(), "tags" => $entry->getTags(), "title" => $entry->getName(), "description" => $entry->getDescription(), "flash_playback_type" => $entry->getMediaTypeName());
if ($should_add_thumbs) {
$object["thumb"] = $entry->getThumbnailUrl();
}
//Find the flavor sent over the dataUrl in order to send its extension
$playedAsset = assetPeer::retrieveBestPlayByEntryId($entry->getId());
if ($playedAsset) {
$object["file_ext"] = $playedAsset->getFileExt();
}
$objects[] = $object;
}
}
return array('status' => $status, 'message' => $message, 'objects' => $objects, "needMediaInfo" => self::$NEED_MEDIA_INFO);
}
示例9: shouldConsumeJobStatusEvent
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob)
{
if (!class_exists('kCurrentContext') || !kCurrentContext::isApiV3Context()) {
return false;
}
if ($dbBatchJob->getJobType() == VirusScanPlugin::getBatchJobTypeCoreValue(VirusScanBatchJobType::VIRUS_SCAN)) {
return true;
}
return false;
}
示例10: getPuserId
public function getPuserId($real_puser_id = false)
{
if (kCurrentContext::isApiV3Context()) {
return parent::getPuserId();
}
// HACK for FootBo
if (!$real_puser_id && $this->getPartnerId() == 8304) {
return $this->getContributorScreenName();
}
$puser_id = $this->getFromCustomData("puserId");
if ($this->m_puser_id) {
return $this->m_puser_id;
} else {
if ($this->getKuserId()) {
$puser_id = PuserKuserPeer::getPuserIdFromKuserId($this->getPartnerId(), $this->getKuserId());
$this->putInCustomData("puserId", $puser_id);
$this->m_puser_id = $puser_id;
}
}
return $puser_id;
}