? ? Success

User tests: Successful: Unsuccessful:

avatar Denitz
Denitz
16 Oct 2020

Summary of Changes

Minimize the DB queries in MultilangstatusAdminHelper

Testing Instructions

Enable multilang plugin and browser backend.

Actual result BEFORE applying this Pull Request

See that each admin page always has 3 queries:

SELECT `enabled`
FROM `jos_extensions`
WHERE `type` = 'module' AND `element` = 'mod_multilangstatus'
\administrator\modules\mod_multilangstatus\src\Helper\MultilangstatusAdminHelper.php:46

SELECT `published`
FROM `jos_modules`
WHERE `module` = 'mod_multilangstatus'
\administrator\modules\mod_multilangstatus\src\Helper\MultilangstatusAdminHelper.php:76

UPDATE `jos_modules`
SET `published` = 1
WHERE `module` = 'mod_multilangstatus'
\administrator\modules\mod_multilangstatus\src\Helper\MultilangstatusAdminHelper.php:111

Cache is not cleaned after the module state is auto-changed.

Expected result AFTER applying this Pull Request

Only a single first query is left.

Cache is cleaned after the module state is auto-changed.

Documentation Changes Required

No.

e014072 16 Oct 2020 avatar Denitz fix
avatar Denitz Denitz - open - 16 Oct 2020
avatar Denitz Denitz - change - 16 Oct 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 16 Oct 2020
Category Modules Administration Libraries
avatar ceford
ceford - comment - 17 Oct 2020

For me there are always two queries left after applying the patch. The one left out is the Update query which I guess should only be called if the published state is changed. Typo: in instructions I think browser should be browse - it made me wonder if there was a browser plugin. My mod_multilangstatus is unpublished.


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

avatar Denitz
Denitz - comment - 17 Oct 2020

@ceford I re-tested the patch and definitely see that only single first query is left:

SELECT `enabled`
FROM `jos_extensions`
WHERE `type` = 'module' AND `element` = 'mod_multilangstatus'

If "System - Language Filter" plugin is disabled, we have two queries one time (select enabled + updated published to 1) and next only single query again on the further page loads.

avatar ceford ceford - test_item - 17 Oct 2020 - Tested successfully
avatar ceford
ceford - comment - 17 Oct 2020

I have tested this item successfully on e014072

I can now confirm that the System Language Filter plugin needs to be enable and then on the second and subsequent page loads there is only one query.


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

avatar chmst chmst - test_item - 17 Oct 2020 - Tested successfully
avatar chmst
chmst - comment - 17 Oct 2020

I have tested this item successfully on e014072


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

avatar richard67 richard67 - change - 17 Oct 2020
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 17 Oct 2020

RTC


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

avatar richard67 richard67 - change - 17 Oct 2020
Labels Added: ? ?
avatar richard67 richard67 - change - 17 Oct 2020
Status Ready to Commit Pending
avatar richard67
richard67 - comment - 17 Oct 2020

Back to pending


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

avatar richard67
richard67 - comment - 17 Oct 2020

There are review comments. Unfortunately they are not visible in the issue tracker, only on GitHub, so I add this comment here to enable issue tracker readers at least to see what's the reason why the PR doesn't have RTC.

avatar Denitz Denitz - change - 18 Oct 2020
Labels Added: ?
Removed: ?
avatar HLeithner
HLeithner - comment - 18 Oct 2020

I looked at the reason why this code is called and it's completely wrong in my opinion.

mod_user calls this on every page load only to magically activate/deactivate this module based on the languagefilter plugin...

I would suggest so remove this functionality:
https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/modules/mod_user/mod_user.php#L22-L33

And this magical helper too.

If someone thinks it's really needed to display this module for multilingual sites (which I don't think it's needed) @bembelimen suggest to always activate the module and return "" if the multilingual functionality is disabled.

avatar Denitz
Denitz - comment - 19 Oct 2020

@HLeithner I totally agree that it's better to remove this code completely. Who can make the final decision?

avatar HLeithner
HLeithner - comment - 19 Oct 2020

in this case @wilsonge but I'm pretty sure @infograf768 want to look at this

avatar infograf768
infograf768 - comment - 19 Oct 2020

If anyone cares about my comment, displaying the multilangstatus module when languagefilter is on is a really nice new feature in J4. I don't know how many ms are concerned but if we could keep it, it would be good for our users.

I don't really understand why that code is in mod_user (could not get the history in github as the file name was changed) instead of the languagefilter plugin itself, therefore being used only when the plugin is enabled/disabled.

avatar richard67
richard67 - comment - 19 Oct 2020

I don't really understand why that code is in mod_user (could not get the history in github as the file name was changed)

I think it was mod_status before.

avatar infograf768
infograf768 - comment - 19 Oct 2020
avatar HLeithner
HLeithner - comment - 19 Oct 2020

Ok I would like to suggest the following solution and I hope @Denitz can implement it.

  • Remove the MultilangstatusAdminHelper (if it's only function is to activate the module).
  • Remove the related code from mod_user
  • Activate the mod_multilangstatus per default on new installations
  • Check in mod_multilangstatus if multilanguage is active and if not return without any output.
avatar infograf768
infograf768 - comment - 19 Oct 2020

Check in mod_multilangstatus if multilanguage is active and if not return without any output.

We check that already in the module code...

Screen Shot 2020-10-19 at 12 01 17

avatar richard67
richard67 - comment - 19 Oct 2020
* Activate the `mod_multilangstatus` per default on new installations

That's to be done here

https://github.com/joomla/joomla-cms/blob/4.0-dev/installation/sql/mysql/base.sql#L585

and here

https://github.com/joomla/joomla-cms/blob/4.0-dev/installation/sql/postgresql/base.sql#L610

by changing NULL, NULL, 0 to NULL, NULL, 1.

avatar HLeithner
HLeithner - comment - 19 Oct 2020

Check in mod_multilangstatus if multilanguage is active and if not return without any output.

We check that already in the module code...

Screen Shot 2020-10-19 at 12 01 17

Yes I know but most of the joomla sites are not multilingual and always showing the icon in the upper right corner makes no sense to me. I personally wouldn't activate it by default, but only showing the content if multi language is active is a compromise (even if I have to disable the module anyway because I don't use the standard joomla multi language system as it is intended)

avatar Denitz Denitz - change - 2 Nov 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 2 Nov 2020
Category Modules Administration Libraries Modules Administration SQL Installation Postgresql Libraries
avatar Denitz
Denitz - comment - 2 Nov 2020

Remove the MultilangstatusAdminHelper (if it's only function is to activate the module).
Remove the related code from mod_user
Activate the mod_multilangstatus per default on new installations
Check in mod_multilangstatus if multilanguage is active and if not return without any output.

@HLeithner Done.

af48d08 2 Nov 2020 avatar Denitz CS
avatar alikon
alikon - comment - 2 Nov 2020

please add the update .sql too

avatar richard67
richard67 - comment - 2 Nov 2020

please add the update .sql too

@alikon As far as I could see, @HLeithner has requested that only for new installations, not for updates, so it should not need any update sql script. @HLeithner Correct me if I'm wrong.

avatar HLeithner
HLeithner - comment - 2 Nov 2020

richard is right, I think for websites that already exists have it already activated or are not multilingual. ymmv

avatar HLeithner
HLeithner - comment - 7 Nov 2020

@Denitz I'm sorry I missed the exact same PR by @SharkyKZ #30113 I'm closing this one and merge the other one, thanks for your engagement.

avatar HLeithner HLeithner - change - 7 Nov 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-11-07 12:29:31
Closed_By HLeithner
Labels Added: ?
Removed: ?
avatar HLeithner HLeithner - close - 7 Nov 2020

Add a Comment

Login with GitHub to post a comment