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

UNINSTALL_OBJECT not working correctly in transport packages #16557

Open
BobRay opened this issue Apr 15, 2024 · 2 comments
Open

UNINSTALL_OBJECT not working correctly in transport packages #16557

BobRay opened this issue Apr 15, 2024 · 2 comments
Labels
bug The issue in the code or project, which should be addressed.

Comments

@BobRay
Copy link
Contributor

BobRay commented Apr 15, 2024

Bug report

Summary

Correct me if I'm wrong, but the UNINSTALL_OBJECT constant was added to make the updateability and removal of objects independent. IOW,

  • Objects with UNINSTALL_OBJECT=true would always be removed
  • Objects with UNINSTALL_OBJECT=false would never be removed
  • Objects with UPDATE_OBJECT=true would always be updated
  • Objects with UPDATE_OBJECT=false would never be updated

Historically, this was controlled by UPDATE_OBJECT alone. If set to false, the object was not removed. I believe the addition of UNINSTALL_OBJECT was supposed to fix this.

This is not quite the case.

This combination works:

xPDOTransport::UNINSTALL_OBJECT =>false,
xPDOTransport::UPDATE_OBJECT => true,

The object is updated but not uninstalled.

This combination does not:

xPDOTransport::UNINSTALL_OBJECT =>true,
xPDOTransport::UPDATE_OBJECT => false,

The object is not updated, but is not uninstalled. It appears that UPDATE_OBJECT=false is still preventing the removal of the object.

My tests involved resources, with and without related objects.

@BobRay BobRay added the bug The issue in the code or project, which should be addressed. label Apr 15, 2024
@opengeek
Copy link
Member

By the logic in the code, both have to be true in order to uninstall an object.

@BobRay
Copy link
Contributor Author

BobRay commented Apr 15, 2024

Right, but why? I thought one of the points of UNINSTALL_OBJECT was for the case where you don't want an object updated, but do want it removed on uninstall. Most objects in an extra that shouldn't be updated should not hang around after the extra is uninstalled.

The two constants should each act on their own, as there is no reason for them to interact, IMO, and having them interact is limiting -- something we usually don't like to do in MODX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue in the code or project, which should be addressed.
Projects
None yet
Development

No branches or pull requests

2 participants