Craft Activity (2.x)

Users extends ElementsRecorder
in package

Table of Contents

$_isRecording  : bool
$deleteTypes  : array<string|int, mixed>
$deleteTypesCategory  : string|null
$endRequestInitiated  : mixed
$logQueue  : array<string|int, mixed>
$oldFields  : array<string|int, mixed>
Keep track of old fields values
$permissions  : mixed
beforeReverted()  : mixed
Before an element is reverted to a revision, saves old field values
beforeSaved()  : mixed
Before an element is saved, saves old field values
emptyQueue()  : mixed
Empty the commited log queue, causing all the logs in the queue to be lost
getIsRecording()  : bool
Is this recorder currently recording
getQueue()  : array<string|int, mixed>
Get the log queue
getQueuedLogByUid()  : ActivityLog|null
Get a queued log for an uid and type
init()  : void
onActivated()  : mixed
Save a log when a user is activated
onAssignDefaultGroup()  : mixed
Save a log when a user is assigned to the default group
onAssignGroups()  : mixed
Save a log when a user is assigned to groups
onDeleted()  : mixed
Saves a log when an element is deleted
onEmailVerified()  : mixed
Save a log when a user email is verified
onInvalidToken()  : mixed
Save a log when a user uses an invalid token
onLocked()  : mixed
Save a log when a user is locked
onLoggedIn()  : mixed
Save a log when a user logs in
onLoggedOut()  : mixed
Save a log when a user logs out
onLoginFailed()  : mixed
Save a log when a user fails to login
onMoved()  : mixed
Saves a log when an element is moved
onRestored()  : mixed
Saves a log when an element is restored
onReverted()  : mixed
Save a log when an element is reverted to a revision
onSaved()  : mixed
Saves a log when an element is saved
onSuspend()  : mixed
Save a log when a user is suspended
onUnlocked()  : mixed
Save a log when a user is unlocked
onUnsuspend()  : mixed
Save a log when a user is unsuspended
queueHasLogForUid()  : bool
Does a log related to an uid and type exists in the queue
removeQueuedLogsByUid()  : mixed
Remove a queued log by uid and type
saveLogs()  : mixed
Save all queued logs
saveNewPermissions()  : mixed
Save new permissions at the end of request
startRecording()  : mixed
Get this recorder to start recording
stopRecording()  : mixed
Get this recorder to stop recording
commitLog()  : bool
Commit a log to be saved, log will be added in the queue if $saveNow is false
getActivityHandle()  : string
Get the activity handle, used to build the log type
getCustomFieldValues()  : array<string|int, mixed>
Get an element custom field values, returns an array of field handlers
getDirtyFields()  : array<string|int, mixed>
Calculate dirty fields, input are two arrays of field handlers
getElementType()  : string
Get the element type this recorder handles
getFieldsValues()  : array<string|int, mixed>
Get an element field values, returns an array of field handlers
getGroupsData()  : array<string|int, mixed>
Get the group data from an array of ids
getSavedActivityType()  : string
Get the activity log type
isTypeIgnored()  : bool
is a type ignored by the settings
saveOldPermissions()  : mixed
Save the old permissions and listen to end of request event so the new permissions can be tracked
shouldSaveElementLog()  : bool
Should an element log be saved
shouldSaveLog()  : bool
Should a log type be saved

Properties

$_isRecording

protected bool $_isRecording = true

$deleteTypes

protected array<string|int, mixed> $deleteTypes = ['userActivated', 'userAssignedGroups', 'userAssignedDefaultGroup', 'userCreated', 'userDeleted', 'userInvalidToken', 'userLocked', 'userLoggedIn', 'userLoggedOut', 'userLoginFailed', 'userPermissionsSaved', 'userRegistered', 'userRestored', 'userSaved', 'userSelfActivated', 'userSuspended', 'userUnlocked', 'userUnsuspended', 'userVerifiedEmail']
Tags
inheritDoc

$deleteTypesCategory

protected string|null $deleteTypesCategory = 'users'
Tags
inheritDoc

$endRequestInitiated

protected mixed $endRequestInitiated = false

$logQueue

protected array<string|int, mixed> $logQueue = []

$oldFields

Keep track of old fields values

protected array<string|int, mixed> $oldFields = []

$permissions

protected mixed $permissions = []

Methods

beforeReverted()

Before an element is reverted to a revision, saves old field values

public beforeReverted(Element $revision, Element $element) : mixed
Parameters
$revision : Element
$element : Element
Return values
mixed

beforeSaved()

Before an element is saved, saves old field values

public beforeSaved(Element $element) : mixed
Parameters
$element : Element
Return values
mixed

emptyQueue()

Empty the commited log queue, causing all the logs in the queue to be lost

public emptyQueue() : mixed
Return values
mixed

getIsRecording()

Is this recorder currently recording

public getIsRecording() : bool
Return values
bool

getQueue()

Get the log queue

public getQueue() : array<string|int, mixed>
Return values
array<string|int, mixed>

getQueuedLogByUid()

Get a queued log for an uid and type

public getQueuedLogByUid(string $uid, string $type) : ActivityLog|null
Parameters
$uid : string
$type : string
Return values
ActivityLog|null

init()

public init() : void
Tags
inheritDoc
Return values
void

onActivated()

Save a log when a user is activated

public onActivated(User $user) : mixed
Parameters
$user : User
Return values
mixed

onAssignDefaultGroup()

Save a log when a user is assigned to the default group

public onAssignDefaultGroup(User $user) : mixed
Parameters
$user : User
Return values
mixed

