• Модуль: translate
  • Путь к файлу: ~/bitrix/modules/translate/lib/controller/editor/cleanethalon.php
  • Класс: BitrixTranslateControllerEditorCleanEthalon
  • Вызов: CleanEthalon::run
public function run($pathList)
{
	if ($this->isNewProcess)
	{
		$pathList = preg_split("/[rn]+/", $pathList);
		array_walk($pathList, 'trim');
		$pathList = array_unique(array_filter($pathList));

		if (empty($pathList))
		{
			$this->addError(new MainError(Loc::getMessage('TR_CLEAN_EMPTY_PATH_LIST')));

			return [
				'STATUS' => TranslateControllerSTATUS_COMPLETED,
			];
		}

		foreach ($pathList as $testPath)
		{
			if (TranslateIOPath::isPhpFile($testPath))
			{
				if (TranslateIOPath::isLangDir($testPath))
				{
					$this->pathList[] = $testPath;
				}
				else
				{
					$this->addError(new MainError(Loc::getMessage('TR_CLEAN_FILE_NOT_LANG', ['#FILE#' => $testPath])));
				}
			}
			else
			{
				if (TranslateIOPath::isLangDir($testPath))
				{
					$this->pathList[] = $testPath;
				}
				else
				{
					// load lang folders
					$pathFilter = [];
					$pathFilter[] = [
						'LOGIC' => 'OR',
						'=PATH' => rtrim($testPath, '/'),
						'=%PATH' => rtrim($testPath, '/'). '/%'
					];
					$pathLangRes = IndexInternalsPathLangTable::getList([
						'filter' => $pathFilter,
						'order' => ['ID' => 'ASC'],
						'select' => ['PATH'],
					]);
					while ($pathLang = $pathLangRes->fetch())
					{
						$this->pathList[] = $pathLang['PATH'];
					}
				}
			}
		}

		$this->totalItems = count($this->pathList);
		$this->processedItems = 0;

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

		$this->saveProgressParameters();
		$this->isNewProcess = false;
	}

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