- Модуль: intranet
- Путь к файлу: ~/bitrix/modules/intranet/lib/component/ustatonline.php
- Класс: BitrixIntranetComponentUstatOnline
- Вызов: UstatOnline::getUserCount
protected function getUserCount()
{
global $CACHE_MANAGER;
$cache = new CPHPCache;
$cacheId = "USER_COUNT";
$cacheDir = "/intranet/ustat_online/";
if($cache->initCache(86400, $cacheId, $cacheDir))
{
$cacheVars = $cache->getVars();
$userCount = $cacheVars["USER_COUNT"];
}
else
{
$cache->startDataCache();
$CACHE_MANAGER->StartTagCache($cacheDir);
$CACHE_MANAGER->RegisterTag('user_count');
$users = UserTable::getList(array(
"select" => ["ID"],
"filter" => [
"=ACTIVE" => "Y",
"=CONFIRM_CODE" => false,
"!UF_DEPARTMENT" => false,
"!=EXTERNAL_AUTH_ID" => UserTable::getExternalUserTypes()
],
'count_total' => true,
));
$userCount = $users->getCount();
$CACHE_MANAGER->EndTagCache();
$cache->endDataCache([
"USER_COUNT" => $userCount
]);
}
return $userCount;
}