onAssignGroups()

Save a log when a user is assigned to groups

public onAssignGroups(int $userId, array<string|int, mixed> $newGroupIds, array<string|int, mixed> $removedGroupIds) : mixed
Parameters
$userId : int
$newGroupIds : array<string|int, mixed>
$removedGroupIds : array<string|int, mixed>
Return values
mixed

onDeleted()

Saves a log when an element is deleted

public onDeleted(Element $user) : mixed
Parameters
$user : Element
Tags
inheritDoc
Return values
mixed

onEmailVerified()

Save a log when a user email is verified

public onEmailVerified(User $user) : mixed
Parameters
$user : User
Return values
mixed

onInvalidToken()

Save a log when a user uses an invalid token

public onInvalidToken(User $user) : mixed
Parameters
$user : User
Return values
mixed

onLocked()

Save a log when a user is locked

public onLocked(User $user) : mixed
Parameters
$user : User
Return values
mixed

onLoggedIn()

Save a log when a user logs in

public onLoggedIn(User $user) : mixed
Parameters
$user : User
Return values
mixed

onLoggedOut()

Save a log when a user logs out

public onLoggedOut(User $user) : mixed
Parameters
$user : User
Return values
mixed

onLoginFailed()

Save a log when a user fails to login

public onLoginFailed(User $user) : mixed
Parameters
$user : User
Return values
mixed

onMoved()

Saves a log when an element is moved

public onMoved(Element $element) : mixed
Parameters
$element : Element
Return values
mixed

onRestored()

Saves a log when an element is restored

public onRestored(Element $element) : mixed
Parameters
$element : Element
Return values
mixed

onReverted()

Save a log when an element is reverted to a revision

public onReverted(Element $element, int $revisionNum) : mixed
Parameters
$element : Element
$revisionNum : int
Return values
mixed

onSaved()

Saves a log when an element is saved

public onSaved(Element $user) : mixed
Parameters
$user : Element
Tags
inheritDoc
Return values
mixed

onSuspend()

Save a log when a user is suspended

public onSuspend(User $user) : mixed
Parameters
$user : User
Return values
mixed

onUnlocked()

Save a log when a user is unlocked

public onUnlocked(User $user) : mixed
Parameters
$user : User
Return values
mixed

onUnsuspend()

Save a log when a user is unsuspended

public onUnsuspend(User $user) : mixed
Parameters
$user : User
Return values
mixed

queueHasLogForUid()

Does a log related to an uid and type exists in the queue

public queueHasLogForUid(string $uid, string $type) : bool
Parameters
$uid : string
$type : string
Return values
bool

removeQueuedLogsByUid()

Remove a queued log by uid and type

public removeQueuedLogsByUid(string $uid, string $type) : mixed
Parameters
$uid : string
$type : string
Return values
mixed

saveLogs()

Save all queued logs

public saveLogs() : mixed
Return values
mixed

saveNewPermissions()

Save new permissions at the end of request

public saveNewPermissions() : mixed
Return values
mixed

startRecording()

Get this recorder to start recording

public startRecording() : mixed
Return values
mixed

stopRecording()

Get this recorder to stop recording

public stopRecording() : mixed
Return values
mixed

commitLog()

Commit a log to be saved, log will be added in the queue if $saveNow is false

protected commitLog(string $type[, array<string|int, mixed> $params = [] ][, bool $saveNow = false ]) : bool
Parameters
$type : string
$params : array<string|int, mixed> = []
$saveNow : bool = false
Return values
bool

getActivityHandle()

Get the activity handle, used to build the log type

protected getActivityHandle() : string
Tags
inheritDoc
Return values
string

getCustomFieldValues()

Get an element custom field values, returns an array of field handlers

protected getCustomFieldValues(Element $element) : array<string|int, mixed>
Parameters
$element : Element
Return values
array<string|int, mixed>

getDirtyFields()

Calculate dirty fields, input are two arrays of field handlers

protected getDirtyFields(array<string|int, mixed> $newFields, array<string|int, mixed> $oldFields) : array<string|int, mixed>
Parameters
$newFields : array<string|int, mixed>
$oldFields : array<string|int, mixed>
Return values
array<string|int, mixed>

getElementType()

Get the element type this recorder handles

protected getElementType() : string
Tags
inheritDoc
Return values
string

getFieldsValues()

Get an element field values, returns an array of field handlers

protected getFieldsValues(Element $user) : array<string|int, mixed>
Parameters
$user : Element
Tags
inheritDoc
Return values
array<string|int, mixed>

getGroupsData()

Get the group data from an array of ids

protected getGroupsData(array<string|int, mixed> $ids) : array<string|int, mixed>
Parameters
$ids : array<string|int, mixed>
Return values
array<string|int, mixed>

getSavedActivityType()

Get the activity log type

protected getSavedActivityType(Element $user) : string
Parameters
$user : Element
Tags
inheritDoc
Return values
string

isTypeIgnored()

is a type ignored by the settings

protected isTypeIgnored(string $type) : bool
Parameters
$type : string
Return values
bool

saveOldPermissions()

Save the old permissions and listen to end of request event so the new permissions can be tracked

protected saveOldPermissions(Element $user) : mixed
Parameters
$user : Element
Return values
mixed

shouldSaveElementLog()

Should an element log be saved

protected shouldSaveElementLog(string $type, Element $element) : bool
Parameters
$type : string
$element : Element
Return values
bool

shouldSaveLog()

Should a log type be saved

protected shouldSaveLog(string $type) : bool
Parameters
$type : string
Return values
bool

Search results