craftcms / craftcms/cms

[5.x]: When merging entry types, the count includes drafts and revisions

Open
#15,696 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

What happened?
Description

Best I can tell, the entry-types/merge command also includes drafts and revisions when counting entries. For example, I’m seeing:

craft entry-types/merge handle handle2
Which entry type should persist?

- handle (1 usage, 100 entries)
- handle2 (1 usage, 609 entries)

The handle section is 100 newly created entries, with no drafts or revisions, so that is all appearing as expected.

However, handle2 only has 34 entries. After clearing the revisions, the number is way lower, but I’m still not sure why it’s so high.

Steps to reproduce
  1. Run craft entry-types/merge handle handle2 and see the results
  2. Run craft utils/prune-revisions --max-revisions=0
  3. Run craft entry-types/merge handle handle2 again, and see the results are different
Craft CMS version

5.4.1

PHP version

8.2

Operating system and version

No response

Database type and version

PostgreSQL

Image driver and version

No response

Installed plugins and versions

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the entry-types/merge command and compare its entry-count query with the results from utils/prune-revisions --max-revisions=0. Reproduce the discrepancy using the commands and entry counts in the issue, then verify that drafts and revisions no longer inflate the merge prompt's counts.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.