- Модуль: imconnector
- Путь к файлу: ~/bitrix/modules/imconnector/lib/update/updatemicrosoftbotframework.php
- Класс: BitrixImconnectorUpdateUpdateMicrosoftBotFramework
- Вызов: UpdateMicrosoftBotFramework::sendNotifications
static function sendNotifications($notice = true): bool
{
$result = false;
$idMessage = 'IMCONNECTOR_UPDATER_NOTICE_BOTFRAMEWORK_';
if($notice === false)
{
$idMessage = 'IMCONNECTOR_UPDATER_DISCONNECT_OLD_BOTFRAMEWORK_';
}
if (
Loader::includeModule('imopenlines')
&& Loader::includeModule('imconnector')
&& Loader::includeModule('ui')
)
{
$activeConnections = StatusConnectorsTable::getList([
'select' => ['LINE'],
'filter' => [
'=CONNECTOR' => self::CONNECTOR_ID,
'=ACTIVE' => 'Y',
'=CONNECTION' => 'Y',
'=REGISTER' => 'Y',
],
]);
while ($row = $activeConnections->fetch())
{
$lineIds[] = $row['LINE'];
}
if(!empty($lineIds))
{
if (
Loader::includeModule('bitrix24')
&& Loader::includeModule('imbot')
)
{
$lineIds = array_unique($lineIds);
$queueLine = QueueTable::getList([
'select' => ['USER_ID'],
'filter' => [
'=CONFIG_ID' => $lineIds,
],
]);
while ($row = $queueLine->fetch())
{
$userIds[] = $row['USER_ID'];
}
if (empty($userIds))
{
$userIds = ['ADMIN'];
}
else
{
$admins = Support24::getAdministrators();
$userIds = array_merge($userIds, $admins);
$userIds = array_unique($userIds);
}
foreach ($userIds as $userId)
{
Support24::sendMessage([
'DIALOG_ID' => $userId,
'MESSAGE' => Loc::getMessage($idMessage . 'CHAT', [
'#A_START#' => '[URL=' . UIUtil::getArticleUrlByCode(self::ARTICLE_CODE) . ']',
'#A_END#' => '[/URL]',
]),
'SYSTEM' => 'N',
'URL_PREVIEW' => 'N'
]);
}
}
else
{
CAdminNotify::Add([
'MODULE_ID' => 'imconnector',
'ENABLE_CLOSE' => 'Y',
'NOTIFY_TYPE' => CAdminNotify::TYPE_NORMAL,
'MESSAGE' => Loc::getMessage($idMessage . 'ADMIN_NOTIFY', [
'#HREF#' => UIUtil::getArticleUrlByCode(self::ARTICLE_CODE),
]),
]);
}
$result = true;
}
}
return $result;
}