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

[5.1] Add update channel reset to Joomla Update Component version 5.1.2 #43695

Open
wants to merge 8 commits into
base: 5.1-dev
Choose a base branch
from

Conversation

richard67
Copy link
Member

@richard67 richard67 commented Jun 22, 2024

Pull Request for Issue #43591 .

Alternative to PR #43717 .

Summary of Changes

This pull request (PR) does 2 things:

  1. It adds a function to the Joomla Update Component to automatically reset the update source (update channel) to "Default" in the component's options at the end of each CMS core update when it was set to "Joomla Next" before the update.
  2. It adds the same functionality with a newly added installer script (script.php) to the component so it can be run when the component is updated to version 5.1.2 with a stand-alone update for the component, which is planned to be provided short before the upcoming 5.1.2 release and which will be provided only for the CMS versions 5.1.0, 5.1.1 or 5.1.2-dev (e.g. nightly).

The reason for this is that with the change to TUF-based updates in 5.1.0, the update channels are handled differently to how it was done before (and still is done with 4.4).

  • With the old XML update sites we could have a particular update several times in different channels so there was no need to switch back.
  • With TUF the update site URL is the same for the two update sources „Default“ and „Joomla Next“, and they are mapped to channels with JVERSION . '.x' for the "Default" and JVERSION+1 . '.x' for "Joomla Next".
    So when you update e.g. from 5.1 to a 6.0 nightly build, "Default" is mapped to channel "5.x" and "Joomla Next" is mapped to channel "6.x" before the update, but after the update "Default" is mapped to channel "6.x" and "Joomla Next" is mapped to channel "7.x".

And when your update source was "Joomla Next" before the update you can only have come from the previous major version. E.g. when you have updated to 5.1 with "Joomla Next" you for sure came from 4.4, and when you have updated to 6.0 with "Joomla Next" you for sure came from the latest 5.x (currently 5.2. but will be 5.4 at the end of the 5.x cycle).

Therefore we can reset from "Joomla Next" to "Default" after every update, there is no need for additional version checks.

The change mentioned above with change number 2, the new installer script for the component, will be removed again with 6.0 because it will not be needed anymore with 6.0. Therefore this part is already marked as deprecated, and when this PR here will be merged and be merged up into 6.0-dev (via 5.2-dev) I will make a PR for 6.0-dev for the removal.

For the stand-alone update mentioned with change number 2 see also joomla/update.joomla.org#366 .

Update: Meanwhile I've made the alternative PR #43717 which does only part 1 of this PR here and can be used if it turns out that it does not need the extra update for the Joomla Update Component because we can offer the core update to 5.1.2 on both channels so people will find it also when being on "Joomla Next".

Testing Instructions

Test 1: Update Joomla Update Component

Pre-condition: You have to be on Joomla version 5.1.0, 5.1.1 or 5.1.2-dev.

Update the Joomla Update Component either by uploading the patched zip package in the extensions installer or by changing the update site URL for the Joomla Update Component e.g. with phpMyadmin and then checking for extension updates.

The patched package can be downloaded from here: https://test5.richard-fath.de/com_joomlaupdate-5.1.2.zip

The custom update site URL which points to this package can be found here: https://test5.richard-fath.de/com_joomlaupdate_test-5-1-2.xml

Do several tests with different starting conditions regarding the update source set in the Joomla Update Component's options:

  • Test with update source = "Joomla Next" before the update.
  • Test with any other update source, i.e. "Default" or "Custom URL".

In addition, do the same different tests using the following patched package for upload in the extensions installer: https://test5.richard-fath.de/com_joomlaupdate-5.1.2-test-error.zip

The patched package provokes a database error for checking what happens when the reset of the update source fails. It can also be used to check that the reset does not take place when the update source is not "Joomla Next" before the update.

