Set last_access->value to 0 or NULL for new redirects

Created on 14 May 2021, over 3 years ago
Updated 28 February 2024, 9 months ago

Problem/Motivation

Newly created redirects get a timestamp of their created date in last_access instead of 0 like was done in Drupal 7.

This gives a false reading of a last access even though the access_count is 0.

This also is an issue when migrating sites that have redirects "never" been accessed. The value in the database for those is 0, and they migrate over that way just fine, but the view this module ships with tries to force a timestamp on them in the display.

For example I was getting Wed, 12/31/1969 - 7:00pm as a last access date for all the redirects that last_access of 0. I mentioned this in this comment .

This will also help in provide clarity in settings for deleting old aliases, in that it draws a distinction between redirects that were never accessed.

Since we have the Created date now anyway, there is no reason to timestamp the access until they actually get accessed.

Steps to reproduce

Add a new redirect. It has an access_count of 0, but the last_access is a timestamp from when it was created.

Proposed resolution

Set the value of a new redirect without a timestamp to 0 or NULL.

We should also conditionally rewrite the Last Accessed output in the view to "Never" when the last access value is 0 or NULL.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024