‪TYPO3CMS  ‪main
LogEntry.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 
29 {
30  use ‪LogDataTrait;
31 
35  protected int ‪$uid = 0;
36 
44  protected int ‪$backendUserUid = 0;
45 
49  protected int ‪$action = 0;
50 
54  protected int ‪$recordUid = 0;
55 
59  protected string ‪$tableName = '';
60 
64  protected int ‪$recordPid = 0;
65 
69  protected int ‪$error = 0;
70 
74  protected string ‪$details = '';
75 
79  protected int ‪$tstamp = 0;
80 
84  protected int ‪$type = 0;
85 
89  protected string ‪$channel = '';
90 
94  protected string ‪$level = '';
95 
99  protected int ‪$detailsNumber = 0;
100 
104  protected string ‪$ip = '';
105 
109  protected string ‪$logData = '';
110 
114  protected int ‪$eventPid = 0;
115 
119  protected int ‪$workspaceUid = 0;
120 
124  protected string|int ‪$newId = 0;
125 
126  public function ‪getUid(): int
127  {
128  return ‪$this->uid;
129  }
130 
131  public function ‪getBackendUserUid(): int
132  {
134  }
135 
136  public function ‪getAction(): int
137  {
138  return ‪$this->action;
139  }
140 
141  public function ‪getRecordUid(): int
142  {
143  return ‪$this->recordUid;
144  }
145 
146  public function ‪getTableName(): string
147  {
148  return ‪$this->tableName;
149  }
150 
151  public function ‪getRecordPid(): int
152  {
153  return ‪$this->recordPid;
154  }
155 
156  public function ‪setError(int ‪$error): void
157  {
158  $this->error = ‪$error;
159  }
160 
161  public function ‪getError(): int
162  {
163  return ‪$this->error;
164  }
165 
166  public function ‪getErrorIconClass(): string
167  {
168  return match ($this->‪getError()) {
169  1 => 'status-dialog-warning',
170  2, 3 => 'status-dialog-error',
171  default => 'empty-empty',
172  };
173  }
174 
175  public function ‪getDetails(): string
176  {
177  if ($this->type === 255) {
178  return str_replace('###IP###', $this->ip, $this->details);
179  }
180  return ‪$this->details;
181  }
182 
183  public function ‪getTstamp(): int
184  {
185  return ‪$this->tstamp;
186  }
187 
188  public function ‪getType(): int
189  {
190  return ‪$this->type;
191  }
192 
193  public function ‪getChannel(): string
194  {
195  return ‪$this->channel;
196  }
197 
198  public function ‪getLevel(): string
199  {
200  return ‪$this->level;
201  }
202 
203  public function ‪getDetailsNumber(): int
204  {
206  }
207 
208  public function ‪getIp(): string
209  {
210  return ‪$this->ip;
211  }
212 
213  public function ‪setLogData(string ‪$logData): void
214  {
215  $this->logData = ‪$logData;
216  }
217 
218  public function ‪getLogData(): array
219  {
220  if ($this->logData === '') {
221  return [];
222  }
223  ‪$logData = $this->‪unserializeLogData($this->logData);
224  return ‪$logData ?? [];
225  }
226 
227  public function ‪getEventPid(): int
228  {
229  return ‪$this->eventPid;
230  }
231 
232  public function ‪getWorkspaceUid(): int
233  {
234  return ‪$this->workspaceUid;
235  }
236 
242  public function ‪getNewId()
243  {
244  return ‪$this->newId;
245  }
246 
247  public static function ‪createFromDatabaseRecord(array $row): self
248  {
249  $obj = new self();
250  $obj->uid = $row['uid'] ?? $obj->uid;
251  $obj->tstamp = $row['tstamp'] ?? $obj->tstamp;
252  $obj->backendUserUid = $row['userid'] ?? $obj->backendUserUid;
253  $obj->action = $row['action'] ?? $obj->action;
254  $obj->recordUid = $row['recuid'] ?? $obj->recordUid;
255  $obj->tableName = $row['tablename'] ?? $obj->tableName;
256  $obj->recordPid = $row['recpid'] ?? $obj->recordPid;
257  $obj->error = $row['error'] ?? $obj->error;
258  $obj->type = $row['type'] ?? $obj->type;
259  $obj->details = $row['details'] ?? $obj->details;
260  $obj->detailsNumber = $row['details_nr'] ?? $obj->detailsNumber;
261  $obj->ip = $row['IP'] ?? $obj->ip;
262  $obj->logData = $row['log_data'] ?? $obj->logData;
263  $obj->eventPid = $row['event_pid'] ?? $obj->eventPid;
264  $obj->workspaceUid = $row['workspace'] ?? $obj->workspaceUid;
265  $obj->newId = $row['NEWid'] ?? $obj->newId;
266  $obj->channel = $row['channel'] ?? $obj->channel;
267  $obj->level = $row['level'] ?? $obj->level;
268  return $obj;
269  }
270 }
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getTableName
‪getTableName()
Definition: LogEntry.php:145
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$workspaceUid
‪int $workspaceUid
Definition: LogEntry.php:118
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getEventPid
‪getEventPid()
Definition: LogEntry.php:226
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getDetails
‪getDetails()
Definition: LogEntry.php:174
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\setError
‪setError(int $error)
Definition: LogEntry.php:155
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getBackendUserUid
‪getBackendUserUid()
Definition: LogEntry.php:130
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$detailsNumber
‪int $detailsNumber
Definition: LogEntry.php:98
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$backendUserUid
‪int $backendUserUid
Definition: LogEntry.php:43
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getError
‪getError()
Definition: LogEntry.php:160
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getIp
‪getIp()
Definition: LogEntry.php:207
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$action
‪int $action
Definition: LogEntry.php:48
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getWorkspaceUid
‪getWorkspaceUid()
Definition: LogEntry.php:231
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$recordPid
‪int $recordPid
Definition: LogEntry.php:63
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$ip
‪string $ip
Definition: LogEntry.php:103
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\setLogData
‪setLogData(string $logData)
Definition: LogEntry.php:212
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$logData
‪string $logData
Definition: LogEntry.php:108
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getUid
‪getUid()
Definition: LogEntry.php:125
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getLogData
‪getLogData()
Definition: LogEntry.php:217
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$level
‪string $level
Definition: LogEntry.php:93
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$type
‪int $type
Definition: LogEntry.php:83
‪TYPO3\CMS\Core\Log\LogDataTrait\unserializeLogData
‪unserializeLogData(mixed $logData)
Definition: LogDataTrait.php:30
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getRecordUid
‪getRecordUid()
Definition: LogEntry.php:140
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$eventPid
‪int $eventPid
Definition: LogEntry.php:113
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$tableName
‪string $tableName
Definition: LogEntry.php:58
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getDetailsNumber
‪getDetailsNumber()
Definition: LogEntry.php:202
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getTstamp
‪getTstamp()
Definition: LogEntry.php:182
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getType
‪getType()
Definition: LogEntry.php:187
‪TYPO3\CMS\Belog\Domain\Model\LogEntry
Definition: LogEntry.php:29
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$recordUid
‪int $recordUid
Definition: LogEntry.php:53
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$tstamp
‪int $tstamp
Definition: LogEntry.php:78
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getAction
‪getAction()
Definition: LogEntry.php:135
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$error
‪int $error
Definition: LogEntry.php:68
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$newId
‪string int $newId
Definition: LogEntry.php:123
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getRecordPid
‪getRecordPid()
Definition: LogEntry.php:150
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getLevel
‪getLevel()
Definition: LogEntry.php:197
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getChannel
‪getChannel()
Definition: LogEntry.php:192
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$details
‪string $details
Definition: LogEntry.php:73
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\createFromDatabaseRecord
‪static createFromDatabaseRecord(array $row)
Definition: LogEntry.php:246
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$uid
‪int $uid
Definition: LogEntry.php:34
‪TYPO3\CMS\Belog\Domain\Model
Definition: Constraint.php:18
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\$channel
‪string $channel
Definition: LogEntry.php:88
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getNewId
‪string int getNewId()
Definition: LogEntry.php:241
‪TYPO3\CMS\Core\Log\LogDataTrait
Definition: LogDataTrait.php:25
‪TYPO3\CMS\Belog\Domain\Model\LogEntry\getErrorIconClass
‪getErrorIconClass()
Definition: LogEntry.php:165