Skip to content

[5.4] Add pre-update checks for backward compatibility plugins for update to Joomla 6 #45493

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

Draft
wants to merge 4 commits into
base: 5.4-dev
Choose a base branch
from

Conversation

richard67
Copy link
Member

Pull Request for Issue # .

Summary of Changes

This pull request (PR) adds 2 new checks to the "Required Settings" checks of the pre-update checker which are shown when an update to the next major version (here 6) is found:

  1. Check if the backward compatibility plugin of the current major version (here 5) is disabled.
  2. Check if the backward compatibility plugin of the next major version (here 6) is enabled.

If one of these checks fails, you cannot update to the next major version with Live Update.

You can bypass these tests by using the "Upload & Update" button, but that's already the case with other required settings checks and should be fixed with another PR, if ever.

The first check has been agreed by the CMS Maintenance Team.

The plugin has to be disabled before the update so the user can see if the site crashes due to a 3rd party extension like e.g. a system plugin which requires the plugin so it very likely will not work anymore on Joomla 6.

If that happens, the user can enable it again in the database and the site is operable again, e.g. fopr updating or uninstalling that extension.

If we would not do that, the site would break during the update when files are already unpacked but the database has not been updated yet, and that would be fixed not that easy.

The second check is for the case that the admin has disabled the J6 b/c plugin, what one should not do, but we can't really prevent it.

Documentation required?

I don't know if it needs to create or update some documentation for the change made by this PR.

Testing Instructions

  1. On a current 5.4-dev branch or latest 5.4 nightly build, enable the "Behaviour - Backward Compatibility" plugin.

  2. In the options of the Joomla Update Component, set the update channel to "Custom URL" and enter the custom update URL of the 6.0 nightly builds: https://update.joomla.org/core/nightlies/next_major_list.xml

  3. Check for updates.
    Result: See section "Actual result BEFORE applying this Pull Request" below.

  4. Apply the changes from this PR.

  5. Check again for updates.
    Result: There are 2 new checks in the "Required Settings" section of the pre-update check.
    The first check for the J5 plugin has failed, and a notice is shown with a link to the plugin manager, telling to disable the plugin, and you can not update to Joomla 6 with Live Update.
    See first image in section "Expected result AFTER applying this Pull Request" below.

  6. Disable the "Behaviour - Backward Compatibility" plugin.

  7. Check again for updates.
    Result: Both new checks have succeeded, and you could update to Joomla 6.
    See second image in section "Expected result AFTER applying this Pull Request" below.

  8. Disable the "Behaviour - Backward Compatibility 6" plugin.

  9. Check again for updates.
    Result: The second check for the J6 plugin has failed, and a notice is shown with a link to the plugin manager, telling to enable the plugin, and you can not update to Joomla 6 with Live Update.
    See third image in section "Expected result AFTER applying this Pull Request" below.

  10. Edit file "libraries/src/Version.php" and change line 50 from public const MINOR_VERSION = 4; to public const MINOR_VERSION = 3; so we can later find an update to a 5.4 nightly build.

  11. Go to "System - Maintenance - Database" (administrator/index.php?option=com_installer&view=database), select the "Joomla CMS" record and then use the "Update Structure" button. This will apply the change from step 10 also in the database, so now you are faking to be on version 5.3.0-alpha1.

  12. In the options of the Joomla Update Component, set the custom update URL to the one of the 5.4 nightly builds: https://update.joomla.org/core/nightlies/next_minor_list.xml

  13. Check again for updates.
    Result: An update to 5.4.0-alpha1 is found. The 2 new checks and the check "Database Supported" are not shown as it is not an update to a new major version, and the update would be possible.
    See fourth image in section "Expected result AFTER applying this Pull Request" below.

Actual result BEFORE applying this Pull Request

There is no check about backward compatibility plugins in the "Required Settings" checks of the pre-update checker, and you could update to J6.
pre-update-check-6_without-pr

Expected result AFTER applying this Pull Request

There are 2 new checks in the "Required Settings" section of the pre-update check:

  • The Joomla 5 Backward Compatibility plugin is disabled
  • The Joomla 6 Backward Compatibility plugin is enabled

If the Joomla 5 Backward Compatibility plugin is enabled, a notice is shown with a link to the plugin manager, telling to disable the plugin, and you can not update to Joomla 6 with Live Update.
pre-update-check-6_with-pr

