From 80751a6b4a45ac9c955b258774af645fde90b801 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sun, 31 Dec 2023 13:45:13 +0100 Subject: [PATCH 1/3] [4.4] Fix SQL error "1104 The SELECT would examine more than MAX_JOIN_SIZE rows" when checking for core updates (#42576) * Use concat of columns for getting core extensions * Fix PHPCS * Remove wrong quotes --- libraries/src/Extension/ExtensionHelper.php | 22 +++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/libraries/src/Extension/ExtensionHelper.php b/libraries/src/Extension/ExtensionHelper.php index 9b236c1a8e798..3917bb01080ad 100644 --- a/libraries/src/Extension/ExtensionHelper.php +++ b/libraries/src/Extension/ExtensionHelper.php @@ -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(); From f97a4c5ea7afa5aebc5861b3307089df58ac5e8f Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sun, 31 Dec 2023 15:07:56 +0100 Subject: [PATCH 2/3] [4][com_templates] cast to int for pgsql (#42569) * cast to int for pgsql * yet-another --------- --- .../components/com_templates/src/Model/TemplateModel.php | 4 ++-- .../components/com_templates/tmpl/template/default.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/administrator/components/com_templates/src/Model/TemplateModel.php b/administrator/components/com_templates/src/Model/TemplateModel.php index bed0fea5b5024..0de09b701e96b 100644 --- a/administrator/components/com_templates/src/Model/TemplateModel.php +++ b/administrator/components/com_templates/src/Model/TemplateModel.php @@ -879,8 +879,8 @@ public function &getSource() $fileName = str_replace('//', '/', $fileName); $isMedia = $input->getInt('isMedia', 0); - $fileName = $isMedia ? Path::clean(JPATH_ROOT . '/media/templates/' . ($this->template->client_id === 0 ? 'site' : 'administrator') . '/' . $this->template->element . $fileName) - : Path::clean(JPATH_ROOT . ($this->template->client_id === 0 ? '' : '/administrator') . '/templates/' . $this->template->element . $fileName); + $fileName = $isMedia ? Path::clean(JPATH_ROOT . '/media/templates/' . ((int) $this->template->client_id === 0 ? 'site' : 'administrator') . '/' . $this->template->element . $fileName) + : Path::clean(JPATH_ROOT . ((int) $this->template->client_id === 0 ? '' : '/administrator') . '/templates/' . $this->template->element . $fileName); try { $filePath = Path::check($fileName); diff --git a/administrator/components/com_templates/tmpl/template/default.php b/administrator/components/com_templates/tmpl/template/default.php index 87a7b11821f75..fec288a5a992c 100644 --- a/administrator/components/com_templates/tmpl/template/default.php +++ b/administrator/components/com_templates/tmpl/template/default.php @@ -60,7 +60,7 @@
type == 'file') : ?> -

get('isMedia', 0) ? '/media/templates/' . ($this->template->client_id === 0 ? 'site' : 'administrator') . '/' . $this->template->element . str_replace('//', '/', base64_decode($this->file)) : '/' . ($this->template->client_id === 0 ? '' : 'administrator/') . 'templates/' . $this->template->element . str_replace('//', '/', base64_decode($this->file))), $this->template->element); ?>

+

get('isMedia', 0) ? '/media/templates/' . ((int) $this->template->client_id === 0 ? 'site' : 'administrator') . '/' . $this->template->element . str_replace('//', '/', base64_decode($this->file)) : '/' . ((int) $this->template->client_id === 0 ? '' : 'administrator/') . 'templates/' . $this->template->element . str_replace('//', '/', base64_decode($this->file))), $this->template->element); ?>

type == 'image') : ?> @@ -88,7 +88,7 @@
  • - template->client_id === 0 ? '/' : '/administrator/') . 'templates/' . $this->template->element; ?> + template->client_id === 0 ? '/' : '/administrator/') . 'templates/' . $this->template->element; ?> loadTemplate('tree'); ?>
  • @@ -98,7 +98,7 @@
  • - template->client_id === 0 ? 'site/' : 'administrator/') . $this->template->element; ?> + template->client_id === 0 ? 'site/' : 'administrator/') . $this->template->element; ?> loadTemplate('tree_media'); ?>
  • From 56bf7849596116568ba00adb4860bc6c68764585 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Tue, 2 Jan 2024 12:49:29 +0100 Subject: [PATCH 3/3] patch article tags (#42486) --- .../com_content/src/Controller/ArticlesController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/components/com_content/src/Controller/ArticlesController.php b/api/components/com_content/src/Controller/ArticlesController.php index 647d0afb6532f..bd906434f06b7 100644 --- a/api/components/com_content/src/Controller/ArticlesController.php +++ b/api/components/com_content/src/Controller/ArticlesController.php @@ -115,9 +115,11 @@ protected function preprocessSaveData(array $data): array } } - $tags = new TagsHelper(); - $tags->getTagIds($data['id'], 'com_content.article'); - $data['tags'] = explode(',', $tags->tags); + if (($this->input->getMethod() === 'PATCH') && !(\array_key_exists('tags', $data))) { + $tags = new TagsHelper(); + $tags->getTagIds($data['id'], 'com_content.article'); + $data['tags'] = explode(',', $tags->tags); + } return $data; }