Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
messageindexstepper.php
1<?php
2
3namespace Bitrix\Mail\Helper;
4
7
9{
10 const INDEX_VERSION = 1;
11
12 protected static $moduleId = 'mail';
13
14 public function execute(array &$option)
15 {
16 $option['steps'] = Mail\MailMessageTable::getCount(array(
17 '=INDEX_VERSION' => static::INDEX_VERSION,
18 ));
19 $option['count'] = Mail\MailMessageTable::getCount(array(
20 '<=INDEX_VERSION' => static::INDEX_VERSION,
21 ));
22
23 if ($option['steps'] >= $option['count'])
24 {
25 return false;
26 }
27
28 $res = Mail\MailMessageTable::getList(array(
29 'select' => array(
30 'ID',
31 'FIELD_FROM', 'FIELD_REPLY_TO',
32 'FIELD_TO', 'FIELD_CC', 'FIELD_BCC',
33 'SUBJECT', 'BODY',
34 ),
35 'filter' => array(
36 '<INDEX_VERSION' => static::INDEX_VERSION,
37 ),
38 'order' => array('ID' => 'ASC'),
39 'limit' => 1000,
40 ));
41
42 while ($item = $res->fetch())
43 {
44 $option['steps']++;
45
46 $fields = array(
47 'SEARCH_CONTENT' => Message::prepareSearchContent($item),
48 'INDEX_VERSION' => static::INDEX_VERSION,
49 );
50
51 Mail\MailMessageTable::update($item['ID'], $fields);
52 }
53
54 return true;
55 }
56
57}