• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/user.php
  • Класс: CAllUser
  • Вызов: CAllUser::SetLastActivityDate
static function SetLastActivityDate($userId = null, $cache = false)
{
	global $USER;

	if (is_null($userId))
	{
		$userId = $USER->GetId();
	}

	$userId = intval($userId);
	if ($userId <= 0)
	{
		return false;
	}

	if ($userId == $USER->GetId())
	{
		if ($cache)
		{
			if (intval($USER->GetParam('SET_LAST_ACTIVITY')) + 60 > time())
			{
				return false;
			}
		}

		$USER->SetParam('PREV_LAST_ACTIVITY', $USER->GetParam('SET_LAST_ACTIVITY'));
		$USER->SetParam('SET_LAST_ACTIVITY', time());
	}

	static::SetLastActivityDateByArray([$userId], $_SERVER['REMOTE_ADDR']);

	return true;
}