本文整理汇总了PHP中VTCacheUtils::updateOwnerType方法的典型用法代码示例。如果您正苦于以下问题:PHP VTCacheUtils::updateOwnerType方法的具体用法?PHP VTCacheUtils::updateOwnerType怎么用?PHP VTCacheUtils::updateOwnerType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTCacheUtils
的用法示例。
在下文中一共展示了VTCacheUtils::updateOwnerType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRecordOwnerId
/** Function to get a user id or group id for a given entity
* @param $record -- entity id :: Type integer
* @returns $ownerArr -- owner id :: Type array
*/
function getRecordOwnerId($record)
{
global $log;
$log->debug("Entering getRecordOwnerId(" . $record . ") method ...");
global $adb;
$ownerArr = array();
// Look at cache first for information
$ownerId = VTCacheUtils::lookupRecordOwner($record);
if ($ownerId === false) {
$query = "select smownerid from vtiger_crmentity where crmid = ?";
$result = $adb->pquery($query, array($record));
if ($adb->num_rows($result) > 0) {
$ownerId = $adb->query_result($result, 0, 'smownerid');
// Update cache for re-use
VTCacheUtils::updateRecordOwner($record, $ownerId);
}
}
if ($ownerId) {
// Look at cache first for information
$count = VTCacheUtils::lookupOwnerType($ownerId);
if ($count === false) {
$sql_result = $adb->pquery("select count(*) as count from vtiger_users where id = ?", array($ownerId));
$count = $adb->query_result($sql_result, 0, 'count');
// Update cache for re-use
VTCacheUtils::updateOwnerType($ownerId, $count);
}
if ($count > 0) {
$ownerArr['Users'] = $ownerId;
} else {
$ownerArr['Groups'] = $ownerId;
}
}
$log->debug("Exiting getRecordOwnerId method ...");
return $ownerArr;
}
示例2: getRecordOwnerId
/** Function to get a user id or group id for a given entity
* @param $record -- entity id :: Type integer
* @returns $ownerArr -- owner id :: Type array
*/
function getRecordOwnerId($record)
{
$log = vglobal('log');
$log->debug("Entering getRecordOwnerId(" . $record . ") method ...");
$adb = PearDatabase::getInstance();
$ownerArr = [];
$recordMetaData = Vtiger_Functions::getCRMRecordMetadata($record);
if ($recordMetaData) {
$ownerId = $recordMetaData['smownerid'];
// Look at cache first for information
$count = VTCacheUtils::lookupOwnerType($ownerId);
if ($count === false) {
$sql_result = $adb->pquery("select count(*) as count from vtiger_users where id = ?", array($ownerId));
$count = $adb->query_result($sql_result, 0, 'count');
// Update cache for re-use
VTCacheUtils::updateOwnerType($ownerId, $count);
}
if ($count > 0) {
$ownerArr['Users'] = $ownerId;
} else {
$ownerArr['Groups'] = $ownerId;
}
}
$log->debug("Exiting getRecordOwnerId method ...");
return $ownerArr;
}