It does not need to fall back to the same starting conditions after each test, you can just upload the package again in the extension installer or when using the custom update URL, patch the version in the manifest cache of the component's record in the extension table. But you should at least use a new browser tab or logout and in again after each test to make sure you do not see any old but still enqueued messages (which is another issue when doing several core or extension update attempts in a row and which is not related to this PR).

Test 2: Update the CMS core

Update the CMS core by uploading in the Joomla Update Component the patched zip package created by Drone for this PR.

You can download that package here: https://artifacts.joomla.org/drone/joomla/joomla-cms/5.1-dev/43695/downloads/76879/

Do several tests with different starting conditions regarding the update source set in the Joomla Update Component's options:

  • Test with update source = "Joomla Next" before the update.
  • Test with any other update source, i.e. "Default" or "Custom URL".

When using "Custom URL" you can use the custom URL created by Drone for this PR instead of uploading the package. You can find that custom URL at the same place where you could find the patched package.

In addition, do the same different tests using the following patched package for upload: https://test5.richard-fath.de/Joomla_5.1.2-dev+pr.43695-Development-Update_Package_test-error.zip

The patched package provokes a database error for checking what happens when the reset of the update source fails. It can also be used to check that the reset does not take place when the update source is not "Joomla Next" before the update.

It does not need to fall back to the same starting conditions after each test, you can just upload the package again in the update component. But you should at least use a new browser tab or logout and in again after each test to make sure you do not see any old but still enqueued messages (which is another issue when doing several core or extension update attempts in a row and which is not related to this PR).

Test 3: Make sure the update package from Test 1 is only found when on 5.1.0, 5.1.1 or 5.2-dev.

Change the update site URL for the Joomla Update Component e.g. with phpMyadmin to the following URL and then check for extension updates: https://test5.richard-fath.de/com_joomlaupdate_test-5-1-2.xml

Do that on different Joomla CMS versions, e.g. 4.4.x, 5.1.0, 5.1.1 or a 5.2.0-alpha1 or a 5.2-dev or 6.0-dev nightly.

Actual result BEFORE applying this Pull Request

When you are still on the "Joomla Next" update channel after an update from 4.4 to 5.1, there will not be any update found for the CMS core until 6.0.0-alpha1 will be released, and then only updates to 6.0 releases will be found, so you will miss any further updates for 5.1 until that time has come.

There is no notification about that and no automatic reset after the update.

Expected result AFTER applying this Pull Request

Test 1: Update Joomla Update Component

Updating the Joomla Update Component component works.

When having the update source (update channel) set to "Joomla Next" in the Joomla Update Component's options before that update, the update source is rest to "Default" at the end of the update, and an information message is shown about that:
test-component-update-reset-ok

When under the same conditions an error happens with that reset, e.g. due to a database problem, a warning message is shown, which tells the user to manually reset the update source:
test-component-update-reset-error
The update of the component is shown as success as nothing else is broken.

When the update source is not "Joomla Next" so it is "Default" or "Custom URL", the update source is not changed, and the update of the components works as it does without this PR:
test-component-update-no-reset

Test 2: Update the CMS core

Updating the Joomla CMS core works.

When having the update source (update channel) set to "Joomla Next" in the Joomla Update Component's options before that update, the update source is rest to "Default" at the end of the update, and a success message is shown about that:
test-core-update-reset-ok

When under the same conditions an error happens with that reset, e.g. due to a database problem, the usual error layout is shown with all details, and in addition a warning message is shown at the top, telling the user to manually reset the update source:
test-core-update-reset-error

In this case the Joomla Update log administrator/logs/joomla_update.php contains details like for other errors:

