? Success

User tests: Successful: Unsuccessful:

avatar phproberto
phproberto
3 Dec 2014

This fixes #5284

Description

This pull request tries to fix three problems:

1. Disabling update sites

Joomla disables update sites when connecting to them fails. It may be caused by update sites not being available temporary. So disabling them is the worse we can do because it leaves the sites disconnected from updates.

This pull request removes the automatic disabling way. If there is a connection error to the update sites they will be still shown when searching for updates.

Users still can disable the update sites manually.

2. Already disabled update sites

There are sites that already have some update sites disabled and users don't know it. This pull request adds a warning when you click on Find updates on Extension Manager: Update if there are existing disabled update sites:

warnin-extension-update

3. Language updates

When users go to the Language Installer they may not know that the languages update site has been disabled. When user clicks on Find Languages we can be sure that they want to enable the update site because they are searching for new languages. So this pull request automatically enables the languages update site when clicking in Find Languages.

Backward compatibility

This pull request should not cause any B/C issue

Test

To test after applying the patch:

  • Edit your database and set enabled to 0 in the #__update_sites table for Accredited Joomla! Translations. Then go to the language manager and click on Find Languages. The site should be enabled automatically and language updates found.
  • Edit your database and modify the location of any entry in the #__update_sites to make sure it's wrong. Then go to Extension Manager: Update and make sure that when clicking on Find Updates that entry is not disabled but a warning about the wrong connection is still shown. You can check that before the patch it was disabled.
  • Edit your database and set enabled to 0 in the #__update_sites for any entry. Then go to Extension Manager: Update and click in Find Updates. You should see the disabled update sites warning and the link should point to the Update Sites Manager
avatar phproberto phproberto - open - 3 Dec 2014
avatar jissues-bot jissues-bot - change - 3 Dec 2014
Labels Added: ?
avatar Bakual
Bakual - comment - 3 Dec 2014

I disagree with removing the automatic disabling of updateservers as I think it's actually a useful feature by itself. Especially for updateservers which are not set up correctly.
If you don't do that, the update just takes ages and you have to manually find and disable the correct server.

The other points I agree with.

Just a thought: Instead of creating yet another method to enable an updateserver, would it make sense to use the one from the updatemodel? See https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_installer/models/update.php#L205
Currently, that one does enable all updatesites, but it would be easy to add a parameter which allows to enable a site by id, eid or name or whatever.
Or even better use the updatesites model: https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_installer/models/updatesites.php#L90

avatar nikosdion
nikosdion - comment - 3 Dec 2014

@test Successful (for all proposed tests). Thank you, Roberto!

avatar nikosdion
nikosdion - comment - 3 Dec 2014

@bakual We could always follow the disable-fetch-enable method I proposed in gh-5284. I know for a fact it works and does prevent the problem you describe. It just takes two small tweaks in the two JUpdater adapters.

avatar Bakual
Bakual - comment - 3 Dec 2014

I probably don't understand the disable-fetch-enable method. What is the point if you disable the server when you are still trying to access it? Imho if it's disabled, it should not be contacted at all like it is today. But I most likely misunderstood something.

avatar nikosdion
nikosdion - comment - 3 Dec 2014

Yes, you missed the point :)

We are inside a JUpdater adapter, let's say JUpdaterExtension, line 214. What I propose is this:
1. Disable the update site
2. Execute the try-catch block which fetches the update
3. Re-enable the update site

Why?

Currently the try-catch block will run to completion ONLY if the server responds within a "reasonable" amount of time, where "reasonable" is anything less than the PHP maximum execution time limit. What happens if the server takes 180 seconds to respond but the PHP maximum execution time limit is 10 seconds? We get a white page and the update site IS NOT disabled. Therefore any future fetch update attempt will lead to a white page again. Perceived state by the user: Joomla! is broken.

With my proposed trick you still get the white page the first time. BUT! The update site is now disabled, because step 3 (re-enabling it) did not run. Therefore the next time you try fetching updates will work, since the faulty update site is now disabled. Perceived state by the user: temporary fluke, Joomla! rocks.

Now, should you disable the update site when $response is null? No. According to my (and every other developer's) experience the null response is returned when there is a temporary network issue, a server misconfiguration or a server firewall preventing $http->get($url) from connecting to the update site. As a result $http->get($url) returns an immediate null reply. There is nothing appearing to be stuck as far as the user is concerned and we do give them feedback that this update site cannot be fetched from the server. This is an indication to the user that they have to contact their host to fix update fetching in Joomla!.

If we disable the update sites automatically we do a double disservice to the user:
1. Repeating the update fetch no longer returns any warnings and the user is not aware that all of his update sites have been disabled.
2. Even if the error condition is lifted, repeating the update fetch returns no feedback, misleading the user to thinking that their Joomla! installation and their extensions are up-to-date.

If we don't disable the update sites automatically we do a double great service to the user:
1. Repeating the update fetch returns the same error which they can paste to the Joomla! forum where someone more experienced will tell them what to do (basically, contact their host)
2. When they lift the error condition and retry fetching the updates they will KNOW that the result (updates available or no updates exist) is the CORRECT status, therefore they can trust the updater to tell them if their site is out of date or not.

I hope this sheds more light into the idea of disable-fetch-enable and why it actually fixes the problems we currently have. As I said, it is a well-tested solution.

avatar brianteeman brianteeman - change - 3 Dec 2014
Category Updating
avatar Bakual
Bakual - comment - 3 Dec 2014

Ah gotcha! Thanks for the explanation, it makes sense now!

avatar nikosdion
nikosdion - comment - 3 Dec 2014

You're welcome!

avatar infograf768
infograf768 - comment - 3 Dec 2014

@test
This PR works fine here.

@nikosdion
Do we need anything else?

avatar nikosdion
nikosdion - comment - 3 Dec 2014

Not in this PR. I guess that after it's merged I can start working on the disable-fetch-enable implementation.

avatar infograf768
infograf768 - comment - 3 Dec 2014

Let's go for it. :)

avatar infograf768 infograf768 - close - 3 Dec 2014
avatar infograf768 infograf768 - change - 3 Dec 2014
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-12-03 17:17:58
avatar nikosdion
nikosdion - comment - 4 Dec 2014

I submitted PR gh-5319 with the implementation of the disable-fetch-update and some improvements which can help web site owners to troubleshoot update issues.

avatar Bakual
Bakual - comment - 4 Dec 2014

Great job, thanks already!

avatar nikosdion
nikosdion - comment - 4 Dec 2014

Always a pleasure :)

Add a Comment

Login with GitHub to post a comment