Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
messagedisappearing.php
1<?php
2namespace Bitrix\Im\Update;
3
7
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}
static getConnection($name="")