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

[Guided Tours] All tour assets get the root id #40208

Closed
wants to merge 9 commits into from

Conversation

obuisard
Copy link
Contributor

Pull Request for Issue #40199 .

Summary of Changes

Addition of a function to get the asset id of com_guidedtours as asset parent id for all tours.

Testing Instructions

Create a new tour.
Look at the assets table in the database and locate the new tour

Actual result BEFORE applying this Pull Request

The new tour gets a parent asset id of 1.

Expected result AFTER applying this Pull Request

The new tour gets a parent asset id equivalent to the asset id of com_guidedtours (95 on new installations).

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

Added getAssetParentId function to retrieve the parent asset id
Removed spaces
@brianteeman
Copy link
Contributor

You will also need some code to fix existing assets

@obuisard
Copy link
Contributor Author

obuisard commented Mar 26, 2023

You will also need some code to fix existing assets

Users testing the release and particularly tours could just re-save their tours to have the parent asset ids fixed.

@brianteeman
Copy link
Contributor

You will also need some code to fix existing assets

Users testing the release and particularly tours could just re-save their tours to have the parent asset ids fixed.

that is not acceptable to me, especially as it is undocumented, as many years ago we switched the policy so that you can upgrade etc from beta and rc releases.

@richard67
Copy link
Member

You will also need some code to fix existing assets

Users testing the release and particularly tours could just re-save their tours to have the parent asset ids fixed.

that is not acceptable to me, especially as it is undocumented, as many years ago we switched the policy so that you can upgrade etc from beta and rc releases.

@brianteeman I don't see a way to fix that e.g. with an update SQL script.

@brianteeman
Copy link
Contributor

@brianteeman I don't see a way to fix that e.g. with an update SQL script.

one option might be to simply delete all existing guided tours assets. better to have none than to have broken ones

@obuisard
Copy link
Contributor Author

@brianteeman I don't see a way to fix that e.g. with an update SQL script.

one option might be to simply delete all existing guided tours assets. better to have none than to have broken ones

We could also add this mention to the FAQ for the release, that is what the FAQ can be used for.

@richard67
Copy link
Member

richard67 commented Mar 27, 2023

I've found a mistake in the assets table: The rgt value of the root item is 175 but should be 177. This means that when you test this PR here, the new asset is inserted correctly, but the rgt value of the root item is not updated accordingly. I will make a separate PR to fix that.

Update: I've found another mistake with the lft and rgt values in the assets table.

Added guidedtours exclude patterns
Remove spaces
Removed ignore rules
Removed rule
No need method rule for StepTable
@richard67
Copy link
Member

I have tested this item ✅ successfully on 120174b

Asset is created with the right parent when editing a tour for the first time or creating a new one. When finally deleting a trashed tour, the right asset is deleted, too.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40208.

@richard67
Copy link
Member

@brianteeman I think if we do something for deleting wrong assets like you suggested, we should do it with a separate PR.

@brianteeman
Copy link
Contributor

@brianteeman I think if we do something for deleting wrong assets like you suggested, we should do it with a separate PR.

fine by me - as long as it gets done and we dont screw up users sites by not doing it

@obuisard
Copy link
Contributor Author

@brianteeman I think if we do something for deleting wrong assets like you suggested, we should do it with a separate PR.

fine by me - as long as it gets done and we dont screw up users sites by not doing it

There is one thing I don't grasp here: why would we screw user sites? We are not in stable release yet.

@richard67
Copy link
Member

I don't see either how it would screw sites. It would only mean there are some unused, obsolete assets when someone has updated from a 4.3.0 Beta 4 or RC 1.

What we could do is to delete these assets since gaps in the lft and rgt values are not doing harm, like this:

DELETE FROM `#__assets` WHERE `parent_id` = 1 AND `level` = 1 AND `name` LIKE 'com_guidedtours.tour.%';

It should be safe since we touch only the wrong ones.

But is it worth that? It's always a risk to touch user data on update.

@obuisard
Copy link
Contributor Author

obuisard commented Mar 27, 2023

As we deal with users testing sites, I would think a FAQ info would suffice, the FAQ is supposed to report issues like these.
I would prefer telling testers this issue is fixed if you just save tours rather than removing the permissions they have set up and having an asset table a bit messed up.

