Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
fileindex.php
1<?php
2
4
8
39{
40 use Index\Internals\BulkOperation;
41
47 public static function getTableName(): string
48 {
49 return 'b_translate_file';
50 }
51
57 public static function getObjectClass(): string
58 {
59 return Index\FileIndex::class;
60 }
61
67 public static function getCollectionClass(): string
68 {
69 return Index\FileIndexCollection::class;
70 }
71
77 public static function getMap(): array
78 {
79 return [
80 'ID' => [
81 'data_type' => 'integer',
82 'primary' => true,
83 'autocomplete' => true,
84 ],
85 'PATH_ID' => [
86 'data_type' => 'integer',
87 ],
88 'LANG_ID' => [
89 'data_type' => 'string',
90 ],
91 'FULL_PATH' => [
92 'data_type' => 'string',
93 ],
94 'PHRASE_COUNT' => [
95 'data_type' => 'integer',
96 ],
97 'INDEXED' => [
98 'data_type' => 'boolean',
99 'values' => ['N', 'Y'],
100 'default_value' => 'N',
101 ],
102 'INDEXED_TIME' => [
103 'data_type' => 'datetime',
104 ],
105 'PATH' => [
106 'data_type' => Index\Internals\PathIndexTable::class,
107 'reference' => [
108 '=this.PATH_ID' => 'ref.ID',
109 ],
110 'join_type' => 'INNER',
111 ],
112 ];
113 }
114
115
123 public static function purge(?Translate\Filter $filter = null): void
124 {
125 Index\Internals\PhraseIndexTable::purge($filter);
126
127 $filterOut = static::processFilter($filter);
128
129 static::bulkDelete($filterOut);
130 }
131
139 public static function processFilter(?Translate\Filter $filter = null): array
140 {
141 $filterOut = [];
142
143 if ($filter !== null)
144 {
145 foreach ($filter as $key => $value)
146 {
147 if (empty($value) && $value !== '0')
148 {
149 continue;
150 }
151
152 if ($key === 'path')
153 {
154 $filterOut['=%PATH.PATH'] = $value.'%';
155 }
156 elseif ($key === 'pathId')
157 {
158 $filterOut['=PATH_ID'] = $value;
159 }
160 elseif ($key === 'langId')
161 {
162 $filterOut['=LANG_ID'] = $value;
163 }
164 elseif ($key === 'fileId')
165 {
166 $filterOut['=ID'] = $value;
167 }
168 elseif ($key === 'indexedTime')
169 {
170 $filterOut['<INDEXED_TIME'] = $value;
171 }
172 else
173 {
174 if (static::getEntity()->hasField(trim($key, '<>!=@~%*')))
175 {
176 $filterOut[$key] = $value;
177 }
178 }
179 }
180 }
181
182 return $filterOut;
183 }
184}
static processFilter(?Translate\Filter $filter=null)
static purge(?Translate\Filter $filter=null)