-
Notifications
You must be signed in to change notification settings - Fork 638
/
LogEntry.php
485 lines (435 loc) · 8.07 KB
/
LogEntry.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
<?php
namespace TYPO3\CMS\Belog\Domain\Model;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* A sys log entry
* This model is 'complete': All current database properties are in there.
*
* @todo : This should be stuffed to some more central place
*/
class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* Storage page ID of the log entry
*
* @var int
*/
protected $pid = 0;
/**
* This is not a relation to BeUser model, since the user does
* not always exist, but we want the uid in then anyway.
* This case is ugly in extbase, the best way we
* have found now is to resolve the username (if it exists) in a
* view helper and just use the uid of the be user here.
*
* @var int
*/
protected $backendUserUid = 0;
/**
* Action ID of the action that happened, for example 3 was a file action
*
* @var int
*/
protected $action = 0;
/**
* UID of the record the event happened to
*
* @var int
*/
protected $recordUid = 0;
/**
* Table name
*
* @var string
*/
protected $tableName = 0;
/**
* PID of the record the event happened to
*
* @var int
*/
protected $recordPid = 0;
/**
* Error code
*
* @var int
*/
protected $error = 0;
/**
* This is the log message itself, but possibly with %s substitutions.
*
* @var string
*/
protected $details = '';
/**
* Timestamp when the log entry was written
*
* @var int
*/
protected $tstamp = 0;
/**
* Type code
*
* @var int
*/
protected $type = 0;
/**
* Details number
*
* @var int
*/
protected $detailsNumber = 0;
/**
* IP address of client
*
* @var string
*/
protected $ip = '';
/**
* Serialized log data. This is a serialized array with substitutions for $this->details.
*
* @var string
*/
protected $logData = '';
/**
* Event PID
*
* @var int
*/
protected $eventPid = 0;
/**
* This is only the UID and not the full workspace object for the same reason as in $beUserUid.
*
* @var int
*/
protected $workspaceUid = 0;
/**
* New ID
*
* @var string
*/
protected $newId = 0;
/**
* Set pid
*
* @param int $pid
*/
public function setPid($pid)
{
$this->pid = (int)$pid;
}
/**
* Get pid
*
* @return int
*/
public function getPid()
{
return $this->pid;
}
/**
* Set backend user uid
*
* @param int $beUserUid
*/
public function setBackendUserUid($beUserUid)
{
$this->backendUserUid = $beUserUid;
}
/**
* Get backend user id
*
* @return int
*/
public function getBackendUserUid()
{
return $this->backendUserUid;
}
/**
* Set action
*
* @param int $action
*/
public function setAction($action)
{
$this->action = $action;
}
/**
* Get action
*
* @return int
*/
public function getAction()
{
return (int)$this->action;
}
/**
* Set record uid
*
* @param int $recordUid
*/
public function setRecordUid($recordUid)
{
$this->recordUid = $recordUid;
}
/**
* Get record uid
*
* @return int
*/
public function getRecordUid()
{
return (int)$this->recordUid;
}
/**
* Set table name
*
* @param string $tableName
*/
public function setTableName($tableName)
{
$this->tableName = $tableName;
}
/**
* Get table name
*
* @return string
*/
public function getTableName()
{
return $this->tableName;
}
/**
* Set record pid
*
* @param int $recordPid
*/
public function setRecordPid($recordPid)
{
$this->recordPid = $recordPid;
}
/**
* Get record pid
*
* @return int
*/
public function getRecordPid()
{
return (int)$this->recordPid;
}
/**
* Set error
*
* @param int $error
*/
public function setError($error)
{
$this->error = $error;
}
/**
* Get error
*
* @return int
*/
public function getError()
{
return (int)$this->error;
}
/**
* Get class name for the error code
*
* @return string
*/
public function getErrorIconClass(): string
{
switch ($this->getError()) {
case 1:
return 'status-dialog-warning';
case 2:
case 3:
return 'status-dialog-error';
default:
return 'empty-empty';
}
}
/**
* Set details
*
* @param string $details
*/
public function setDetails($details)
{
$this->details = $details;
}
/**
* Get details
*
* @return string
*/
public function getDetails()
{
return $this->details;
}
/**
* Set tstamp
*
* @param int $tstamp
*/
public function setTstamp($tstamp)
{
$this->tstamp = $tstamp;
}
/**
* Get tstamp
*
* @return int
*/
public function getTstamp()
{
return (int)$this->tstamp;
}
/**
* Set type
*
* @param int $type
*/
public function setType($type)
{
$this->type = $type;
}
/**
* Get type
*
* @return int
*/
public function getType()
{
return (int)$this->type;
}
/**
* Set details number
*
* @param int $detailsNumber
*/
public function setDetailsNumber($detailsNumber)
{
$this->detailsNumber = $detailsNumber;
}
/**
* Get details number
*
* @return int
*/
public function getDetailsNumber()
{
return (int)$this->detailsNumber;
}
/**
* Set ip
*
* @param string $ip
*/
public function setIp($ip)
{
$this->ip = $ip;
}
/**
* Get ip
*
* @return string
*/
public function getIp()
{
return $this->ip;
}
/**
* Set log data
*
* @param string $logData
*/
public function setLogData($logData)
{
$this->logData = $logData;
}
/**
* Get log data
*
* @return array
*/
public function getLogData()
{
if ($this->logData === '') {
return [];
}
$logData = @unserialize($this->logData);
if (!is_array($logData)) {
$logData = [];
}
return $logData;
}
/**
* Set event pid
*
* @param int $eventPid
*/
public function setEventPid($eventPid)
{
$this->eventPid = $eventPid;
}
/**
* Get event pid
*
* @return int
*/
public function getEventPid()
{
return (int)$this->eventPid;
}
/**
* Set workspace uid
*
* @param int $workspaceUid
*/
public function setWorkspaceUid($workspaceUid)
{
$this->workspaceUid = $workspaceUid;
}
/**
* Get workspace
*
* @return int
*/
public function getWorkspaceUid()
{
return (int)$this->workspaceUid;
}
/**
* Set new id
*
* @param string $newId
*/
public function setNewId($newId)
{
$this->newId = $newId;
}
/**
* Get new id
*
* @return string
*/
public function getNewId()
{
return $this->newId;
}
}