Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
channel.php
1<?php
3
4class Channel
5{
6 public static function updatePublicChannelIdAgent()
7 {
8 global $CACHE_MANAGER;
9
10 $hasChannels = false;
11
12 $connection = \Bitrix\Main\Application::getInstance()->getConnection();
13 $sqlDate = $connection->getSqlHelper()->addDaysToDateTime(-1);
14
15 $channels = $connection->query("
16 SELECT ID, USER_ID, CHANNEL_TYPE
17 FROM b_pull_channel
18 WHERE DATE_CREATE > {$sqlDate} AND USER_ID <> 0 AND CHANNEL_PUBLIC_ID IS NULL
19 LIMIT 100
20 ");
21 while ($channel = $channels->fetch())
22 {
23 $hasChannels = true;
24 $connection->query("UPDATE b_pull_channel SET CHANNEL_PUBLIC_ID = '".\CPullChannel::GetNewChannelId('public')."' WHERE ID = ".$channel['ID']);
25 $CACHE_MANAGER->Clean("b_pchc_".$channel['ID'].'_'.$channel['CHANNEL_TYPE'], "b_pull_channel");
26 }
27
28 return $hasChannels ? __METHOD__. '();' : '';
29 }
30}
static updatePublicChannelIdAgent()
Definition channel.php:6