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

Fix PhpCR migration exception for unpublished languages #698

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

Cephra
Copy link
Contributor

@Cephra Cephra commented Aug 22, 2024

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
License MIT

What's in this PR?

This PR checks if the nodes have properties during the migration

Why?

Without this, articles which haven't been published cause migrations to fail.

@Prokyonn
Copy link
Member

Prokyonn commented Aug 26, 2024

@Cephra Thank you for the merge request. The check for property existence does make sense, but I’m not entirely sure it applies to unpublished articles.

If an article is only saved as a draft and not published it should not be selected because it does not have a mixinType so the condition ([jcr:mixinTypes] = "sulu:article" OR [jcr:mixinTypes] = "sulu:articlepage") should be false. After it was published once, the template property must be set.

So I cannot really reproduce your issue 🤔

@alexander-schranz
Copy link
Member

@Cephra can you show us how such article looks like in your phpcr storage? How can such articles be created?

@Prokyonn
Copy link
Member

I was able to reproduce the issue. It occurs when you have multiple locales (e.g., de and en) and only publish the article in de. In this case, the unlocalized mixin:type property is set correctly, but for en, the templateKey is missing, causing the migration to crash.

Thanks to @Cephra for identifying and fixing this issue in a merge request!

@Prokyonn Prokyonn changed the title fix: prevent exception during migration step fix: Prevent exception during phpcr migration for unpublished languages Aug 27, 2024
@Prokyonn Prokyonn changed the title fix: Prevent exception during phpcr migration for unpublished languages Fix PhpCR migration exception for unpublished languages Aug 27, 2024
@Prokyonn Prokyonn merged commit 60662cf into sulu:2.6 Aug 27, 2024
8 of 9 checks passed
@Cephra
Copy link
Contributor Author

Cephra commented Aug 27, 2024

Hello @Prokyonn & @alexander-schranz,

firstly thanks for accepting and merging the fix.

I also want to thank @FlorianKoerner who has helped me find and fix this bug!

@Cephra Cephra deleted the fix/property-in-migration branch August 27, 2024 12:17
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants