CollectFileIndex :: run: Bitrix method

      
<?php 
//  Bitrix\Translate\Controller\Index\CollectFileIndex :: run()
//  /dist/bitrix/modules/translate/lib/controller/index/collectfileindex.php:42

    
public function run($path '')
    {
        if (empty(
$path))
        {
            
$path Translate\Config::getDefaultPath();
        }

        if (
preg_match("#(.+\/lang)(\/?\w*)#"$path$matches))
        {
            
$path $matches[1];
        }

        
$path '/'trim($path'/.\\');

        
// skip indexing if index exists
        
if (Main\Context::getCurrent()->getRequest()->get('checkIndexExists') === 'Y')
        {
            
$indexPath Translate\Index\PathIndex::loadByPath($path);
            if (
$indexPath instanceof Translate\Index\PathIndex)
            {
                if (
$indexPath->getIndexed())
                {
                    return array(
                        
'STATUS' => Translate\Controller\STATUS_COMPLETED
                    
);
                }
            }
        }

        if (
$this->isNewProcess)
        {
            
$this->totalItems = (new Index\FileIndexCollection())->countItemsToProcess(new Translate\Filter(['path' => $path]));

            
$this->saveProgressParameters();

            
$this->instanceTimer()->setTimeLimit(5);
            
$this->isNewProcess false;
        }
        else
        {
            
$progressParams $this->getProgressParameters();

            if (isset(
$progressParams['totalItems']) && (int)$progressParams['totalItems'] > 0)
            {
                
$this->totalItems = (int)$progressParams['totalItems'];
                
$this->processedItems = (int)$progressParams['processedItems'];
            }

            if (isset(
$progressParams['seekPathId']))
            {
                
$this->seekPathId $progressParams['seekPathId'];
            }
        }

        return 
$this->performStep('runIndexing', ['path' => $path]);
    }