• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/component/logentry.php
  • Класс: BitrixSocialnetworkComponentLogEntry
  • Вызов: LogEntry::deleteComment
static function deleteComment(array $params = [])
{
	global $APPLICATION;

	$result = false;

	$logId = (int)($params['logId'] ?? 0);
	$commentId = (int)($params['commentId'] ?? 0);

	if (
		$logId <= 0
		|| $commentId <= 0
	)
	{
		throw new ArgumentException('Wrong method parameters');
	}

	$commentFields = CSocNetLogComponent::getCommentByRequest($commentId, $logId, 'delete');
	if (!$commentFields)
	{
		throw new AccessDeniedException('Cannot get comment');
	}

	if (!CSocNetLogComments::delete($commentFields['ID'], true))
	{
		if ($e = $APPLICATION->getException())
		{
			throw new SystemException($e->getString());
		}
	}
	else
	{
		$result = (int)(
			$commentFields['SOURCE_ID'] > 0
				? $commentFields['SOURCE_ID']
				: $commentFields['ID']
		);
	}

	return $result;
}