Skip to content

[6.1] Improve Multilanguage::getSiteHomePages()#41507

Merged
HLeithner merged 14 commits intojoomla:6.1-devfrom
Denitz:patch-8
Mar 2, 2026
Merged

[6.1] Improve Multilanguage::getSiteHomePages()#41507
HLeithner merged 14 commits intojoomla:6.1-devfrom
Denitz:patch-8

Conversation

@Denitz
Copy link
Contributor

@Denitz Denitz commented Aug 29, 2023

Summary of Changes

Joomla\CMS\Language\Multilanguage::getSiteHomePages() uses an extra database query per each page load to discover the language-specific site homepages.

We can easily eliminate this extra database query and use the native SiteMenu::getItems().

Testing Instructions

Test a website with enabled multilanguage functionality and Joomla system caching enabled.

Actual result BEFORE applying this Pull Request

See an extra unoptimized SQL query per each page load:

SELECT `language`,`id` FROM `jos_menu` WHERE `home` = '1' AND `published` = 1 AND `client_id` = 0

Expected result AFTER applying this Pull Request

No extra SQL query, the homepages are discovered from the cached menu items.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@Denitz Denitz changed the base branch from 4.3-dev to 5.0-dev September 22, 2023 06:47
@Denitz Denitz changed the title Improve Multilanguage::getSiteHomePages() [5.0] Improve Multilanguage::getSiteHomePages() Sep 22, 2023
@HLeithner HLeithner changed the base branch from 5.0-dev to 5.1-dev September 30, 2023 22:49
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 5.1-dev.

@Denitz Denitz changed the title [5.0] Improve Multilanguage::getSiteHomePages() [5.1] Improve Multilanguage::getSiteHomePages() Oct 3, 2023
@crommie
Copy link

crommie commented Feb 24, 2024

I have tested this item ✅ successfully on 9ea35c7

Extra query has gone.


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

@viocassel
Copy link
Contributor

I have tested this item ✅ successfully on 9ea35c7


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

@Fedik
Copy link
Member

Fedik commented Aug 23, 2025

I have tested this item ✅ successfully on b22dc09


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

@Fedik
Copy link
Member

Fedik commented Aug 23, 2025

I set it RTC, it seems was removed by accident and lost in time.


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 23, 2025
@brianteeman
Copy link
Contributor

Is this still relevant as the code for multilingual home pages has changed since this PR was first created

@Fedik
Copy link
Member

Fedik commented Aug 23, 2025

Yes, method getSiteHomePages still there, and still in use.

@HLeithner HLeithner changed the base branch from 6.0-dev to 6.1-dev August 31, 2025 11:59
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 6.1-dev.

@HLeithner HLeithner changed the title [6.0] Improve Multilanguage::getSiteHomePages() [6.1] Improve Multilanguage::getSiteHomePages() Aug 31, 2025
@HLeithner HLeithner merged commit e9c172d into joomla:6.1-dev Mar 2, 2026
42 checks passed
@HLeithner
Copy link
Member

Thanks, I skipped the deprecation for now, since it's not so important and we need to remove the usages first.

@Fedik
Copy link
Member

Fedik commented Mar 5, 2026

@Denitz I think we can be need to revert it, because ConsoleApplication does not have getMenu().
Can you please have a look?

Or maybe some extra check for instance of ConsoleApplication

@Denitz
Copy link
Contributor Author

Denitz commented Mar 5, 2026

@Fedik Good catch, here we go: #47310

I returned original code for non-CMSWebApplicationInterface instances because getMenu() is defined in this interface.

@HLeithner
Copy link
Member

Actually @joomdonation found this issue.
As I wrote in your PR we will revert this and only keep the new code in the menu and deprecate the getSiteHomePages() and remove it in joomla 8.0. and rewrite all usages to the $menu->getHomepages() method.

Can you do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Abandoned

Development

Successfully merging this pull request may close these issues.