I configured the creation-plugin so that it deletes revisions older than 2 years.
I have a node for which the revision overview shows revisions older than 2 years.
But these revisions are never deleted.

I digged in a little but and it looks like the revision changed time is assumed as the revision creation time:

// The timestamp of the created revision is stored in the changed field.
$creation_time = $revision->getChangedTime();

This is incorrect. A past revision can be changed.

The appropriate way to get a revision's creation time is the getRevisionCreationTime() method. This method gets the timestamp stored under the revision_timestamp key (which is the same value that is used in the node revision overview).

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rp7 created an issue. See original summary.

rp7’s picture

Issue summary: View changes
rp7’s picture

Assigned: rp7 » Unassigned
Status: Active » Needs review
StatusFileSize
new712 bytes

Status: Needs review » Needs work
rp7’s picture

StatusFileSize
new2.69 KB

Updating tests.

rp7’s picture

StatusFileSize
new3.38 KB

Updating tests.

rp7’s picture

StatusFileSize
new4.08 KB

Updating tests. Expecting them to succeed now.

rp7’s picture

Status: Needs work » Needs review
berdir’s picture

> This is incorrect. A past revision can be changed.

Why should a revision get deleted if it has been updated?

rp7’s picture

Not sure if that even matters? The plugin is falsely claiming to base a deletion based on the revision creation time, but in fact it's using the changed time (while there's a creation time available).

FWIW, we have a project where we update old revisions retro-actively, when - for example - we add a new (required) fields to the content type.

rob230’s picture

Issue summary: View changes

We have this problem as well. I don't know what caused revisions to have a different updated date than created date, but it makes this module appear to not do what it claims, because in the backend the revisions are listed with the created date being X time ago, but they don't get deleted.

getRevisionCreationTime() is surely the correct method to use here.

rob230’s picture

Issue summary: View changes
alexpott’s picture

Status: Needs review » Needs work

I think that the issue summary details the problem quite well. If are telling the user we are going to delete revisions created older than 2 years and then don't that's a bug.

It feels like we should add a new plugin that uses the updated time and update existing sites to use that and have a created plugin that works as expected. That way sites can choose what they want to do.

eduardo morales alberti made their first commit to this issue’s fork.

eduardo morales alberti’s picture

Created MR updated with 2.0.x branch

lamp5 made their first commit to this issue’s fork.

lamp5’s picture

I rebased the MR. I see that similar issue has been commited. I need to test the latest version of the module.