JoomShaper / helix-ultimate

53 stars 24 forks source link

[2.0.17] Massive amount of duplicate database queries for template_styles #379

Open codeling opened 12 months ago

codeling commented 12 months ago

Steps to reproduce the issue

Use helixultimate template, set site to debug.

Expected result

Limited or no amount of duplicate database queries.

Actual result

The following query is executed 117 times:

SELECT *
FROM `#__template_styles`
WHERE `client_id` = 0 AND `id` = '9'

(client_id and id are probably specific to my setup, but you get the gist)

The query is executed from plugins/system/helixultimate/src/Platform/Helper.php:54

System information (as much as possible)

Joomla 4.4.0. apache 2.4.57 on Ubuntu 23.10.

joomleb commented 5 months ago

@codeling Please, Can you replicate the issue with last Joomla 4.4.5 + Helix Ultimate 2.1.1 ? Which version of PHP are you running?

codeling commented 5 months ago

@joomleb In my current attempt on the starting page of our website I see 112 reports of the duplicate query as shown in my initial report, so yes, I can still replicate this.

Is there anything else I can do to help here? I have little knowledge with how the Joomla templating system works or how helix-ultimate uses it (or whether the duplicate queries are even a real problem - it just seems so strange to me to do the same query so many times), so I don't really know where I could look for more information. I do have php development experience so with some guidance I might be able to find out more about whether this is something unique to our setup or a more general thing.

joomleb commented 5 months ago

@mi-prakash @ahamed Please, Can you help here at least giving to @codeling (thank you) the right instructions to help all of us ?

HDsports commented 2 months ago

i have exactly the same problem. Is there no solution? 455603011_2161950720843898_4660889128114951317_n

Sieger66 commented 2 months ago

Everyone can test a temporary fix from there:

https://forum.joomla.de/thread/21364-helix-template-1-000-mal-die-gleichen-queries/?postID=158848#post158848

for the file: /plugins/system/helixultimate/src/Platform/Helper.php the changed function is:

public static function getTemplateStyle($id = 0) { static $cache = []; if (isset($cache[$id])) { return $cache[$id]; } $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select(array('*')); $query->from($db->quoteName('#__template_styles')); $query->where($db->quoteName('client_id') . ' = 0'); $query->where($db->quoteName('id') . ' = ' . $db->quote($id)); $db->setQuery($query); $cache[$id] = $db->loadObject(); return $cache[$id]; }

joomleb commented 2 months ago

@Sieger66 Thank you for helping. To avoid mistakes, Please, Can you add here the modded helper.php file to replace ?

@mi-prakash Please, Do you have any news about this fixing ?

joomleb commented 1 week ago

@mi-prakash @ahamed Please, Can you confirm the fixing adding as suggested by @Sieger66 ?

HDsports commented 1 week ago

The fix was made more than two months ago and Joomshaper doesn't even bother to respond. Wow, terrible support :(