Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds a new
status
column to theentries
table, which statically stores entries’ last-known date-based status (live
,pending
, orexpired
), updated whenever entries are saved.By default the column is completely ignored by element queries, and entry queries will continue taking the
postDate
andexpiryDate
columns into account when fetching entries bylive
/pending
/expired
status.However, that behavior can be altered using a new
staticStatuses
config setting. When that’s enabled, entry queries will look at thestatus
column instead ofpostDate
andexpiryDate
. So if an entry is saved with a future post date, and itsstatus
column is set topending
, it will continue to be excluded from entry query results forlive
entries, even passed its post date, until it’s saved again.There’s also a new
update-statuses
command, which will look for entries whose statically-stored statuses need to be updated based on theirpostDate
andexpiryDate
values, and resaves them so their statuses get updated (and caches get cleared, etc.).Sites with
staticStatuses
enabled should start runningupdate-statuses
every 1 or 5 minutes using a Cron job, to ensure that statically-stored entry statuses are kept up-to-date.And finally, entries have a new
oldStatus
property, making it easy for event listeners to catch the moment that an entry goes live or expires:Related issues