? ? Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
7 Oct 2017

current staging
enable debug
Administrator->Control panel
see the database queries tab look at duplicates found

Testing Instructions

admin menu works as expected

Expected result

less duplicated query
screenshot from 2017-10-07 08-52-51

Actual result

screenshot from 2017-10-07 08-49-38

avatar joomla-cms-bot joomla-cms-bot - change - 7 Oct 2017
Category Modules Administration
avatar alikon alikon - open - 7 Oct 2017
avatar alikon alikon - change - 7 Oct 2017
Status New Pending
avatar alikon alikon - change - 7 Oct 2017
Title
[backend] too much duplicate queries in menu.php
[mod_menu] too much duplicate queries in menu.php
avatar alikon alikon - edited - 7 Oct 2017
avatar franz-wohlkoenig franz-wohlkoenig - test_item - 7 Oct 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 7 Oct 2017

I have tested this item successfully on eebc59c


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

avatar infograf768
infograf768 - comment - 7 Oct 2017

This code has just been merged as com_fields menus were displaying when fields is disabled in Extensions=>Manage
See:
#18134

avatar infograf768 infograf768 - test_item - 7 Oct 2017 - Tested unsuccessfully
avatar infograf768
infograf768 - comment - 7 Oct 2017

I have tested this item ? unsuccessfully on eebc59c

See #18134


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

avatar alikon
alikon - comment - 7 Oct 2017

@infograf768 anyway not in that way #18134

avatar infograf768
infograf768 - comment - 7 Oct 2017

Suggested a solution there.

			// Exclude item if com_fields component is not installed or disabled
			if ($item->element == 'com_fields' && (!JComponentHelper::isInstalled($item->element) || !JComponentHelper::isEnabled($item->element)))
			{
				continue;
			}
avatar alikon alikon - change - 7 Oct 2017
Labels Added: ?
avatar alikon
alikon - comment - 7 Oct 2017

only for com_fields sound more reasonable

avatar infograf768 infograf768 - test_item - 7 Oct 2017 - Tested successfully
avatar infograf768
infograf768 - comment - 7 Oct 2017

I have tested this item successfully on a074b09

Yep. :)


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

avatar izharaazmi
izharaazmi - comment - 7 Oct 2017

#18134 (comment). Do we really want to show other components link if they are not installed or disabled?

avatar infograf768
infograf768 - comment - 7 Oct 2017

I tested with other components without issues. com_fields is very specific.

avatar infograf768
infograf768 - comment - 7 Oct 2017

tested further.
if ($item->element && !JComponentHelper::isEnabled($item->element))
is not the one adding queries

it is
!JComponentHelper::isInstalled($item->element) which is the culprit.

Basically only a component which does not exist in the _extensions table but still has entries in the _menu table would be concerned.

FYI JComponentHelper::isInstalled is never used in core.

avatar izharaazmi
izharaazmi - comment - 11 Oct 2017

@infograf768 As I can see \Joomla\CMS\Component\ComponentHelper::isInstalled return the count of records matching the component name passed. I wonder whether it is possible that the value is anything other than 0 or 1?

If not then IMHO, we can simply proxy this method to isEnabled and deprecated this for J4.

avatar infograf768
infograf768 - comment - 11 Oct 2017

@izharaazmi @alikon

If not then IMHO, we can simply proxy this method to isEnabled and deprecated this for J4.

I would not do that as it would not be B/C in case a 3rd party is using the method.

But in our case here, I just would not use it at all and change this PR to use only
if ($item->element && !JComponentHelper::isEnabled($item->element))

@mbabker
What do you think?

avatar izharaazmi
izharaazmi - comment - 11 Oct 2017

I just would not use it at all and change this PR to use only ...

Fair enough for me.

avatar infograf768
infograf768 - comment - 11 Oct 2017

@alikon
Can you modify this PR?

avatar alikon
alikon - comment - 11 Oct 2017

if isEnabled() =yes/no i will assume that isInstalled() = true ?

avatar infograf768
infograf768 - comment - 11 Oct 2017

if isEnabled() =yes/no i will assume that isInstalled()

Yep. Can you modify PR?

avatar alikon
alikon - comment - 11 Oct 2017

@infograf768 so no more exception for com_fields ?

avatar infograf768
infograf768 - comment - 11 Oct 2017

no need as you can test

avatar infograf768
infograf768 - comment - 11 Oct 2017

You still need imho to add
if ($item->element

f92c623 11 Oct 2017 avatar alikon ops
avatar alikon
alikon - comment - 11 Oct 2017

please double check cause i'm unable to test it right now ?

avatar infograf768
infograf768 - comment - 11 Oct 2017

Fine now.
screen shot 2017-10-11 at 11 45 13

avatar infograf768 infograf768 - test_item - 11 Oct 2017 - Tested successfully
avatar infograf768
infograf768 - comment - 11 Oct 2017

I have tested this item successfully on f92c623


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

avatar mbabker
mbabker - comment - 11 Oct 2017

As I can see \Joomla\CMS\Component\ComponentHelper::isInstalled return the count of records matching the component name passed. I wonder whether it is possible that the value is anything other than 0 or 1?

The method should only return 0 or 1. If it doesn't, then someone has a corrupt database because you can't install two extensions with the same component name.

avatar izharaazmi
izharaazmi - comment - 11 Oct 2017

@infograf768 @mbabker @alikon Please also see #18308.

PS: This PR is still applicable. My PR does not replace it.

avatar infograf768
infograf768 - comment - 11 Oct 2017

@izharaazmi
Please nevertheless set this one to test OK

avatar izharaazmi izharaazmi - test_item - 11 Oct 2017 - Tested successfully
avatar izharaazmi
izharaazmi - comment - 11 Oct 2017

I have tested this item successfully on f92c623


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

avatar infograf768 infograf768 - change - 11 Oct 2017
Milestone Added:
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 11 Oct 2017

RTC. Thanks.


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

avatar mbabker mbabker - close - 15 Oct 2017
avatar mbabker mbabker - merge - 15 Oct 2017
avatar mbabker mbabker - change - 15 Oct 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-10-15 15:52:16
Closed_By mbabker
Labels Added: ?

Add a Comment

Login with GitHub to post a comment