If the Joomla 5 Backward Compatibility plugin is disabled and the Joomla 6 Backward Compatibility plugin is enabled, both checks are successful, and you could update to Joomla 6.
pre-update-check-6_with-pr_2

If the Joomla 6 Backward Compatibility plugin is disabled, a notice is shown with a link to the plugin manager, telling to enable the plugin, and you can not update to Joomla 6 with Live Update.
pre-update-check-6_with-pr_3

On update to a new minor or patch version of the same major version, the 2 new checks are not shown, and you could update.
pre-update-check-6_with-pr_4

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

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-5.4-dev labels May 17, 2025
@richard67 richard67 added this to the Joomla! 5.4.0 milestone May 17, 2025
@brianteeman
Copy link
Contributor

Why should I have to enable the j6 compatible plugin. My sites only contain core, no extensions. I don't need to enable the plugin.
This requirement makes no sense.

@richard67
Copy link
Member Author

Why should I have to enable the j6 compatible plugin. My sites only contain core, no extensions. I don't need to enable the plugin. This requirement makes no sense.

@brianteeman Because we can not know if this is the case when someone updates to J6. Therefore it was decided by the CMS Maintenance Team that it shall be enabled on updates to 6, and the compat6 plugin is enabled by default in Joomla 5, see #45371 . You can later after the update disable in in J6.

@richard67
Copy link
Member Author

P.S.: Even if there are no 3rd party extensions at all, there still can be overrides using classes which were moved into the compat6 plugin in J6, e.g. from the CMS Filesystem stuff, and we can not really check all that.

@brianteeman
Copy link
Contributor

Crazy

@richard67
Copy link
Member Author

Crazy

@brianteeman If you think making the update as safe as possible for as many users as possible is crazy then I cannot help you.

@brianteeman
Copy link
Contributor

we are doing something very wrong if a site with only core requires this plugin

@richard67
Copy link
Member Author

we are doing something very wrong if a site with only core requires this plugin

It seems you did not understand my previous comment. It is not needed for the core but for the case someone has 3rd party extensions or overrides which require it.

@HLeithner
Copy link
Member

thank you that pr looks good to me, will test later

@HLeithner
Copy link
Member

HLeithner commented May 18, 2025

I have tested this item ✅ successfully on 89b2893

Works as expected.


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

Compat Plugin for 5 is active and for 6 is disabled:
image

Compat Plugin for 5 is disabled and for 6 is active
image

@brianteeman
Copy link
Contributor

I have tested this item 🔴 unsuccessfully on 89b2893

Completely ignores the cli update


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

@brianteeman
Copy link
Contributor

brianteeman commented May 18, 2025

image

image

and it appears to have hung [update] just slow

@@ -96,6 +96,10 @@ COM_JOOMLAUPDATE_VIEW_COMPLETE_MESSAGE="Your site has been updated. Your Joomla
COM_JOOMLAUPDATE_VIEW_COMPLETE_UPDATE_ERRORS="Brief list of captured errors"
COM_JOOMLAUPDATE_VIEW_COMPLETE_WITH_ERROR_MESSAGE="The update completed with errors. Please examine the update logs %s for more details.<br>It is recommended to restore the site from backup, fix the issues that caused the update failure and try to update again.<br>You always can ask for help on Joomla! forum %s"
COM_JOOMLAUPDATE_VIEW_DEFAULT_ACTUAL="Actual"
COM_JOOMLAUPDATE_VIEW_DEFAULT_COMPAT_PLUGIN_DISABLED_NOTICE="Go to <a href=\"index.php?option=com_plugins\">'System - Manage - Plugins'</a> and disable the 'Behaviour - Backward Compatibility' plugin."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an alternative, you can use a direct link to the installed filter for this plugin:
index.php?option=com_plugins&view=plugins&filter[folder]=behaviour&filter[element]=compat

@richard67
Copy link
Member Author

@brianteeman Thanks for testing. It seems that there is only the check for database schema in the CLI, all other checks (including those added by this PR) are not there. I wasn't aware of that.

Before I update this PR to work also with the CLI, I will investigate if there are other ways to handle the compatibility plugins.

We might also need to discuss it again in the maintainers team.

I'm setting this PR to draft in the mean time.

@richard67 richard67 marked this pull request as draft May 19, 2025 08:00
@brianteeman
Copy link
Contributor

@brianteeman Thanks for testing. It seems that there is only the check for database schema in the CLI, all other checks (including those added by this PR) are not there. I wasn't aware of that.

It is a two year old bug
#40444

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants