- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/classes/general/im_notify.php
- Класс: CIMNotify
- Вызов: CIMNotify::DeleteByTag
static function DeleteByTag($notifyTag, $authorId = false)
{
global $DB;
$notifyTag = (string)$notifyTag;
if ($notifyTag == '')
{
return false;
}
$sqlUser = "";
if ($authorId !== false)
{
$sqlUser = " AND M.AUTHOR_ID = ".intval($authorId);
}
$dbRes = $DB->Query("SELECT M.ID, M.NOTIFY_TYPE, R.USER_ID FROM b_im_relation R, b_im_message M WHERE M.CHAT_ID = R.CHAT_ID AND M.NOTIFY_TAG = '".$DB->ForSQL($notifyTag)."'".$sqlUser, false, "File: ".__FILE__."
Line: ".__LINE__);
$arUsers = Array();
$messages = Array();
while ($row = $dbRes->Fetch())
{
$messages[$row['ID']] = $row['NOTIFY_TYPE'];
$arUsers[$row['USER_ID']] = $row['USER_ID'];
}
$pullActive = false;
if (CModule::IncludeModule("pull"))
$pullActive = true;
foreach ($arUsers as $userId => $count)
{
CIMMessenger::SpeedFileDelete($userId, IM_SPEED_NOTIFY);
if ($pullActive)
{
CPushManager::DeleteFromQueueByTag($userId, $notifyTag);
}
}
if (count($messages) > 0)
{
self::deleteList(array_keys($messages));
}
return true;
}