• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/component/ustatonline.php
  • Класс: BitrixIntranetComponentUstatOnline
  • Вызов: UstatOnline::checkMaxOnlineOption
public function checkMaxOnlineOption()
{
	$newValue = [];
	$currentDate = new Date;
	$currentDate = $currentDate->getTimestamp();

	$option = Option::get('intranet', 'ustat_online_users', '');
	if (!empty($option))
	{
		$data = unserialize($option, ["allowed_classes" => false]);
		$newValue = $data;
		$optionDate = is_numeric($data["date"]) ? $data["date"] : 0;

		if ($currentDate > $optionDate)
		{
			$newValue = [
				"date" => $currentDate,
				"userIds" => $this->arResult['ONLINE_USERS_ID']
			];
		}
		else
		{
			$newValue["userIds"] = array_unique(array_merge($data["userIds"], $this->arResult['ONLINE_USERS_ID']));
		}
	}
	else
	{
		$newValue = [
			"date" => $currentDate,
			"userIds" => $this->arResult['ONLINE_USERS_ID']
		];
	}

	Option::set('intranet', 'ustat_online_users', serialize($newValue));

	$this->arResult["MAX_ONLINE_USER_COUNT_TODAY"] = count($newValue["userIds"]);
	$this->arResult["ALL_ONLINE_USER_ID_TODAY"] = $this->arResult['ONLINE_USERS_ID'];
}