[3.10] Don't use hard-coded extension_id to insert the EOS310 plugin in update SQL scripts #35034
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request for Issue #35032 .
Summary of Changes
Don't use a hard-coded extension_id for inserting the EOS310 plugin extension in update SQL scripts but let the auto-increment of the ID column decide.
This will result in the extension_id having a value above 10000 like 3rd party extensions have, but this is ok since we don't use that hard-coded value of 10000 anymore but the ExtensionHelper to determine if an extension is core or not.
The change is necessary because it can happen that the extension_id is already used, in case of issue 35032 it is extension_id 496 being already used by the mod_latestactions extension, and this results in an SQL error which makes the further SQL updates not being executed.
In case of issue 35032 it was the very last SQL statement in the last update SQL script, so the damage was not so big. But this will not be the case anymore if during the life time of 3.10 further update SQL scripts will be added.
Normally mod_latestactions should not have an extension_id of 496 like it was on the site with the issue because in 3.9.0-2018-05-20.sql we insert it with id 319 when updating versions older than that.
Testing Instructions
Preparation
Important hint: This PR is for 3.10, but it deals with updating from 3.9 to 3.10, so the tests have to be started on a 3.9 site (any recent version or nightly build) or when using a git clone the staging branch.
If you don't have an installation of that, make a new installation using an empty database.
If you have a 3.9.28 (or similar) site with a longer update history, check if there is already a core extension with ID (in database
extension_id
) = 496.If this is the case, you are done ready for the test and can directly jump to section "Test Procedure" below.
Otherwise, if there is no extension with ID = 496, execute the following SQL in your database to insert a dummy extension, haing replaced the "#__" in the table name by your actual table prefix:
The above SQL statements are for MySQL or MariaDB. If you are using PostgreSQL or MS SQL server, leave away the first
SET SQL_MODE
statement and adapt names quoting and the zero datetime to that database needs.Test Procedure
Set error reporting to maximum in Global Configuration.
Update the CMS to the latest 3.10 nightly build.
Result: See section "Actual result BEFORE applying this Pull Request" below. Verify that the details shown there apply in your backend.
Set error reporting to maximum in Global Configuration.
Update the CMS to the current 3.10-dev branch plus this PR applied.
You can use the custom URL https://test5.richard-fath.de/pr-35034_list.xml instead. It points to the same update server but targets also 3.9 versions.
Result: See section "Actual result BEFORE applying this Pull Request" below. Verify that the details shown there apply in your backend.
Actual result BEFORE applying this Pull Request
The update has finished but shows a warning alert about SQL error "Duplicate entry '496' for key '#__extensions.PRIMARY' as described in issue #35032 .
The database checker shows one problem about not matching database schema version:
The "Fix" button works. But it does not do anything beside fixing the schema version mismatch because database structure was already up to date, the SQL which has not been run was not a structure change.
The quickicon plugin "Joomla! 3.10 End Of Support Notification" has not been added with the update.
Because the SQL statement which failed was the last one in the last update SQL script and later update actions in script.php have been processed, the updated site is ok except of the missing EOS quickicon plugin. But that might change in future if more 3.10 update SQL scripts will be added to run after that one which failed here, and then these would be skipped, too, which could leat to larger damages.
Expected result AFTER applying this Pull Request
The update has finished without any warning alert.
The database checker shows only the usual problem about not matching database update version when using update packages built by Drone for pull requests:
The quickicon plugin "Joomla! 3.10 End Of Support Notification" has been added with the update.
Documentation Changes Required
None.