Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
utmupdater.php
1<?php
3
6
8{
13 public static function installAgent()
14 {
15 self::updateUtm();
16 return '';
17 }
18
22 private static function updateUtm() :void
23 {
24 $messages = MessageFieldTable::getList(
25 [
26 'select' => [
27 'MESSAGE_ID',
28 'VALUE'
29 ],
30 'filter' => [
31 '=CODE' => 'LINK_PARAMS'
32 ],
33 'limit' => 50,
34 'order' => [
35 'MESSAGE_ID' => 'desc'
36 ]
37 ]
38 )->fetchAll();
39
40 foreach ($messages as $message) {
41 parse_str($message['VALUE'],$utmTags);
42 MessageUtmTable::deleteByMessageId($message['MESSAGE_ID']);
43
44 foreach ($utmTags as $utmTag => $value)
45 {
46 MessageUtmTable::add(
47 [
48 'MESSAGE_ID' => $message['MESSAGE_ID'],
49 'CODE' => $utmTag,
50 'VALUE' => $value
51 ]
52 );
53 }
54 }
55 }
56}