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

Bug with relations for siblings in online project not updated (2) #806

Open
tobias-karrer opened this issue Oct 3, 2024 · 4 comments
Open

Comments

@tobias-karrer
Copy link

tobias-karrer commented Oct 3, 2024

I did a cherry pick and patched the classes from commit 76c7006 accordingly in OpenCms 14, but looks like the problem still exists.
And depending how editors use the publish dialog might be even more confusing now.

Steps to reproduce:

I add a content to /de/investoren/index.html
image

And then publish this page with its content resource:
image
image

The sibling /en/investors/index.html still be published anyway and is not in publish list (even if "Publish silbings" is unchecked - see my comment here #802 (comment))

And it /en/investors/index.html does not exist in relations:
image

The fix for #805 now sets state of /en/investors/index.html to "changed", but it already was published before - see version 13 in history here:
image

So /en/investors/index.html was published (version 13), but now still has state "changed" (Offline version).
Editors might get confused as there are no changes to be published:
image

I'd guess the fixes are not applied for demo server yet to check the behaviour there?

Or is there something else that changed regarding siblings from OpenCms 14 to 17?
So the applied patches won't work for version 14?

BR, Tobias

@gWestenberger
Copy link
Contributor

gWestenberger commented Oct 4, 2024

I don't know specifically about OpenCms 14, but this is the intended behavior. The problem was that originally /en/investors/index.html showed up as published after modifying and publishing the German sibling. But it was not actually published. It had in fact unpublished changes: The relations from /en/investors/index.html to the new content elements. The change makes this fact visible. You have to publish the English sibling.

@tobias-karrer
Copy link
Author

tobias-karrer commented Oct 4, 2024

But it was not actually published. It had in fact unpublished changes

Hmm, no. That's the issue (as mentioned in #802 as well).
The English sibling already is published (!) automatically by OpenCms when publishing the German sibling (without checking "Include siblings")
But it the published English sibling doesn't show in publish list, nor are the relations for English sibling to content elments updated in database.

After the fix, if "Include siblings" is not checked, OpenCms now does

  • publishes German sibling, content element, English sibling
  • and sets state "changed" to English sibling again after it was published automatically.

@gWestenberger
Copy link
Contributor

No. It is not already published automatically. That's the whole problem (and why the relations are missing in the Online project).

The resource state you can see in the explorer (or get from a CmsResource object) is actually a mixture of two states: The structure state (CMS_OFFLINE_STRUCTURE.STRUCTURE_STATE) and the corresponding resource state (CMS_OFFLINE_RESOURCES.RESOURCE_STATE). For a given set of siblings, there is only one entry in CMS_OFFLINE_RESOURCES, but multiple CMS_OFFLINE_STRUCTURE entries for all its siblings in the file system. What you get when you read a resource is basically a combination of the data from CMS_OFFLINE_RESOURCES and CMS_OFFLINE_STRUCTURE, joined via RESOURCE_ID.

Previously, when writing an XML content, only the RESOURCE_STATE got updated. This caused all the siblings to show up as red. But the relations corresponding to the links contained in it got updated on all the siblings, without updating the STRUCTURE_STATE. So the STRUCTURE_STATE remained "unchanged" for all siblings.

If you now published one of the siblings and not the others, it would transfer its data from the Offline project to the Online project, and set the RESOURCE_STATE back to unchanged. This would cause the other siblings to show up as black in the Explorer, despite the fact that they had never gone through the publish process, and thus their relations had never been published.

The fix makes it so the STRUCTURE_STATE gets set to "changed" as well. So publishing just one sibling means the others will still show up as red in the Explorer, and can be published separately.

@tobias-karrer
Copy link
Author

tobias-karrer commented Oct 4, 2024

Hmm, ok, thanks for the detailled explanation.
So if I got it correctly, the second sibling (the one not published) gets it's state changed but was never published.
And changes in the XML content would be be visible on the not published resource in Online project as well, as the content resource itself was published.

But when it is not published, why there's a publish entry with publish date in history?
image

That's confusing then.

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

No branches or pull requests

2 participants