2024-06-22T16:44:16+00:00	INFO 192.168.98.1	update	Test logging
2024-06-22T16:44:16+00:00	INFO 192.168.98.1	update	Uploading update file
2024-06-22T16:44:18+00:00	INFO 192.168.98.1	update	File [ROOT][TMP]/juRNnKH5 downloaded.
2024-06-22T16:44:18+00:00	INFO 192.168.98.1	update	Starting installation of new version.
2024-06-22T16:44:25+00:00	INFO 192.168.98.1	update	Finalising installation.
2024-06-22T16:44:26+00:00	INFO 192.168.98.1	update	Start of SQL updates.
2024-06-22T16:44:26+00:00	INFO 192.168.98.1	update	The current database version (schema) is 5.1.1-2024-04-18.
2024-06-22T16:44:26+00:00	INFO 192.168.98.1	update	End of SQL updates.
2024-06-22T16:44:26+00:00	INFO 192.168.98.1	update	Uninstalling extensions
2024-06-22T16:44:26+00:00	INFO 192.168.98.1	update	Deleting removed files and folders.
2024-06-22T16:44:26+00:00	ERROR 192.168.98.1	update	An error has occurred while running "resetUpdateSource". Code: 1054. Message: Unknown column 'paramsx' in 'field list'.
2024-06-22T16:44:26+00:00	INFO 192.168.98.1	update	Cleaning up after installation.
2024-06-22T16:44:26+00:00	INFO 192.168.98.1	update	Update to version 5.1.2-dev is complete.

When the update source is not "Joomla Next" so it is "Default" or "Custom URL", the update source is not changed, and the update of the CMS core works as it does without this PR:
test-core-update-no-reset

Test 3: Make sure the update package from Test 1 is only found when on 5.1.0, 5.1.1 or 5.2-dev.

The update for the Joomla Update Component will only be found when the CMS version is 5.1.0, 5.1.1 or 5.1.2(-dev) but not e.g. on 4.4.x or 5.2.0(-dev).

When later 5.1.2 stable is released and you have updated the CMS to 5.1.2, the targetplatform for the component update would still match, but there will not be an update found anymore for the component because it will already be up to date with its version 5.1.2.

Link to documentations

Please select:

  • No documentation changes for docs.joomla.org needed

  • No documentation changes for manual.joomla.org needed

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-5.1-dev labels Jun 22, 2024
@brianteeman
Copy link
Contributor

Thank you!

@obuisard
Copy link
Contributor

obuisard commented Jun 23, 2024

Test 1 - Successful according to what is expected
Test 2 - @richard67 I can't seem to be able to find https://test5.richard-fath.de/Joomla_5.1.2-dev-Development-Update_Package_test-pr-43695.err.zip
Test 3 - Seems to work :-)

@richard67
Copy link
Member Author

Test 2 - @richard67 I can't seem to be able to find https://test5.richard-fath.de/Joomla_5.1.2-dev-Development-Update_Package_test-pr-43695.err.zip

@obuisard Sorry, my mistake, had forgotten to upload it. I've meanwhile created a new one based on the one cleared by Drone for this PR. Please use https://test5.richard-fath.de/Joomla_5.1.2-dev+pr.43695-Development-Update_Package_test-error.zip . I've updated the testing instructions with the new link. Thanks for testing so far.

@obuisard
Copy link
Contributor

obuisard commented Jun 24, 2024

@obuisard Sorry, my mistake, had forgotten to upload it. I've meanwhile created a new one based on the one cleared by Drone for this PR. Please use https://test5.richard-fath.de/Joomla_5.1.2-dev+pr.43695-Development-Update_Package_test-error.zip . I've updated the testing instructions with the new link. Thanks for testing so far.

Thank you, Richard!

For Test 2, I cannot get it to fail with the latest package.

@richard67
Copy link
Member Author

For Test 2, I cannot get it to fail with the latest package.

@obuisard Could be a problem with the state storage not being cleaned up when running several updates in a row. But that would not be caused by this PR. Maybe just test again in a new browser session.

@richard67
Copy link
Member Author

Meanwhile I've made the alternative PR #43717 which does only part 1 of this PR here (which is tested with Test 2 here) and can be used if it turns out that it does not need the extra update for the Joomla Update Component because we can offer the core update to 5.1.2 on both channels so people will find it also when being on "Joomla Next".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language Change This is for Translators PR-5.1-dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants