Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
log.php
1<?
3
9
10Loc::loadMessages(__FILE__);
11
43class LogTable extends Main\Entity\DataManager
44{
50 public static function getTableName()
51 {
52 return "b_composite_log";
53 }
54
60 public static function getMap()
61 {
62 return array(
63 "ID" => array(
64 "data_type" => "integer",
65 "primary" => true,
66 "autocomplete" => true,
67 "title" => "ID"
68 ),
69 "HOST" => array(
70 "data_type" => "string",
71 "required" => true,
72 "validation" => array(__CLASS__, "validateHost"),
73 "title" => Loc::getMessage("LOG_ENTITY_HOST_FIELD")
74 ),
75 "URI" => array(
76 "data_type" => "string",
77 "required" => true,
78 "validation" => array(__CLASS__, "validateUri"),
79 "title" => Loc::getMessage("LOG_ENTITY_URI_FIELD")
80 ),
81 "TITLE" => array(
82 "data_type" => "string",
83 "validation" => array(__CLASS__, "validateTitle"),
84 "title" => Loc::getMessage("LOG_ENTITY_TITLE_FIELD")
85 ),
86 "CREATED" => array(
87 "data_type" => "datetime",
88 "required" => true,
89 "default_value" => new DateTime(),
90 "title" => Loc::getMessage("LOG_ENTITY_CREATED_FIELD"),
91 ),
92 "TYPE" => array(
93 "data_type" => "enum",
94 "required" => true,
95 "values" => Logger::getTypes(),
96 "default_value" => Logger::TYPE_MESSAGE,
97 "title" => Loc::getMessage("LOG_ENTITY_TYPE_FIELD"),
98 ),
99 "MESSAGE" => array(
100 "data_type" => "text",
101 "title" => Loc::getMessage("LOG_ENTITY_MESSAGE_FIELD"),
102 ),
103 "MESSAGE_SHORT" => array(
104 "data_type" => "text",
105 "expression" => array(
106 "case when %s = '".Logger::TYPE_CACHE_REWRITING."' then NULL else %s end",
107 "TYPE", "MESSAGE"
108 ),
109 "title" => Loc::getMessage("LOG_ENTITY_MESSAGE_FIELD"),
110 ),
111
112 "AJAX" => array(
113 "data_type" => "boolean",
114 "values" => array("N", "Y"),
115 "title" => Loc::getMessage("LOG_ENTITY_AJAX_FIELD"),
116 ),
117 "USER_ID" => array(
118 "data_type" => "integer",
119 "required" => true,
120 "default_value" => 0,
121 "title" => Loc::getMessage("LOG_ENTITY_USER_ID_FIELD"),
122 ),
123
124 "USER" => array(
125 "data_type" => "\\Bitrix\\Main\\UserTable",
126 "reference" => array(
127 "=this.USER_ID" => "ref.ID"
128 ),
129 "join_type" => "LEFT",
130 ),
131
132 "PAGE_ID" => array(
133 "data_type" => "integer",
134 "required" => true,
135 "default_value" => 0,
136 "title" => Loc::getMessage("LOG_ENTITY_PAGE_ID_FIELD"),
137 ),
138 );
139 }
145 public static function validateHost()
146 {
147 return array(
148 new Main\Entity\Validator\Length(null, 100),
149 );
150 }
151
157 public static function validateUri()
158 {
159 return array(
160 new Main\Entity\Validator\Length(null, 2000),
161 );
162 }
163
169 public static function validateTitle()
170 {
171 return array(
172 new Main\Entity\Validator\Length(null, 250),
173 );
174 }
175
179 public static function deleteAll()
180 {
181 $tableName = static::getTableName();
182 $connection = Application::getConnection();
183 $connection->queryExecute("DELETE FROM {$tableName}");
184 }
185}
static getConnection($name="")
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29