Problem/Motivation

Many of the core content entities (eg. menu items, custom blocks, etc) don't have changed timestamp tracking. This is a problem for various things.

  1. Data migration / content push would need to check uuids and last changed timestamps to optimise content pushing.
  2. Editing conflict / race condition tracking where multiple people attempt to edit and save on top of each other also needs change timestamp tracking.
  3. Cache invalidation should use last change timestamps on entities, such as the menu cache based on menu link item entities. We need this data.

Proposed resolution

  1. Add an interface for entities that support changed timestamps: #2044583: Add EntityChangedInterface to allow entities with "changed" field to be properly cached
  2. Expand on changed timestamp support to more entities:
  3. Generalize node changed validation: #2082509: Generalize node changed constraint to entity changed constraint

User interface changes

None.

API changes

Add interface for change tracking. Expand use of that, change schemas to introduce change timestamps.

Related issues

#2078387: Add an EntityOwnerInterface

Comments

Gábor Hojtsy’s picture

Title:[META} Add changed timestamp tracking to content entities» [META] Add changed timestamp tracking to content entities

Proper brace.

Gábor Hojtsy’s picture

Issue summary:View changes

Add custom blocks issue

Gábor Hojtsy’s picture

Issue summary:View changes

Add menu item issue.

Gábor Hojtsy’s picture

Issue summary:View changes

Add terms.

Gábor Hojtsy’s picture

Issue summary:View changes

Add user issue

Dave Reid’s picture

Wim Leers’s picture

We should also do this for comments!

tstoeckler’s picture

Wim Leers: comments already have 'changed' just like nodes.

Berdir’s picture

Yes, they're missing a method, though, which is added in #2028025: Expand CommentInterface to provide methods (waiting for comment as a field there)

Gábor Hojtsy’s picture

@Berdir: do we really need to wait on that? We can add that method in #2044583: Add EntityChangedInterface to allow entities with "changed" field to be properly cached just as well (and make it implement that interface). These are simple changes.

larowlan’s picture

larowlan’s picture

Issue summary:View changes

Adding link to fix file entities created and changed timestamps.

Gábor Hojtsy’s picture

Added #2082509: Generalize node changed constraint to entity changed constraint which is needed for eventual edit module integration as well (as we refactor edit to use the new entity API). See there.

Gábor Hojtsy’s picture

Issue summary:View changes

Updated issue summary.

Gábor Hojtsy’s picture

amateescu’s picture

Cache invalidation should use last change timestamps on entities, such as the menu cache based on menu link item entities. We need this data.

We already have a good mechanism for cache invalidation: cache tags. I'm not sure a bunch of entity queries (executed at a arbitrary time?) is better than that, so this point from the OP doesn't hold too much ground :)

das-peter’s picture

Related to #9: Recently I had the pleasure to work with revisions, and scheduled publishing of those. While working with that I was wondering how caching should work in such a scenario and my first impression was that using last change timestamp maybe isn't the best idea. Because, the last change timestamp of which revision?

Wim Leers’s picture

Issue summary:View changes
Issue tags:+Novice
webchick’s picture

Status:Active» Fixed

Status:Fixed» Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.