1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
messagesearchcontentstepper.php
См. документацию.
1<?php
2
3namespace Bitrix\Mail\Helper;
4use Bitrix\Main;
5use Bitrix\Mail;
6
8{
9 private const LIMIT = 100;
10 protected static $moduleId = 'mail';
11
12 public function execute(array &$option): bool
13 {
14 if (empty($option))
15 {
16 $option['lastId'] = 0;
17 $maxId = Mail\MailMessageTable::getList([
18 'order' => ['ID' => 'DESC'],
19 'limit' => 1,
20 'select' => ['ID'],
21 ])->fetch();
22 $option['maxId'] = (int) $maxId['ID'];
23 }
24
25 if ($option['lastId'] >= $option['maxId'])
26 {
27 return self::FINISH_EXECUTION;
28 }
29
30 $result = Mail\MailMessageTable::getList([
31 'select' => [
32 'ID',
33 'SEARCH_CONTENT',
34 ],
35 'filter' => [
36 '><ID' => [max($option['lastId'], 0),$option['maxId']],
37 ],
38 'order' => ['ID' => 'ASC'],
39 'limit' => self::LIMIT,
40 ]);
41
42 while ($message = $result->fetch())
43 {
44 $message['SEARCH_CONTENT'] = self::isolateBase64Files(str_rot13($message['SEARCH_CONTENT']));
45 Mail\MailMessageTable::update($message['ID'], [
46 'SEARCH_CONTENT' => $message['SEARCH_CONTENT'],
47 ]);
48
49 $option['lastId'] = $message['ID'];
50 }
51
52 return self::CONTINUE_EXECUTION;
53 }
54
55
56 private function isolateBase64Files(string $text): string
57 {
58 $pattern = '/\[\s*data:(?!text\b)[^;]+;base64,\S+ \]/';
59 $clearText = preg_replace($pattern, '', $text);
60 return str_rot13($clearText);
61 }
62}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$message
Определения payment.php:8
$text
Определения template_pdf.php:79
$option
Определения options.php:1711
if(!Loader::includeModule('sale')) $pattern
Определения index.php:20