Skip to content

Commit

Permalink
[4.4] Fix SQL error "1104 The SELECT would examine more than MAX_JOIN…
Browse files Browse the repository at this point in the history
…_SIZE rows" when checking for core updates (joomla#42576)

* Use concat of columns for getting core extensions

* Fix PHPCS

* Remove wrong quotes
  • Loading branch information
richard67 authored Dec 31, 2023
1 parent 83f50fd commit 80751a6
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions libraries/src/Extension/ExtensionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,25 @@ public static function getCoreExtensionIds()
->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'));

$values = [];

foreach (self::$coreExtensions as $extension) {
$values = $query->bindArray($extension, [ParameterType::STRING, ParameterType::STRING, ParameterType::STRING, ParameterType::INTEGER]);
$query->where(
'(' . $db->quoteName('type') . ' = ' . $values[0] . ' AND ' . $db->quoteName('element') . ' = ' . $values[1]
. ' AND ' . $db->quoteName('folder') . ' = ' . $values[2] . ' AND ' . $db->quoteName('client_id') . ' = ' . $values[3] . ')',
'OR'
);
$values[] = $extension[0] . '|' . $extension[1] . '|' . $extension[2] . '|' . $extension[3];
}

$query->whereIn(
$query->concatenate(
[
$db->quoteName('type'),
$db->quoteName('element'),
$db->quoteName('folder'),
$db->quoteName('client_id'),
],
'|'
),
$values
);

$db->setQuery($query);
self::$coreExtensionIds = $db->loadColumn();

Expand Down

0 comments on commit 80751a6

Please sign in to comment.