- Модуль: translate
- Путь к файлу: ~/bitrix/modules/translate/lib/controller/index/collectlangpath.php
- Класс: BitrixTranslateControllerIndexCollectLangPath
- Вызов: CollectLangPath::runIndexing
private function runIndexing(): array
{
$indexer = new IndexPathLangCollection();
$processedItemCount = 0;
for ($pos = ((int)$this->seekOffset > 0 ? (int)$this->seekOffset : 0), $total = count($this->pathList); $pos < $total; $pos ++)
{
$filter = new TranslateFilter();
if (!empty($this->languages))
{
$filter->langId = $this->languages;
}
$testPath = $this->pathList[$pos];
if (preg_match("#(.+/lang)(/?w*)#", $testPath, $matches))
{
$filter->path = $matches[1];
$indexer->purge($filter);
$processedItemCount += $indexer->collect($filter);//++1
}
else
{
$filter->path = $testPath;
$seek = new TranslateFilter();
$seek->lookForSeek = false;
if (!empty($this->seekPath))
{
$seek->path = $this->seekPath;
$seek->lookForSeek = true;
}
else
{
$indexer->purge($filter);
}
$processedItemCount += $indexer->collect($filter, $this->instanceTimer(), $seek);
if ($this->instanceTimer()->hasTimeLimitReached())
{
if (isset($seek->nextPath))
{
$this->seekPath = $seek->nextPath;
}
break;
}
$this->seekPath = null;
}
// check user abortion
if (connection_status() !== CONNECTION_NORMAL)
{
throw new MainSystemException('Process has been broken course user aborted connection.');
}
if (isset($this->pathList[$pos + 1]))
{
$this->seekOffset = $pos + 1;//next
}
else
{
$this->seekOffset = null;
$this->declareAccomplishment();
$this->clearProgressParameters();
}
if ($this->instanceTimer()->hasTimeLimitReached())
{
break;
}
}
$this->processedItems += $processedItemCount;
$this->totalItems += $processedItemCount;
if ($this->instanceTimer()->hasTimeLimitReached() !== true)
{
$this->processedItems = $this->totalItems = (new IndexPathIndexCollection())->countItemsToProcess($filter);
$this->declareAccomplishment();
$this->clearProgressParameters();
}
return [
'PROCESSED_ITEMS' => $this->processedItems,
'TOTAL_ITEMS' => $this->totalItems,
];
}