• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/bot.php
  • Класс: BitrixImBot
  • Вызов: Bot::getListCache
static function getListCache($type = self::LIST_ALL)
{
	$cache = BitrixMainDataCache::createInstance();
	if($cache->initCache(self::CACHE_TTL, 'list_r5', self::CACHE_PATH))
	{
		$result = $cache->getVars();
	}
	else
	{
		$result = Array();
		$orm = BitrixImModelBotTable::getList();
		while ($row = $orm->fetch())
		{
			$row['LANG'] = $row['LANG']? $row['LANG']: null;
			$result[$row['BOT_ID']] = $row;
		}

		$cache->startDataCache();
		$cache->endDataCache($result);
	}

	if ($type == self::LIST_OPENLINE)
	{
		foreach ($result as $botId => $botData)
		{
			if ($botData['OPENLINE'] != 'Y' || $botData['CODE'] == 'marta')
			{
				unset($result[$botId]);
			}
		}
	}

	return $result;
}