Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: Entrified categories are visible in "All Entries" source on sites where the section is disabled #13383

Closed
chrismlusk opened this issue Jul 4, 2023 · 6 comments
Assignees

Comments

@chrismlusk
Copy link

chrismlusk commented Jul 4, 2023

What happened?

Description

After running entrify/categories on a Craft install with multiple sites — and updating the resulting section's settings to choose which sites the section is available in — I'm seeing entries that I shouldn't in the "All entries" source.

I'm having a hard time explaining this succinctly, so please let me know if you would prefer more specifics...

Say that I have Site A, Site B, and Site C.

I have a category group called "Demo" that I then entrify.

The resulting "Demo" section that gets created is configured to only be enabled in Site A and Site C. (Also, its propagation method is to save entries to all sites enabled for this section.)

When I switch to Site B in the Entries page in the control panel, this "Demo" section is not shown in the source list — as expected. But, if I view the "All entries" source, I see Demo entries that, in theory, shouldn't exist.

When I click on one of these entries to go to its edit page while in Site B, I expand the Status menu in the right column and see that the entry is (incorrectly) enabled for Site A, Site B, and Site C.

But if I expand the Site menu (next to the entry title), I see only Site A and Site C listed — as expected.

If I attempt to save the entry while in Site B (where it shouldn't even exist), I get an "Couldn't save entry" notification. Also, while in Site B, if I toggle the menu of extra actions (the dropdown with the save button), the Delete Entry option is not listed.

Craft CMS version

4.4.15

PHP version

8.1

@i-just
Copy link
Contributor

i-just commented Jul 5, 2023

Hi, thanks for reaching out. After changing the settings of the entrified category group (now section), did you wait for the queue job to complete?

I can replicate this behaviour only if I entrify the category group, prevent the queue from running and turn off the section for Site B. At this point, the “Demo” entries are showing under “All entries” for Site B.
If I then run the queue and let it complete, the “Demo” entries are no longer available on Site B.

@chrismlusk
Copy link
Author

Unfortunately the queue is empty now, but after initially deploying all of these changes to the production site, there were many failed queue jobs with errors saying that the entry was not enabled for that specific site ID.

@i-just
Copy link
Contributor

i-just commented Jul 5, 2023

Right, that additional bit of info helps - thank you!

@i-just
Copy link
Contributor

i-just commented Jul 5, 2023

Here’s what happened: during a deployment, project config changes were applied; the category group was removed, and in its place, a section was created and turned on for 2 out of 3 sites.
Then the entrification command was run, which changed the categories into entries. Because the categories existed for all 3 sites, they continued to exist for all 3 sites as entries. That resulted in the behaviour you’re seeing. The entries exist for all 3 sites, but the section rules contradict that by saying they should only exist for 2 sites.

Running the php craft resave/entries --section=<entrifiedSectionHandle> should fix this by correctly re-saving entries to only the supported sites. (I’d take the backup first, just in case.)

We’ll discuss this internally to see if any changes should be made to the process or messaging/documentation.

@i-just i-just self-assigned this Jul 6, 2023
@chrismlusk
Copy link
Author

Ah ha! That did the trick. Thank you!

@brandonkelly
Copy link
Member

Craft 4.4.16 is out with an improvement to garbage collection, which will fix this going forward (after running php craft gc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants