Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the loading speed of category items #19261

Merged
merged 3 commits into from
Jan 15, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CS fix
  • Loading branch information
Tomasz Narloch committed Jan 2, 2018
commit 63b1a4ab703a7b1048b0631453c8f844e70283f5
12 changes: 8 additions & 4 deletions libraries/src/Categories/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,20 @@ protected function _load($id)
if ($app->isClient('site') && Multilanguage::isEnabled())
{
// For the most part, we use c.lft column, which index is properly used instead of c.rgt
$query->innerJoin($db->quoteName('#__categories', 'c')
$query->innerJoin(
$db->quoteName('#__categories', 'c')
. ' ON (s.lft < c.lft AND c.lft < s.rgt AND c.language IN ('
. $db->quote(Factory::getLanguage()->getTag()) . ',' . $db->quote('*') . '))'
. ' OR (c.lft <= s.lft AND s.rgt <= c.rgt)');
. ' OR (c.lft <= s.lft AND s.rgt <= c.rgt)'
);
}
else
{
$query->innerJoin($db->quoteName('#__categories', 'c')
$query->innerJoin(
$db->quoteName('#__categories', 'c')
. ' ON (s.lft <= c.lft AND c.lft < s.rgt)'
. ' OR (c.lft < s.lft AND s.rgt < c.rgt)');
. ' OR (c.lft < s.lft AND s.rgt < c.rgt)'
);
}
}
else
Expand Down