Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
storage.php
1<?php
2
4
12
14
15Loc::loadMessages(__FILE__);
16
45{
51 public static function getTableName()
52 {
53 return 'b_rest_configuration_storage';
54 }
55
61 public static function getMap()
62 {
63 return [
64 new IntegerField(
65 'ID',
66 [
67 'primary' => true,
68 'autocomplete' => true,
69 ]
70 ),
71 new DatetimeField(
72 'CREATE_TIME',
73 [
74 'required' => true,
75 ]
76 ),
77 new StringField(
78 'CONTEXT',
79 [
80 'required' => true,
81 'validation' => [__CLASS__, 'validateContext'],
82 ]
83 ),
84 new StringField(
85 'CODE',
86 [
87 'required' => true,
88 'validation' => [__CLASS__, 'validateCode'],
89 ]
90 ),
91 new ArrayField(
92 'DATA',
93 [
94 'required' => true,
95 ]
96 ),
97 ];
98 }
99
105 public static function validateContext()
106 {
107 return [
108 new LengthValidator(null, 128),
109 ];
110 }
111
117 public static function validateCode()
118 {
119 return [
120 new LengthValidator(null, 32),
121 ];
122 }
123
124 public static function deleteByFilter($filter)
125 {
126 $res = static::getList(
127 [
128 'filter' => $filter
129 ]
130 );
131 while ($item = $res->fetch())
132 {
133 static::deleteFile($item);
134 static::delete($item['ID']);
135 }
136 }
137
138 public static function deleteFile($item)
139 {
140 if (
141 isset($item['DATA']['ID'])
142 && (int) $item['DATA']['ID'] > 0
143 && (
145 || mb_strpos($item['CODE'], Structure::CODE_CUSTOM_FILE) !== false
146 )
147 )
148 {
149 \CFile::Delete((int) $item['DATA']['ID']);
150 }
151 }
152}
static loadMessages($file)
Definition loc.php:64