- Модуль: translate
- Путь к файлу: ~/bitrix/modules/translate/lib/controller/asset/apply.php
- Класс: BitrixTranslateControllerAssetApply
- Вызов: Apply::lookThroughTmpFolder
private function lookThroughTmpFolder($tmpFolderFullPath): iterable
{
$files = [];
$folders = [];
$tmpFolderFullPath = TranslateIOPath::tidy(rtrim($tmpFolderFullPath, '/'));
$langFolderRelPath = str_replace($this->sourceFolderPath, '', $tmpFolderFullPath);
$childrenList = TranslateIOFileSystemHelper::getFileList($tmpFolderFullPath);
if (!empty($childrenList))
{
foreach ($childrenList as $fullPath)
{
if (!empty($this->seekPath))
{
if ($this->seekPath != $fullPath)
{
continue;
}
$this->seekPath = null;
$this->seekAncestors = null;
}
$name = basename($fullPath);
if (in_array($name, TranslateIGNORE_FS_NAMES))
{
continue;
}
if (TranslateIOPath::isPhpFile($fullPath, true))
{
$files[$langFolderRelPath.'/'.$name] = $fullPath;
}
}
}
// dir only
$childrenList = TranslateIOFileSystemHelper::getFolderList($tmpFolderFullPath);
if (!empty($childrenList))
{
foreach ($childrenList as $fullPath)
{
$name = basename($fullPath);
if (in_array($name, TranslateIGNORE_FS_NAMES))
{
continue;
}
if (!empty($this->seekPath))
{
if (in_array($fullPath, $this->seekAncestors))
{
foreach ($this->lookThroughTmpFolder($fullPath) as $subFiles)// go deeper
{
yield $subFiles;
}
}
continue;
}
if (!is_dir($fullPath))
{
continue;
}
$relPath = $langFolderRelPath.'/'.$name;
if (in_array($relPath, TranslateIGNORE_BX_NAMES))
{
continue;
}
$folders[$relPath] = $fullPath;
}
}
if (count($files) > 0)
{
yield $files;
}
if (count($folders) > 0)
{
foreach ($folders as $subFolderPath)
{
foreach ($this->lookThroughTmpFolder($subFolderPath) as $subFiles)// go deeper
{
yield $subFiles;
}
}
}
}