- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/lib/finderdest.php
- Класс: BitrixMainFinderDestTable
- Вызов: FinderDestTable::merge
static function merge(array $data)
{
global $USER;
$userId = (
isset($data['USER_ID']) && intval($data['USER_ID']) > 0
? intval($data['USER_ID'])
: (is_object($GLOBALS['USER']) ? $USER->getId() : 0)
);
if ($userId <= 0 || empty($data['CODE']) || empty($data['CONTEXT']) || !is_string($data['CONTEXT']))
{
return;
}
if (is_array($data['CODE']))
{
$dataModified = $data;
foreach ($data['CODE'] as $code)
{
$dataModified['CODE'] = $code;
FinderDestTable::merge($dataModified);
}
return;
}
if (!is_string($data['CODE']))
{
return;
}
foreach (MainUIEntitySelectorConverter::getCompatEntities() as $entityId => $entity)
{
if (preg_match('/'.$entity['pattern'].'/i', $data['CODE'], $matches))
{
$itemId = $matches['itemId'];
$prefix = $matches['prefix'];
if (isset($entity['itemId']) && is_callable($entity['itemId']))
{
$itemId = $entity['itemId']($prefix, $itemId);
}
parent::merge([
'USER_ID' => $userId,
'CONTEXT' => mb_strtoupper($data['CONTEXT']),
'ENTITY_ID' => $entityId,
'ITEM_ID' => $itemId,
'PREFIX' => mb_strtoupper($prefix)
]);
$cache = new CPHPCache;
$cache->cleanDir('/sonet/log_dest_sort/'.intval($userId / 100));
$cache->cleanDir(BitrixMainUISelectorEntities::getCacheDir([
'userId' => $userId,
]));
return;
}
}
}