CUpdater now compatibles with Joomla 3

Well, as it usually happens something that needs 10mins of work turns out to be a whole day worth of work... CUpdater was originally developed for Joomla 2.5 so the update to 3.0 shouldn't have been that big of deal. Unfortunately a small change in the Joomla API can lead to serious issues. This is going to get a little technical, so if you are not in the mood you can just go to the download section :)

On Joomla 3 the findUpdate function was updated to use the JHttp get method instead of fopen. Which is of course great, however when you have an update url that is not returning what we expect things get nasty. Whenever I was trying to check for updates I was getting "No HTTP response received.". So I turned xdebug and started going through the code line for line. First were the joomla update urls -> they all were resolved just fine. Then came a compojoom update url. And voila I got the error. Copy pasting the url in the browser was returning the correct xml format expected from Joomla . So after watching the screen and scratching my head I decided to debug further. It turns out that the JHttpTransportCurl class cannot handle https urls (or at least it cannot handle them on my server). So the getResponse method in the class throws an UnexpectedValueException because curl couldn't fetch the content.
Now if I'm in the backend and I manually click on the find updates button and I get an ugly error message on the screen I might get confused & annoyed, but I've caused it by clicking on the button & I'm the only one who sees it, so it is not that big of a deal. But if you have a plugin that randomly checks for updates when normal users are on the site things can confusing.

This error should actually be caught by the JUpdaterExtension class, but the class is actually not expecting any Exception... Because of this if you have any url on your site that for some reason cannot be accessed and it returns an empty body, then you'll get the "No HTTP response received" message. Now the correct thing would be for the joomla API to automatically disable this url for the next update check & it does this, but not when curl throws an Exception. So what I did to go around the problem is - catching the Exception in CUpdater and sending a mail to the user notifying him of the error. Currently one needs to manually figure out which is the problematic url and disable it for the next update check. If you don't the update check will always stop at that url & you won't be able to use the joomla update function in the backend.

Now if someone wants to fix this. That is where you need to look: https://github.com/joomla/joomla-cms/blob/master/libraries/joomla/updater/adapters/extension.php#L173

 

Rate this blog entry:
0
CMandrill - Joomla transactional emails on steroid...
CMC 1.3 released. Ecommerce360 tracking is easier ...