?
avatar Bakual
Bakual
22 Jan 2019

Steps to reproduce the issue

On localhost (eg XAMPP) install some extensions and try to load the "System" view.
Optionally cut off your internet connection and try to load the "System" view.

Expected result

Loads instantely

Actual result

Page loads delayed.

Additional comments

Apparently, the code checks for updates on pageload. If an update source isn't available (due to internet outage, missing source, proxy setting, whatever), the page isn't loaded until the request times out.

This is obviously bad design. There is no reason to check for updates each time I load that page. Or at least it should be done like on the regular cPanel where the check is done using AJAX (so site loading is not delayed).

avatar Bakual Bakual - open - 22 Jan 2019
avatar joomla-cms-bot joomla-cms-bot - change - 22 Jan 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 22 Jan 2019
avatar infograf768
infograf768 - comment - 22 Jan 2019

I do agree, but I did not know how to do that and still don't. :)

avatar Bakual
Bakual - comment - 22 Jan 2019

Code is in

$joomlaUpdateModel = $this->bootComponent('com_joomlaupdate')->getMVCFactory()->createModel('Update', 'Administrator', ['ignore_request' => true]);
$joomlaUpdateModel->refreshUpdates(true);
$joomlaUpdate = $joomlaUpdateModel->getUpdateInformation();
$hasUpdate = $joomlaUpdate['hasUpdate'] ? $joomlaUpdate['latest'] : '';

And there is another one a few lines later.

@wilsonge you were the last one to touch those lines.

Imho, the whole thing is way to complex and inflexible.
Why do we have to call a model which uses an SystemHeader class to build its content when at the end we serve a static site? All that could be done directly in a layout file, and it would be simple to add the AJAX call to it.
Allowing plugins to add own items could be achieved way simpler than going through a model.

avatar C-Lodder
C-Lodder - comment - 22 Jan 2019

@Bakual I can't replicate a delay at all (WAMP + PHP 7.2)

It loads exactly the same speed for me, the only difference without an internet connection is I get the following in a warning alert:

Update: Could not open update site #1 "Joomla! Core", URL: https://update.joomla.org/core/list.xml
Update: Could not open update site #2 "Accredited Joomla! Translations", URL: https://update.joomla.org/language/translationlist_3.xml
Update: Could not open update site #3 "Joomla! Update Component Update Site", URL: https://update.joomla.org/core/extensions/com_joomlaupdate.xml

avatar Bakual
Bakual - comment - 22 Jan 2019

Maybe if you only have core, then it's not noticable. I have a few extensions installed and I already notice the delay.
I especially notice it when I'm running it in my corporate network where outgoing traffic has to go through a proxy. There it gives me a fatal error after 30 seconds because the server can't be reached. Making the whole page unavailable. But that's hard to reproduce if you don't have such a setup thus I looked for another way to see it.

Anyway, the fact that on pageload multiple extern sites are requested is wrong. That either has to happen by pressing a button or by using AJAX so the page isn't delayed.

avatar C-Lodder
C-Lodder - comment - 22 Jan 2019

Oh that's a whole nother issue for me. The "System" page is broken if those extensions use an update server #23181

avatar Bakual
Bakual - comment - 22 Jan 2019

No, it's not that issue you referenced.

  • Behind our proxy, after 30 seconds I get that:
    image
  • It works if I change to another network without proxy. But takes 8.6 seconds to load.
  • When I cut internet, I get the notices for the 12 extension update servers it tries to connect to. Page load is 3.24 seconds then.

So maybe just add a few extensions and check the page load. Don't even need to cut internet to see an issue.

Edit: Adjusted testing instructions.

avatar mbabker
mbabker - comment - 22 Jan 2019

Why do we have to call a model which uses an SystemHeader class to build its content when at the end we serve a static site? All that could be done directly in a layout file, and it would be simple to add the AJAX call to it.
Allowing plugins to add own items could be achieved way simpler than going through a model.

The entire concept of using builders (or just OOP APIs in general) and the event system for plugins to hook those builders to add (and potentially remove) items is new to Joomla but is a pretty common practice elsewhere in the PHP ecosystem. The admin menu would've fit this concept beautifully before introducing the user customizable admin menu in 3.7. Instead of a hardcoded list that the only way to customize is through layout overrides, a programatic API is exposed that allows integrators to do more with less hacks.

avatar Bakual Bakual - change - 22 Jan 2019
The description was changed
avatar Bakual Bakual - edited - 22 Jan 2019
avatar Bakual
Bakual - comment - 22 Jan 2019

At the moment it looks like it's just complicating things without gaining anything. But maybe that changes if plugin support is actually added and it is not just a static page.

avatar wilsonge
wilsonge - comment - 22 Jan 2019

Presumably this is no different on the Joomla Update page or regular extension update page? because all of those don't use ajax and are done through the PHP?

avatar mbabker
mbabker - comment - 22 Jan 2019

At the moment it looks like it's just complicating things without gaining anything. But maybe that changes if plugin support is actually added and it is not just a static page.

There is a TODO in that file to add a plugin event. So sooner or later the plugin support will be there. Otherwise, if taken at face value and not being familiar with the concept, you're right in that it just looks more complicated for no gain.

avatar Bakual
Bakual - comment - 22 Jan 2019

Presumably this is no different on the Joomla Update page or regular extension update page? because all of those don't use ajax and are done through the PHP?

  • Joomla Update doesn't seem to do anything on pageload. It loads instantely. The "Check for Updates" button obviously doesn't work for me. When pressed it gives me a Warning after 30 seconds that the site couldn't be opened. This is fine as I still can use the page to update my installation manually.
  • The extension updater page indeed does the same error (which is bad as well and the exception should be catched). But then I don't have to use that page anyway since the whole update thing will not work for me. The whole view itself is pointless for me. I still can use the other views to install a manually downloaded update or install new extensions.
  • In the case of the system panel however, it is a navigation page. If that's broken, I have no way to get to eg the template manager. That's bad.
avatar infograf768
infograf768 - comment - 22 Jan 2019

In Cpanel, 'ajaxurl' is added for the Quickicons
For extensions, it comes from the file
/plugins/quickicon/extensionupdate/extensionupdate.php
where the option is added line 63 and 66

For joomlaupdate it comes from
/plugins/quickicon/joomlaupdate/joomlaupdate.php
where it comes from line 88-95

Then these options are taken care of in the respective js by

if (Joomla.getOptions('js-extensions-update')) {
      var options = Joomla.getOptions('js-joomla-update');

and further down by

Joomla.request({
        url: "".concat(options.ajaxUrl, "&eid=700&cache_timeout=3600"),

for joomlaupdate and similar for extension update.

avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Mar 2019
Status New Discussion
avatar Hackwar
Hackwar - comment - 23 Mar 2019

This has been fixed in the meantime by @bembelimen by moving all these checks to ajax calls, which then again can fail however they want without impacting loading the system menu item.

avatar wilsonge wilsonge - change - 23 Mar 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-03-23 21:58:35
Closed_By wilsonge
avatar wilsonge wilsonge - close - 23 Mar 2019

Add a Comment

Login with GitHub to post a comment