115 if (isset($seek, $seek->path))
117 $seekAncestors = \explode(
'/', \trim($seek->path,
'/'));
118 $seek->lookForSeek =
true;
121 $checkLanguages = [];
122 if (self::$useTranslationRepository)
124 $checkLanguages = self::$translationEnabledLanguages;
127 $checkLanguages = \array_intersect(
$filter->langId, $checkLanguages);
131 $pathDepthLevel =
\count(\explode(
'/', \trim(
$relPath,
'/'))) - 1;
134 $processedItemCount = 0;
142 $lookForLangDirectory =
function ($startRoot,
$relPath, $depthLevel, $isTop =
false)
143 use (&$lookForLangDirectory, &$cache, $checkLanguages, &$seek, $seekAncestors, &$processedItemCount)
147 $mergeChildrenList =
function($childrenList0, $langId =
'') use (&$childrenList)
149 foreach ($childrenList0 as $childPath)
151 $name = \basename($childPath);
156 if (isset($childrenList[
$name]))
161 if (self::$useTranslationRepository && $langId !=
'')
163 $childPath = \str_replace(
164 self::$translationRepositoryRoot.
'/'. $langId,
165 self::$documentRoot.
'/bitrix/modules',
170 $childrenList[
$name] = $childPath;
176 if (self::$useTranslationRepository)
178 foreach ($checkLanguages as $langId)
181 if ($path1 != $startRoot)
183 $mergeChildrenList(
Translate\
IO\FileSystemHelper::getFolderList($path1), $langId);
188 if (!empty($childrenList))
191 foreach ($childrenList as $childPath)
193 $name = \basename($childPath);
194 $relChildPath = \str_replace($startRoot,
'', $childPath);
205 if (\preg_match(
"#/bitrix/modules/[^/]+/({$ignoreDev})$#", $relChildPath))
210 $isLang = (
$name ==
'lang');
212 if ($seek !==
null && $seek->lookForSeek ===
true)
214 if ($seekAncestors[$depthLevel + 1] ==
$name)
216 if ($relChildPath == $seek->path)
220 echo
"Seek folder: {$relChildPath}\n";
222 $seek->lookForSeek =
false;
228 foreach ($lookForLangDirectory($startRoot, $relChildPath, $depthLevel + 1) as $subChildPath)
240 'PATH' => $relChildPath,
243 if (\
count($cache) >= 50)
245 Index\Internals\PathLangTable::bulkAdd($cache);
246 $processedItemCount +=
\count($cache);
252 foreach ($lookForLangDirectory($startRoot, $relChildPath, $depthLevel + 1) as $subChildPath)
265 if ($isTop && \
count($cache) > 0)
267 Index\Internals\PathLangTable::bulkAdd($cache);
268 $processedItemCount +=
\count($cache);
273 foreach ($lookForLangDirectory(self::$documentRoot,
$relPath, $pathDepthLevel,
true) as $langPath)
277 if (!$langPath instanceof \Generator)
279 echo
"Lang folder: {$langPath}\n";
284 if ($timer->hasTimeLimitReached())
286 $seek->nextPath = $langPath;
291 if (\connection_status() !== \CONNECTION_NORMAL)
297 if (\
count($cache) > 0)
299 Index\Internals\PathLangTable::bulkAdd($cache);
300 $processedItemCount +=
\count($cache);
303 return $processedItemCount;