• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/session/agent.php
  • Класс: BitrixImOpenLinesSessionAgent
  • Вызов: Agent::correctionStatusClosedSessionsAgent
static function correctionStatusClosedSessionsAgent(): string
{
	$query = new Query(SessionTable::getEntity());
	$query->setSelect([
		'ID',
		'CHECK_SESSION_ID' => 'CHECK.SESSION_ID'
	]);
	$query->setFilter([
		' Session::STATUS_CLOSE,
		'CLOSED' => 'Y'
	]);
	$query->setLimit(100);

	$sessionManager = $query->exec();
	while ($session = $sessionManager->fetch())
	{
		$resultSessionUpdate = SessionTable::update($session['ID'], ['STATUS' => Session::STATUS_CLOSE]);

		if ($resultSessionUpdate->isSuccess())
		{
			if ($session['CHECK_SESSION_ID'] > 0)
			{
				SessionCheckTable::delete($session['CHECK_SESSION_ID']);
			}
		}
	}

	return __METHOD__ . '();';
}