No Code Attached Yet bug
avatar wilsonge
wilsonge
13 Aug 2023

Steps to reproduce the issue

Upgrade a site from Joomla 3 to Joomla 4. After the upgrade you'll notice several items missing required assets

  • Components (should be fixed with #41358)
  • Modules (mainly the new administrator module included - guided tours, frontend link, dashboard modules and more - we'll need to work through the upgrade scripts for a complete list)
  • Workflow assets (all core transitions and stages)

Expected result

No asset issues on upgrade

Actual result

Missing assets on upgrade

Additional comments

Issues found thanks to the PWT ACL Manager whilst upgrading our core sites

avatar wilsonge wilsonge - open - 13 Aug 2023
avatar joomla-cms-bot joomla-cms-bot - change - 13 Aug 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 13 Aug 2023
avatar wilsonge wilsonge - change - 13 Aug 2023
The description was changed
avatar wilsonge wilsonge - edited - 13 Aug 2023
avatar richard67
richard67 - comment - 13 Aug 2023

@wilsonge We don’t insert new assets with update SQL scripts because we can’t really know the right lft and rgt values when inserting them.

avatar wilsonge
wilsonge - comment - 16 Aug 2023

I know but that's why we've had the refresh assets in script.php since joomla update was introduced in 2.5

avatar richard67
richard67 - comment - 16 Aug 2023

I know but that's why we've had the refresh assets in script.php since joomla update was introduced in 2.5

@wilsonge But this works only for assets on level 1 which are direct child of the root asset, it doesn’t work for level 2 and below.

Besides this, not all tables have a getParentAsset (or so) method, so if you e.g. create a new scheduled task, that task has a level 1 asset. We should fix that first if it’s an issue before we add something g to create such assets on update.

avatar chmst
chmst - comment - 21 Aug 2023

After updating a 4.3.x to the news stable version, all backend modules with assed_id = 0 were duplicated. I updated with upload and update. This will result in tons of user issues and so I think it needs a quick solution.

grafik

Table Before
grafik
Table After
grafik

avatar richard67
richard67 - comment - 21 Aug 2023

After updating a 4.3.x to the news stable version, all backend modules with assed_id = 0 were duplicated. I updated with upload and update. This will result in tons of user issues and so I think it needs a quick solution.

I don't think this is related to the asset_ids, and I never have seen that with a clean install. Maybe there was something wrong with the schema version in database so the SQL update script has run a 2nd time?

avatar chmst
chmst - comment - 21 Aug 2023

I never had it on fresh installation, of course.
And not on installations which were set up with J4. This is an old site, upgraded from J3 in many steps.
The schema version could be a hint, thank you.

avatar richard67
richard67 - comment - 21 Aug 2023

@chmst Does your observation belong to a test of this PR here? Or was that with a "normal" 4.3 without this PR? Silly me, it is an issue here, the PR was #41358 . Have you tested that PR, or have you found the issue without it?

avatar chmst
chmst - comment - 21 Aug 2023

I found the issue when I updated the site (local copy). Not testing any PR.
I was wondering how my backend looks after the update and noticed is that only modules with asset_id = 0 are duplicated

avatar richard67
richard67 - comment - 21 Aug 2023

only modules with asset_id = 0 are duplicated

Well, that is because when we insert new modules with update SQL scripts, we use asset_id zero (or not use asset_id at all, which has the same result. So if an update SQL runs a 2nd time and inserts the same modules again, they will again have asset_id zero.

avatar richard67
richard67 - comment - 21 Aug 2023

@chmst The modules are inserted with this update script here: https://github.com/joomla/joomla-cms/blob/4.3-dev/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-07-13.sql#L29-L107

So if they have been inserted twice, the schema version in database was either missing or smaller than "4.0.0-2019-07-13".

The schema version of the core is the record in table #__schemas which belongs to the extension named 'files_joomla'.

avatar richard67
richard67 - comment - 21 Aug 2023

@chmst Do you have SQL update scripts with the following names in folder "administrator/components/com_admin/sql/updates/mysql":

  • 4.0.0-2019-01-29.sql
  • 4.0.0-2019-02-17.sql
  • 4.0.0-2019-02-20.sql
  • 4.0.0-2019-05-07.sql

If these 4 scripts exists, then they are the problem. They have been combined together into a new script "4.0.0-2019-07-13.sql" with PR #25570 before 4.0.0 stable, i.e. during alpha or beta phase. But this would mean that the duplicate modules have been already created when updating to 4.0, and that it was an alpha or beta which was used for that.

Or it is like I wrote before that the schema version was not ok.

avatar richard67
richard67 - comment - 21 Aug 2023

@chmst Another way how the duplicate modules can happen is when you have a failed update from 3.10 and you restore a backup from before the update, but you haven't used an empty database for that, and then you update again from 3.10, this time successful. But with updating a clean 4.3.0 or 4.3.1 or 4.3.2 to 4.3.3 this should not happen.

avatar chmst
chmst - comment - 21 Aug 2023

Thanks for investigating. I don't have these files. I will repeat the udate on a new copy of my site and see what happens.

avatar brianteeman
brianteeman - comment - 21 Aug 2023

FYI I have seen a few reports recently the same as @chmst

avatar richard67
richard67 - comment - 21 Aug 2023

FYI I have seen a few reports recently the same as @chmst

Me too, but as I've never had a pre-update backup to check that, I don't really know the reason for the issue. I only can make assumption based on my knowledge on how it should work and where problems could come from.

avatar Hackwar Hackwar - change - 24 Aug 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 24 Aug 2023

Add a Comment

Login with GitHub to post a comment