• Модуль: translate
  • Путь к файлу: ~/bitrix/modules/translate/lib/controller/asset/pack.php
  • Класс: BitrixTranslateControllerAssetPack
  • Вызов: Pack::runPacking
private function runPacking(): array
{
	$langDir = new TranslateIODirectory($this->tmpFolderPath);

	$this->totalItems = $this->totalFileCount;

	$result = [];

	switch ($this->archiveFile->pack($langDir, $this->seekPath))
	{
		case IBXArchive::StatusContinue:
			$this->seekPath = $this->archiveFile->getSeekPosition();
			$this->processedItems += $this->archiveFile->getProcessedFileCount();

			$this->saveProgressParameters();
			break;

		case IBXArchive::StatusSuccess:
			$this->processedItems += $this->archiveFile->getProcessedFileCount();
			$this->declareAccomplishment();

			$this->downloadParams = $this->getDownloadingParameters();
			$result['FILE_NAME'] = $this->downloadParams['fileName'];
			$result['DOWNLOAD_LINK'] = $this->generateDownloadLink();

			$messagePlaceholders = [
				'#TOTAL_FILES#' => $this->processedItems,
				'#FILE_SIZE_FORMAT#' => CFile::formatSize($this->downloadParams['fileSize']),
				'#LANG#' => mb_strtoupper($this->languageId),
				'#FILE_PATH#' => $this->archiveFileName,
				'#LINK#' => $result['DOWNLOAD_LINK'],
			];

			$result['SUMMARY'] =
				Loc::getMessage('TR_LANGUAGE_COLLECTED_ARCHIVE', $messagePlaceholders)."n".
				Loc::getMessage('TR_PACK_ACTION_EXPORT', $messagePlaceholders);

			// we have to continue process in next action
			$this->processToken = null;
			$this->seekPath = null;
			$this->saveProgressParameters();
			break;

		case IBXArchive::StatusError:
			if ($this->archiveFile->hasErrors())
			{
				$this->addErrors($this->archiveFile->getErrors());
			}
			else
			{
				$this->addError(
					new MainError(Loc::getMessage('TR_ERROR_ARCHIVE'))
				);
			}
			break;
	}

	$result['PROCESSED_ITEMS'] = $this->processedItems;
	$result['TOTAL_ITEMS'] = $this->totalItems;

	return $result;

}