• Модуль: translate
  • Путь к файлу: ~/bitrix/modules/translate/lib/controller/asset/applypublic.php
  • Класс: BitrixTranslateControllerAssetApplyPublic
  • Вызов: ApplyPublic::run
public function run()
{
	// continue previous process
	$progressParams = $this->getProgressParameters();

	$updatePublic = $this->controller->getRequest()->get('updatePublic');
	if ($updatePublic === null || $updatePublic !== 'Y')
	{
		// finish it
		return [
			'STATUS' => TranslateControllerSTATUS_COMPLETED,
			'PROCESSED_ITEMS' => $progressParams['totalFileCount'],
			'TOTAL_ITEMS' => $progressParams['totalItems'],
		];
	}


	$this->languageId = $progressParams['languageId'];
	$this->tmpFolderPath = $progressParams['tmpFolderPath'];
	$this->totalFileCount = $progressParams['totalFileCount'];


	if ($this->isNewProcess)
	{
		$this->totalItems = $this->totalFileCount;
		$this->processedItems = 0;

		// language
		$languageId = $this->controller->getRequest()->get('languageId');
		if (empty($languageId))
		{
			$this->addError(new MainError(Loc::getMessage('TR_ERROR_SELECT_LANGUAGE')));
		}
		if (!in_array($languageId, self::$enabledLanguages))
		{
			$this->addError(new MainError(Loc::getMessage('TR_ERROR_LANGUAGE_ID')));
		}
		else
		{
			$this->languageId = $languageId;
		}

		$this->sourceFolderPath = TranslateIOPath::tidy($this->tmpFolderPath .'/'. $this->languageId. '/');

		$sourceDirectory = new TranslateIODirectory($this->sourceFolderPath);
		if (!$sourceDirectory->isExists())
		{
			$this->addError(
				new Error(Loc::getMessage('TR_ERROR_CREATE_TARGET_FOLDER', ['#PATH#' => $this->sourceFolderPath]))
			);
		}

		$this->saveProgressParameters();

		return [
			'STATUS' => ($this->totalItems > 0 ? TranslateControllerSTATUS_PROGRESS : TranslateControllerSTATUS_COMPLETED),
			'PROCESSED_ITEMS' => 0,
			'TOTAL_ITEMS' => $this->totalItems,
		];
	}

	$this->targetFolderPath = $progressParams['targetFolderPath'];
	$this->seekPath = $progressParams['seekPath'];
	$this->seekModule = $progressParams['seekModule'];
	$this->seekType = $progressParams['seekType'];

	return $this->performStep('runApplying');
}