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.
Loads instantely
Page loads delayed.
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).
Labels |
Added:
?
|
Code is in
joomla-cms/administrator/components/com_cpanel/Model/SystemModel.php
Lines 203 to 206 in d0c00c5
@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.
@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
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.
No, it's not that issue you referenced.
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.
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.
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.
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?
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.
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?
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.
Status | New | ⇒ | Discussion |
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.
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-03-23 21:58:35 |
Closed_By | ⇒ | wilsonge |
I do agree, but I did not know how to do that and still don't. :)