Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
messagedisappearing.php
1
<?php
2
namespace
Bitrix\Im\Update
;
3
4
use
Bitrix\Im\V2\Message
;
5
use
Bitrix\Main\Application
;
6
use
Bitrix\Main\Type\DateTime
;
7
8
class
MessageDisappearing
9
{
10
public
static
function
disappearMessagesAgent
(): string
11
{
12
$connection =
Application::getConnection
();
13
14
$messagesQuery = $connection->query(
"
15
SELECT MESSAGE_ID
16
FROM b_im_message_disappearing
17
WHERE DATE_REMOVE < '"
. (
new
DateTime
())->format(
'Y-m-d H:i:s'
) .
"'
18
"
);
19
$messages = $messagesQuery->fetchAll();
20
21
22
if
(empty($messages))
23
{
24
return
__METHOD__ .
'();'
;
25
}
26
27
foreach
($messages as $message)
28
{
29
$message =
new
Message
($message[
'MESSAGE_ID'
]);
30
if
($message->getId())
31
{
32
$message->deleteComplete();
33
}
34
}
35
36
return
__METHOD__ .
'();'
;
37
}
38
}
Bitrix\Im\Update\MessageDisappearing
Definition
messagedisappearing.php:9
Bitrix\Im\Update\MessageDisappearing\disappearMessagesAgent
static disappearMessagesAgent()
Definition
messagedisappearing.php:10
Bitrix\Im\V2\Message
Definition
Message.php:44
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getConnection
static getConnection($name="")
Definition
application.php:611
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Im\Update
Definition
bot.php:2
Bitrix\Im\V2\Message
Definition
AdditionalMessagePopupItem.php:3
modules
im
lib
update
messagedisappearing.php
Создано системой
1.10.0