Logs
extends Component
in package
Table of Contents
- REQUEST_CONSOLE = 'console'
- REQUEST_CP = 'cp'
- REQUEST_SITE = 'site'
- REQUEST_YAML = 'yaml'
- deleteAllLogs() : mixed
- Delete all logs
- deleteLog() : mixed
- Delete a log by id
- deleteUserLogs() : mixed
- Deletes all logs created by a user
- getChangedFieldById() : ChangedField
- Get a changed field by id
- getCurrentRequest() : string
- Get current request descriptor
- getLogsQuery() : ActiveQuery
- Get a filtered logs query
- getPaginatedLogs() : array<string|int, mixed>
- Get paginated logs according to some filters
- getUsedUsers() : array<string|int, mixed>
- Get all user used in database in all records
- getUserLogs() : array<string|int, mixed>
- Get the latest logs for a user
- runGc() : mixed
- Run garbage collection, delete all logs older than threshold
- saveLog() : bool
- Saves a log
Constants
REQUEST_CONSOLE
public
mixed
REQUEST_CONSOLE
= 'console'
REQUEST_CP
public
mixed
REQUEST_CP
= 'cp'
REQUEST_SITE
public
mixed
REQUEST_SITE
= 'site'
REQUEST_YAML
public
mixed
REQUEST_YAML
= 'yaml'
Methods
deleteAllLogs()
Delete all logs
public
deleteAllLogs() : mixed
Return values
mixed —deleteLog()
Delete a log by id
public
deleteLog(int $id) : mixed
Parameters
- $id : int
Return values
mixed —deleteUserLogs()
Deletes all logs created by a user
public
deleteUserLogs(User $user) : mixed
Parameters
- $user : User
Return values
mixed —getChangedFieldById()
Get a changed field by id
public
getChangedFieldById(int $id) : ChangedField
Parameters
- $id : int
Tags
Return values
ChangedField —getCurrentRequest()
Get current request descriptor
public
getCurrentRequest() : string
Return values
string —getLogsQuery()
Get a filtered logs query
public
getLogsQuery(array<string|int, mixed> $filters[, string $orderBy = 'dateCreated desc' ]) : ActiveQuery
Parameters
- $filters : array<string|int, mixed>
- $orderBy : string = 'dateCreated desc'
Tags
Return values
ActiveQuery —getPaginatedLogs()
Get paginated logs according to some filters
public
getPaginatedLogs(array<string|int, mixed> $filters[, int $perPage = 5 ][, string $orderBy = 'dateCreated desc' ]) : array<string|int, mixed>
Parameters
- $filters : array<string|int, mixed>
- $perPage : int = 5
- $orderBy : string = 'dateCreated desc'
Return values
array<string|int, mixed> —getUsedUsers()
Get all user used in database in all records
public
getUsedUsers() : array<string|int, mixed>
Return values
array<string|int, mixed> —getUserLogs()
Get the latest logs for a user
public
getUserLogs(User $user[, int $limit = 10 ]) : array<string|int, mixed>
Parameters
- $user : User
- $limit : int = 10
Return values
array<string|int, mixed> —runGc()
Run garbage collection, delete all logs older than threshold
public
runGc() : mixed
Return values
mixed —saveLog()
Saves a log
public
saveLog(ActivityLog $log) : bool
Parameters
- $log : ActivityLog