Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/sale/lib/location/normalizer/ |
Upload File : |
<?php namespace Bitrix\Sale\Location\Normalizer; use Bitrix\Sale\Location\Name; /** * Class Helper * @package Bitrix\Sale\Location\Normalizer * Different service staff. */ final class Helper { /** * Fill locations NAME_NORM FIELD * @param int $startId Location name record ID. Start position. * @param int $timeout Processing timeout. * @return int Last processed ID. * @throws \Bitrix\Main\ArgumentException * @throws \Bitrix\Main\ObjectPropertyException * @throws \Bitrix\Main\SystemException */ public static function fillNormNameColumn($startId = 0, $timeout = 0, $limit = 100) { /** @var INormalizer[] $normalizers */ $startTime = microtime(false); $normalizers = []; $glParams = [ 'filter' => [ '>=ID' => $startId, '=NAME_NORM' => false ] ]; if($limit > 0) { $glParams['limit'] = $limit; } $res = Name\LocationTable::getList($glParams); $lastId = $startId; while($row = $res->fetch()) { if(!isset($normalizers[$row['LANGUAGE_ID']])) { $normalizers[$row['LANGUAGE_ID']] = \Bitrix\Sale\Location\Normalizer\Builder::build($row['LANGUAGE_ID']); } Name\LocationTable::update( $row['ID'], [ 'NAME_NORM' => $normalizers[$row['LANGUAGE_ID']]->normalize($row['NAME']) ] ); $lastId = $row['ID']; if($timeout && $startTime + $timeout >= microtime(false)) { break; } } return $lastId; } }