- Модуль: translate
- Путь к файлу: ~/bitrix/modules/translate/lib/controller/export/exportfilelist.php
- Класс: BitrixTranslateControllerExportExportFileList
- Вызов: ExportFileList::run
public function run(string $path = '', bool $runBefore = false): array
{
if (empty($path))
{
$path = TranslateConfig::getDefaultPath();
}
// part of the path after /lang/
$subPath = '';
if (preg_match("#(.+/lang)(/?w*)#", $path, $matches))
{
if (preg_match("#(.+/lang/[^/]+/?)(.*)$#", $path, $subMatches))
{
$subPath = $subMatches[2];
}
$path = $matches[1];
}
unset($matches, $subMatches);
if ($runBefore)
{
$this->onBeforeRun();
}
if ($this->isNewProcess)
{
$this->totalItems = (int)IndexInternalsPathLangTable::getCount(['=%PATH' => $path.'%']);
$this->processedItems = 0;
if ($this->totalItems > 0)
{
$this->exportFileName = $this->generateExportFileName($path, $this->languages);
$csvFile = $this->createExportTempFile($this->exportFileName);
$this->exportFilePath = $csvFile->getPhysicalPath();
$this->exportFileSize = $csvFile->getSize();
}
if ($this->appendSamples)
{
$this->samplesFileName = $this->generateExportFileName($path.'-samples', $this->languages);
$sampleFile = $this->createExportTempFile($this->samplesFileName);
$this->samplesFilePath = $sampleFile->getPhysicalPath();
$this->samplesFileSize = $sampleFile->getSize();
}
$this->saveProgressParameters();
return [
'STATUS' => ($this->totalItems > 0 ? TranslateControllerSTATUS_PROGRESS : TranslateControllerSTATUS_COMPLETED),
'PROCESSED_ITEMS' => 0,
'TOTAL_ITEMS' => $this->totalItems,
'TOTAL_PHRASES' => $this->exportedPhraseCount,
'TOTAL_SAMPLES' => $this->exportedSamplesCount,
];
}
return $this->performStep('runExporting', ['path' => $path, 'subPath' => $subPath]);
}