Skip to content

[6.x] Add activity logging foundation - #19496

Merged
brandonkelly merged 26 commits into
6.xfrom
feature/activity-logs-base
Sep 7, 2026
Merged

[6.x] Add activity logging foundation#19496
brandonkelly merged 26 commits into
6.xfrom
feature/activity-logs-base

Conversation

@riasvdv

@riasvdv riasvdv commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

Initial backend implementation of activity logging.

Activity event types require implementing a ActivityEventTypeInterface interface. This allows for plugins to add additional event types with us owning how they are rendered and stored.

This PR also adds an initial set of events logged for the most common Element events we'd be interested in:

  • Creating, updating, duplicating, moving, trashing, restoring, merging, and deleting elements
  • Changing element statuses and site assignments
  • Creating, saving, applying, and discarding drafts
  • Restoring revisions
  • Replacing asset files
  • Changing an element’s position within a structure

Activity history has a configurable retention period, with expired events removed during garbage collection.

ActivityActor, ActvitySubject and ActivitySource and the event's information are stored in snapshots on the activity row's payload. This is to ensure we can always display the activity, regardless of an actor, subject or the event itself no longer being available.

changes are stored in a list of ActivityChange DTOs, with old and new values, so rendering them will be straightforward and gives a structured and type-safe way for plugin developers to define what has changed.

An event type can also own how it's displayed by overriding or implementing the format(ActivityEvent $event) method.

AI docs: https://github.com/craftcms/cms/blob/feature/activity-logs-base/docs/activity-logging.md

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

📚 Storybook previews

@craftcms/uiopen Storybook

No changed components detected in this Storybook.

resources/jsopen Storybook

No changed components detected in this Storybook.

@linear-code

linear-code Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

CMS-2327

@riasvdv
riasvdv marked this pull request as ready for review September 7, 2026 08:58
@riasvdv
riasvdv requested a review from brandonkelly September 7, 2026 08:58
@brandonkelly
brandonkelly merged commit 616ed34 into 6.x Sep 7, 2026
23 checks passed
@brandonkelly
brandonkelly deleted the feature/activity-logs-base branch September 7, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants