? ? Success

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
26 Sep 2018

Pull Request for Issue #20500.

Summary of Changes

We are expecting the core extensions will always have the same ID. To achieve that we defined some ranges per plugin types, where every extension is getting a hardcoded ID during installation. This can bring us into troubles when we will exceed that range with core extensions. The current situation shows us that as when new extensions got added to 3 and 4, merging it from one branch to another leads to troubles. Especially when the privacy suite gets merged into 4. To prevent that we should get rid of the idea that core extensions will always have the same ID. More information can be found in issue #20500.

This pr removes the hardcoded ids from the installation script and removes traces in the code to hardcoded ID's. All core extensions do get installed in the order of the installations script and new extensions will follow. The increment index doesn't start anymore on 10'000.

Testing Instructions

  • Install joomla
  • Install sample data

Expected result

All should work as before.

Actual result

All is working.

Documentation Changes Required

We need to document that in the migration guide.

avatar laoneo laoneo - open - 26 Sep 2018
avatar laoneo laoneo - change - 26 Sep 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 26 Sep 2018
Category SQL Administration com_admin Postgresql com_installer com_joomlaupdate com_postinstall Modules Installation Libraries Front End Plugins
7ed381e 26 Sep 2018 avatar laoneo CS
avatar laoneo laoneo - change - 26 Sep 2018
Labels Added: ? ?
avatar laoneo
laoneo - comment - 26 Sep 2018

@alikon or @richard67, I did the postgres changes without testing. Can you guys please have a look if they are correct?

avatar brianteeman
brianteeman - comment - 26 Sep 2018

You need to check the jaavascript as well. pretty certain that at least the update check uses the eid

avatar mbabker
mbabker - comment - 26 Sep 2018

You need the IDs in the joomla.sql files because that file is seeding the initial database state which includes several pseudo-foreign key relations to the extensions table. So as long as our initial data seed is entirely a SQL file they need to exist there.

avatar laoneo
laoneo - comment - 26 Sep 2018

@brianteeman found it in the JS file, on it.

@mbabker I'v replaced the menu and update sites with subselects. So as far as I could see it there are no more hardcoded extension ids.

avatar joomla-cms-bot joomla-cms-bot - change - 26 Sep 2018
Category SQL Administration com_admin Postgresql com_installer com_joomlaupdate com_postinstall Modules Installation Libraries Front End Plugins SQL Administration com_admin Postgresql com_installer com_joomlaupdate com_postinstall Modules JavaScript Repository Installation Libraries
avatar brianteeman
brianteeman - comment - 26 Sep 2018

I did a clean install of this branch
administrator/index.php?option=com_installer&view=update gives
0 Class 'Joomla\Component\Installer\Administrator\Model\ExtensionHelper' not found

avatar laoneo
laoneo - comment - 26 Sep 2018

Does it include the latest two commits?

avatar brianteeman
brianteeman - comment - 26 Sep 2018

administrator/index.php?option=com_installer&view=updatesites
gives

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3

avatar brianteeman
brianteeman - comment - 26 Sep 2018

administrator/index.php?option=com_joomlaupdate
gives

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

avatar laoneo
laoneo - comment - 26 Sep 2018

Can you download it again as there was something missing in the update scripts. You need also to recompile the js files.

avatar laoneo
laoneo - comment - 26 Sep 2018

@mbabker the package ids are now determined in a second query for the languages.

avatar brianteeman
brianteeman - comment - 26 Sep 2018

Can you download it again as there was something missing in the update scripts. You need also to recompile the js files.

no change

avatar laoneo
laoneo - comment - 26 Sep 2018

Strange, just tested it and it worked. What does the update_sites_extensions table has for content?

avatar brianteeman
brianteeman - comment - 26 Sep 2018

What does the update_sites_extensions table has for content?

That was the clue - it was missing the joomla update - rebuilt everything again etc and now those errors have gone

avatar laoneo
laoneo - comment - 27 Sep 2018

Can you mark as test successful then in the tracker? Thanks for testing!

avatar joomla-cms-bot joomla-cms-bot - change - 17 Oct 2018
Category SQL Administration com_admin Postgresql com_installer com_joomlaupdate com_postinstall Modules Installation Libraries JavaScript Repository SQL Administration com_admin Postgresql com_installer com_joomlaupdate com_languages com_postinstall com_users Modules JavaScript Repository Installation
avatar joomla-cms-bot joomla-cms-bot - change - 17 Oct 2018
Category SQL Administration com_admin Postgresql com_installer com_joomlaupdate com_postinstall Modules Installation JavaScript Repository com_languages com_users SQL Administration com_admin Postgresql com_installer com_joomlaupdate com_postinstall Modules JavaScript Repository Installation Libraries
avatar bonzani
bonzani - comment - 18 Jan 2019

I have tested this item successfully on c3560da


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

avatar bonzani bonzani - test_item - 18 Jan 2019 - Tested successfully
avatar laoneo
laoneo - comment - 6 Feb 2019

So we have two successful tests, setting to RTC.

avatar roland-d
roland-d - comment - 6 Feb 2019

@laoneo We have merge conflicts though :/

avatar laoneo
laoneo - comment - 7 Feb 2019

Conflicts fixed

avatar roland-d
roland-d - comment - 9 Feb 2019

@laoneo I guess we can't merge this fast enough as it has conflicts again :/

avatar laoneo
laoneo - comment - 21 Mar 2019

@wilsonge let me know if you want to add this (sooner or later we have to). I will fix the conflicts once more.

avatar wilsonge
wilsonge - comment - 22 Mar 2019

Let's do this - but please don't touch the update files of the privacy component/action logs stuff per #24188

Ping me when it's done - there's too many PR's for me to track these days so I'm reliant on github notifications/glip I'm afraid :(

avatar laoneo
laoneo - comment - 22 Mar 2019

Then better to wait till privacy is merged? Because it takes me some time to clean up the merge conflicts, better to do it only once.

avatar wilsonge
wilsonge - comment - 22 Mar 2019

works for me

avatar laoneo laoneo - change - 16 Apr 2019
Labels Removed: J4 Issue
avatar joomla-cms-bot joomla-cms-bot - change - 16 Apr 2019
Category SQL Administration com_admin Postgresql com_installer com_joomlaupdate com_postinstall Modules Installation JavaScript Repository Libraries SQL Administration com_admin Postgresql com_installer com_joomlaupdate com_postinstall Modules JavaScript Repository NPM Change Installation Libraries
avatar laoneo laoneo - change - 16 Apr 2019
Labels Added: NPM Resource Changed
avatar laoneo laoneo - change - 16 Apr 2019
Labels Removed: NPM Resource Changed
avatar joomla-cms-bot joomla-cms-bot - change - 16 Apr 2019
Category SQL Administration com_admin Postgresql com_installer com_joomlaupdate com_postinstall Modules Installation JavaScript Repository Libraries NPM Change SQL Administration com_admin Postgresql
avatar laoneo
laoneo - comment - 16 Apr 2019

@wilsonge fixed the conflicts. Made a test installation and it worked.

avatar laoneo
laoneo - comment - 17 Apr 2019

Moved the plugins

avatar wilsonge wilsonge - change - 17 Apr 2019
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-04-17 10:03:04
Closed_By wilsonge
avatar wilsonge wilsonge - close - 17 Apr 2019
avatar wilsonge wilsonge - merge - 17 Apr 2019
avatar wilsonge
wilsonge - comment - 17 Apr 2019

Thanks!

avatar richard67
richard67 - comment - 17 Apr 2019

Many thanks to @laoneo for this great work.

avatar roland-d
roland-d - comment - 17 Apr 2019

@laoneo Thank you for this.

avatar laoneo
laoneo - comment - 18 Apr 2019

At your service :-)

avatar richard67
richard67 - comment - 19 Apr 2019

@laoneo Maybe there is still something to be done.

The function getExtensionRecord uses only the name as criteria to get the right extension record, and in several schema updates the element is used as the only criteria, e.g. WHERE element = 'phputf8'. The first method would require that the name is unique for each extension, and the second method requires that the element is unique.

But in the extension table is no unique constraint for any of these columns name or element.

Is that by purpose, or is it just missing?

If just missing: Can we assume that there are never 2 core or 3rd party extensions using the same name, and can we assume the same for the element column? If so, it would just be enough to add unique constraints for those columns in the extension table. I would make a PR for that if desired.

But if it can't be granted that there will never be any extensions using the same name or element, then the criteria for getting the right extension should be extended, e.g. like it is for checking if core extension, where we have columns type, element, folder and client_id, and combination of these can be used to identify the extension, so the mathing criteria to get the 1 extension we want would be e.g. WHERE type = 'library' AND element = 'phputf8' AND folder = '' AND client_id = 0 in schema updates, and the getExtensionRecord would be changed in the same way.

Or maybe a mix of both, e.g. the name column can be assumed to be unique, so we add a uniqoe constraint for it, but the element column can not be assumed to be unique, so we use the condition for columns type, element, folder and client_id mentioned above in the schema updates, or maybe vice versa, i.e. name column not unique, but element comun unique?

I could make a PR for any of the mentioned solutions, but I need feedback if something has to be done and what is the better way.

But like it is now it is not ok, too risky assuming something is unique and not having a unique constraint on it.

Maybe all that was discussed before, but I was missing the discussion because I did not have much time for Joomla in the recent months?

Update: I just see that neither the name nor the element is unique for extensions, like language packs for site and admin having same values for both. So we can't add unique constraints for these columns.

avatar wilsonge
wilsonge - comment - 19 Apr 2019

element and folder should be unique i think. Element is unique for everything except plugins. And in the case of plugins element combined with folder is unique.

avatar richard67
richard67 - comment - 19 Apr 2019

@wilsonge No, they are not unique, see the update at the end of my comment above.

avatar richard67
richard67 - comment - 19 Apr 2019

@wilsonge The schema updates could be ok as long as no third party extensions use element values like 'phputf8' or so, but we could make them 100% safe by using type and element and folder and client_id as criteria. I could make a PR for that.

The name column is not unique. But the new getExtensionRecord functions seems to check only loaded plugins, correct me if that is wrong. So for language extensions which use same name and same element for admin and site clients we could be safe with checking name only because never 2 clients site and admin are loaded at the same time, but I am not sure about 3rd party stuff.

avatar wilsonge
wilsonge - comment - 19 Apr 2019

The element determines what folder the app gets placed in. Even if the database doesn’t enforce it I think if you’ll find the existing phputf8 library would get overwritten

avatar richard67
richard67 - comment - 19 Apr 2019

@wilsonge For the schema updates, please check PR #24641 .

avatar mbabker
mbabker - comment - 19 Apr 2019

The extension name and element do not have to be globally unique, they do have to be unique within a set of constraints. #23219 covers some of it.

Add a Comment

Login with GitHub to post a comment