• Модуль: translate
  • Путь к файлу: ~/bitrix/modules/translate/lib/controller/editor/cleanethalon.php
  • Класс: BitrixTranslateControllerEditorCleanEthalon
  • Вызов: CleanEthalon::runClearing
private function runClearing(): array
{
	$processedItemCount = 0;
	for ($pos = ((int)$this->seekOffset > 0 ? (int)$this->seekOffset : 0), $total = count($this->pathList); $pos < $total; $pos ++)
	{
		$testPath = $this->pathList[$pos];

		// file
		if (TranslateIOPath::isPhpFile($testPath))
		{
			$this->cleanLangFile($testPath);
		}

		// folder
		else
		{
			if (mb_substr($testPath, -5) === '/lang')
			{
				$testPath .= '/#LANG_ID#';
			}
			else
			{
				$testPath = TranslateIOPath::replaceLangId($testPath, '#LANG_ID#');
			}

			foreach ($this->lookThroughLangFolder($testPath) as $filePaths)
			{
				foreach ($filePaths as $langFilePath => $fullPaths)
				{
					if (!empty($this->seekLangPath))
					{
						if ($this->seekLangPath == $langFilePath)
						{
							$this->seekLangPath = null;
						}

						continue;
					}

					$this->cleanLangFile($langFilePath);

					if ($this->instanceTimer()->hasTimeLimitReached())
					{
						$this->seekLangPath = $langFilePath;
						break 3;
					}
				}

				$this->seekLangPath = null;
			}
		}

		$processedItemCount ++;

		if (isset($this->pathList[$pos + 1]))
		{
			$this->seekOffset = $pos + 1;//next
		}
		else
		{
			$this->seekOffset = null;
			$this->declareAccomplishment();
			$this->clearProgressParameters();
		}

		if ($this->instanceTimer()->hasTimeLimitReached())
		{
			break;
		}
	}

	$this->processedItems += $processedItemCount;

	if ($this->instanceTimer()->hasTimeLimitReached() !== true)
	{
		$this->declareAccomplishment();
		$this->clearProgressParameters();
	}

	return [
		'PROCESSED_ITEMS' => $this->processedItems,
		'TOTAL_ITEMS' => $this->totalItems,
	];
}