From c33dad62b900d9d4b14b39ceda115de71cb87ff8 Mon Sep 17 00:00:00 2001 From: Boudewijn Schoon Date: Wed, 30 Aug 2023 10:43:18 +0200 Subject: [PATCH] Fix incorrect classname `$type::className()` returns a fully qualified name of the class, therefore, 'Entry' would never match. This bug results in no criteria being set which results in ALL items in the database being part of the selection, making the sitemap extremely big. --- src/services/SitemapService.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/services/SitemapService.php b/src/services/SitemapService.php index a9193cd..2397494 100644 --- a/src/services/SitemapService.php +++ b/src/services/SitemapService.php @@ -556,12 +556,15 @@ private function _getPageCount (Element $type, $id) private function _setCriteriaIdByType ($criteria, Element $type, $id) { switch ($type::className()) { + case 'craft\\elements\\Entry': case 'Entry': $criteria->sectionId = $id; break; + case 'craft\\elements\\Category': case 'Category': $criteria->groupId = $id; break; + case 'craft\\elements\\Product': case 'Product': $criteria->typeId = $id; break;