• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/mail/internal/blacklist.php
  • Класс: BitrixMainMailInternalBlacklistTable
  • Вызов: BlacklistTable::insertBatch
static function insertBatch(array $list)
{
	$connection = Application::getConnection();
	$helper = $connection->getSqlHelper();
	$tableName = static::getTableName();
	$dateNow = $helper->convertToDbDateTime(new DateTime());

	foreach (self::divideList($list) as $batchList)
	{
		$values = [];
		foreach ($batchList as $code)
		{
			$code = trim($code);
			if (!$code)
			{
				continue;
			}

			$code = $helper->forSql($code);
			$values[] = "$dateNow, "$code"";
		}

		if (empty($values))
		{
			return;
		}

		$values = '(' . implode('), (', $values) . ')';

		$sql = $helper->getInsertIgnore($tableName, '(DATE_INSERT, CODE)', 'VALUES ' . $values);
		$connection->query($sql);

		static::getEntity()->cleanCache();
	}
}