I was looking at Add support for terms expire, and was wondering that rather than implementing Taxonomy terms as another Expire class, we could have one instead that supports all entity types.

If we did this, the current classes for node, user and comment could be combined into one (they all look fairly similar anyway). We could replace all the hook_node_update() / expire_comment_update() / hook_user_update() with one hook_entity_update().

And we could use entity_uri() to get the url to expire for any entity type.

Looking through the tickets on this module, I can see this was once mentioned here as something for the 7.x-2.x release, but this obviously never happened.

Is there a reason why we haven't done this? Would quite like to take a stab at it if I get the time.

Comments

Spleshka’s picture

In general this might be a good idea, but for contrib-defined entities. Because pre-defined (node, comment, user) still has different expiration options. For example, only comments has an option to expire a comment's node. So yes, we can take a look at the more unification and inheritance from basic class, but we still have to have a different classes at least for the core-defined entities.

Leon Kessler’s picture

Yes comments are an exception (although I can't see how nodes and users would differ). There are probably other contrib entity types that work in a similar way, without their own urls (field collections for example).

So yes perhaps everything could still be it's own class, but there would be a base ExpireEntity class, actually nodes and users could probably use that directly.

I'd imagine that most contrib entity types won't actually work with Expire (or shouldn't work with it). A lot of them are not pages in themselves (field collections, flags, search indexes etc). So it may make the Expire admin page a bit more of a confusing place.

NWOM’s picture

Has there potentially been any work on this? It would be great to be able to expire pages based on deletion/creation of the Message entity type as well.