• Модуль: translate
  • Путь к файлу: ~/bitrix/modules/translate/lib/index/pathindexcollection.php
  • Класс: BitrixTranslateIndexPathIndexCollection
  • Вызов: PathIndexCollection::collectModuleAssignment
public function collectModuleAssignment(TranslateFilter $filter = null): self
{
	$searchPath = isset($filter, $filter->path) ? $filter->path : '';

	if (!empty($searchPath))
	{
		$pathStartRes = IndexInternalsPathIndexTable::getList([
			'filter' => [
				'=PATH' => $searchPath,
			],
			'select' => ['ID', 'PATH'],
		]);
		if ($path = $pathStartRes->fetchObject())
		{
			$relPathParts = explode('/', trim($path->getPath(), '/'));

			// /bitrix/modules/[smth]/
			if (count($relPathParts) >= 3 && $relPathParts[0] == 'bitrix' && $relPathParts[1] == 'modules')
			{
				$moduleId = $path->detectModuleId();
				if ($moduleId !== null)
				{
					IndexInternalsPathIndexTable::bulkUpdate(
						['MODULE_ID' => $moduleId],
						['=DESCENDANTS.PARENT_ID' => $path->getId()]
					);
				}
			}

			//todo: else select sub nodes
		}

	}
	else
	{
		$pathModulesRes = IndexInternalsPathIndexTable::getList([
			'filter' => [
				'=PATH' => '/bitrix/modules',
			],
			'select' => ['ID'],
		]);
		while ($pathModules = $pathModulesRes->fetch())
		{
			$pathList = IndexInternalsPathIndexTable::getList([
				'filter' => [
					'=PARENT_ID' => $pathModules['ID'],
				],
				'select' => ['ID', 'PATH'],
			]);
			while ($path = $pathList->fetchObject())
			{
				$moduleId = $path->detectModuleId();
				if ($moduleId !== null)
				{
					IndexInternalsPathIndexTable::bulkUpdate(
						['MODULE_ID' => $moduleId],
						['=DESCENDANTS.PARENT_ID' => $path->getId()]
					);
				}
			}
		}
	}

	return $this;
}