@brianteeman
Copy link
Contributor

In the past we had a policy of not providing an upgrade path from beta and rc. This policy was changed. It is not ideal that the only option appears to be to delete the existing assets but if thats the only option it will have to do. You can not rely on someone reading an faq.

Those with a long memory will remember that this is not the first time we have had an issue arising from a bad entry in an asset table. We had to create a script for users to run top resolve it BUT that was only after a long time before the weird bug was identified and traced back to the bad assets

@obuisard
Copy link
Contributor Author

obuisard commented Mar 27, 2023

I understand, it makes sense, I get that.
But we are dealing with tours here, nothing that has a major impact on anything else in the core or any frontend.

Looks to me that if we delete the faulty lines in the asset table, we mess up the asset table. If we don't do anything, the parent ids are messed up unless they get the info that they just need to save the tours again.
There is no ideal solution either way.

@brianteeman
Copy link
Contributor

But we are dealing with tours here, nothing that has a major impact on anything else in the core or any frontend.

If this was in a tours table then I would agree but its not.

Please read https://docs.joomla.org/Fixing_the_assets_table

As of Joomla 1.6 there is an #__assets table that might have improper values. This can cause serious problems for your site.

@brianteeman
Copy link
Contributor

brianteeman commented Mar 27, 2023

Thinking about it - we have a rebuild assets functionality for categories and menus already. cant we do the same for tours (except do it on upgrades and not a manual button

@richard67
Copy link
Member

Thinking about it - we have a rebuild assets functionality for categories and menus already. cant we do the same for tours (except do it on upgrades and not a manual button

@Do these buttons really rebuild the assets table? I think they only rebuild the (also nested) menu and categories tables.

@Hackwar
Copy link
Member

Hackwar commented Mar 28, 2023

May I pose the question why we need assets at all? The tours to me are rather like banners and since we don't have categories where it would be usefull to setup inherited permissions, I don't see a reason for polluting our assets table and introducing all this additional computation.

@Hackwar
Copy link
Member

Hackwar commented Mar 28, 2023

Thinking about it - we have a rebuild assets functionality for categories and menus already. cant we do the same for tours (except do it on upgrades and not a manual button

@Do these buttons really rebuild the assets table? I think they only rebuild the (also nested) menu and categories tables.

Those buttons only rebuild the nested set structure of the respective database table. We do need that for the assets table, too, but not in the context of this component.

@obuisard
Copy link
Contributor Author

May I pose the question why we need assets at all? The tours to me are rather like banners and since we don't have categories where it would be usefull to setup inherited permissions, I don't see a reason for polluting our assets table and introducing all this additional computation.

It would allow the administrator of a site to lock some tours and allow the creation and edition of others, as an example.

@joomdonation
Copy link
Contributor

I have tested this item ✅ successfully on 120174b

I don't know what is the best way to handle existing wrong assets, but this fix is needed for tours permission works properly. That's why I give it a success test.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40208.

@richard67
Copy link
Member

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40208.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Mar 28, 2023
@Hackwar
Copy link
Member

Hackwar commented Mar 28, 2023

May I pose the question why we need assets at all? The tours to me are rather like banners and since we don't have categories where it would be usefull to setup inherited permissions, I don't see a reason for polluting our assets table and introducing all this additional computation.

It would allow the administrator of a site to lock some tours and allow the creation and edition of others, as an example.

Not exactly. The way it is set now, you could only lock down the component and then allow single tours to be edited or deleted. But you can't create tours without the components global create permission. I don't see a need to lock down all tours except for specific ones for editing or deleting. Considering all that, I would rather remove this again before the 4.3.0 release. We can add this back in if the need turns out to be there in a later release, but we will never be able to remove it again once it has been released.

@richard67
Copy link
Member

See an alternative PR here, which removes the permissions for tours: #40228 .

@richard67
Copy link
Member

richard67 commented Mar 29, 2023

The PR for the errors which I've found in the assets table (see my comment above) is #40237 . It will be ready when I have completed testing instructions, hopefully later tonight.

P.S.: It is independent from having assets for the tours or not.

@obuisard
Copy link
Contributor Author

Closed in favor of #40228.

@obuisard obuisard closed this Mar 31, 2023
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Mar 31, 2023
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.

7 participants