Skip to content

Commit e3885c4

Browse files
authored
1.1.31 Release (#120)
* 1.1.31 Release * 1.1.31 Release - Updated constraints for MDVA-39305-V2, ACSD-51036 * 1.1.31 Release - Updated constraints for ACSD-50345 * 1.1.31 Release - Updated constraints for ACSD-50858 * 1.1.31 Release - Added metadata for ACSD-50817
1 parent 763cd71 commit e3885c4

16 files changed

+2518
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/quality-patches",
33
"description": "Provides quality patches for AdobeCommerce & Magento OpenSource",
44
"type": "magento2-component",
5-
"version": "1.1.30",
5+
"version": "1.1.31",
66
"license": "proprietary",
77
"repositories": {
88
"repo": {

patches-info.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
diff --git a/vendor/magento/module-elasticsearch-catalog-permissions/Model/ResourceModel/Index.php b/vendor/magento/module-elasticsearch-catalog-permissions/Model/ResourceModel/Index.php
2+
index 6e22f93261b..7375da27443 100644
3+
--- a/vendor/magento/module-elasticsearch-catalog-permissions/Model/ResourceModel/Index.php
4+
+++ b/vendor/magento/module-elasticsearch-catalog-permissions/Model/ResourceModel/Index.php
5+
@@ -5,8 +5,12 @@
6+
*/
7+
namespace Magento\ElasticsearchCatalogPermissions\Model\ResourceModel;
8+
9+
+use Magento\CatalogPermissions\App\ConfigInterface as PermissionsConfig;
10+
+use Magento\CatalogPermissions\Model\Permission as PermissionModel;
11+
+use Magento\Customer\Model\ResourceModel\Group\CollectionFactory as CustomerGroupCollectionFactory;
12+
+
13+
/**
14+
- * Class Index
15+
+ * Permissions index data provider.
16+
*/
17+
class Index
18+
{
19+
@@ -15,13 +19,29 @@ class Index
20+
*/
21+
private $categoryPermissionsIndex;
22+
23+
+ /**
24+
+ * @var PermissionsConfig
25+
+ */
26+
+ private $permissionsConfig;
27+
+
28+
+ /**
29+
+ * @var CustomerGroupCollectionFactory
30+
+ */
31+
+ private $customerGroupCollectionFactory;
32+
+
33+
/**
34+
* @param \Magento\CatalogPermissions\Model\ResourceModel\Permission\Index $categoryPermissionsIndex
35+
+ * @param PermissionsConfig $permissionsConfig
36+
+ * @param CustomerGroupCollectionFactory $customerGroupCollectionFactory
37+
*/
38+
public function __construct(
39+
- \Magento\CatalogPermissions\Model\ResourceModel\Permission\Index $categoryPermissionsIndex
40+
+ \Magento\CatalogPermissions\Model\ResourceModel\Permission\Index $categoryPermissionsIndex,
41+
+ PermissionsConfig $permissionsConfig,
42+
+ CustomerGroupCollectionFactory $customerGroupCollectionFactory
43+
) {
44+
$this->categoryPermissionsIndex = $categoryPermissionsIndex;
45+
+ $this->permissionsConfig = $permissionsConfig;
46+
+ $this->customerGroupCollectionFactory = $customerGroupCollectionFactory;
47+
}
48+
49+
/**
50+
@@ -33,11 +53,30 @@ class Index
51+
*/
52+
public function getProductPermissionsIndexData(array $productIds, int $storeId)
53+
{
54+
- $data = $this->categoryPermissionsIndex->getIndexForProduct($productIds, null, $storeId);
55+
-
56+
$result = [];
57+
+ if (!$this->permissionsConfig->isEnabled($storeId)) {
58+
+ return $result;
59+
+ }
60+
+
61+
+ $data = $this->categoryPermissionsIndex->getIndexForProduct($productIds, null, $storeId);
62+
foreach ($data as $row) {
63+
- $result[$row['product_id']][$row['customer_group_id']] = $row['grant_catalog_category_view'];
64+
+ $result[$row['product_id']][$row['customer_group_id']] = (int) $row['grant_catalog_category_view'];
65+
+ }
66+
+
67+
+ $categoryViewMode = (int) $this->permissionsConfig->getCatalogCategoryViewMode($storeId);
68+
+ if (PermissionsConfig::GRANT_ALL === $categoryViewMode) {
69+
+ return $result;
70+
+ }
71+
+
72+
+ $customerGroupCollection = $this->customerGroupCollectionFactory->create();
73+
+ $customerGroupIds = $customerGroupCollection->getAllIds();
74+
+ if (PermissionsConfig::GRANT_CUSTOMER_GROUP === $categoryViewMode) {
75+
+ $allowViewGroups = $this->permissionsConfig->getCatalogCategoryViewGroups($storeId);
76+
+ $customerGroupIds = array_diff($customerGroupIds, $allowViewGroups);
77+
+ }
78+
+ $permissions = array_fill_keys($customerGroupIds, PermissionModel::PERMISSION_DENY);
79+
+ foreach ($productIds as $productId) {
80+
+ $result[$productId] = ($result[$productId] ?? []) + $permissions;
81+
}
82+
83+
return $result;
84+
diff --git a/vendor/magento/module-elasticsearch-catalog-permissions/etc/di.xml b/vendor/magento/module-elasticsearch-catalog-permissions/etc/di.xml
85+
index f3218567bad..e616ceb406f 100644
86+
--- a/vendor/magento/module-elasticsearch-catalog-permissions/etc/di.xml
87+
+++ b/vendor/magento/module-elasticsearch-catalog-permissions/etc/di.xml
88+
@@ -75,4 +75,9 @@
89+
<type name="Magento\CatalogSearch\Model\ResourceModel\Advanced\Collection">
90+
<plugin name="add_catalog_permissions_information" type="Magento\ElasticsearchCatalogPermissions\Plugin\AddCategoryPermissionsToCollection" />
91+
</type>
92+
+ <type name="Magento\ElasticsearchCatalogPermissions\Model\ResourceModel\Index">
93+
+ <arguments>
94+
+ <argument name="permissionsConfig" xsi:type="object">Magento\CatalogPermissions\App\Config</argument>
95+
+ </arguments>
96+
+ </type>
97+
</config>
Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
diff --git a/vendor/magento/module-banner/Model/Banner/Data.php b/vendor/magento/module-banner/Model/Banner/Data.php
2+
index 271fb8d5bef..c8e874fb6eb 100644
3+
--- a/vendor/magento/module-banner/Model/Banner/Data.php
4+
+++ b/vendor/magento/module-banner/Model/Banner/Data.php
5+
@@ -6,9 +6,18 @@
6+
7+
namespace Magento\Banner\Model\Banner;
8+
9+
-use Magento\Customer\CustomerData\SectionSourceInterface;
10+
use Magento\Banner\Model\Config;
11+
+use Magento\Banner\Model\ResourceModel\Banner;
12+
+use Magento\Banner\Model\ResourceModel\BannersByStore;
13+
+use Magento\CatalogRule\Model\ResourceModel\Rule;
14+
+use Magento\Checkout\Model\Session;
15+
+use Magento\Cms\Model\Template\FilterProvider;
16+
+use Magento\Customer\CustomerData\SectionSourceInterface;
17+
+use Magento\Framework\App\Http\Context;
18+
+use Magento\Framework\App\ObjectManager;
19+
+use Magento\Framework\Exception\NoSuchEntityException;
20+
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
21+
+use Magento\Store\Model\StoreManagerInterface;
22+
23+
/**
24+
* Banner section.
25+
@@ -37,8 +46,6 @@ class Data implements SectionSourceInterface
26+
protected $banner;
27+
28+
/**
29+
- * Store manager
30+
- *
31+
* @var \Magento\Store\Model\StoreManagerInterface
32+
*/
33+
protected $storeManager;
34+
@@ -89,15 +96,23 @@ class Data implements SectionSourceInterface
35+
private $data;
36+
37+
/**
38+
- * @param \Magento\Checkout\Model\Session $checkoutSession
39+
- * @param \Magento\Banner\Model\ResourceModel\Banner $bannerResource
40+
+ * @var BannersByStore
41+
+ */
42+
+ private BannersByStore $bannersByStore;
43+
+
44+
+ /**
45+
+ * @param Session $checkoutSession
46+
+ * @param Banner $bannerResource
47+
* @param \Magento\Banner\Model\Banner $banner
48+
- * @param \Magento\Store\Model\StoreManagerInterface $storeManager
49+
- * @param \Magento\Framework\App\Http\Context $httpContext
50+
- * @param \Magento\Cms\Model\Template\FilterProvider $filterProvider
51+
- * @param \Magento\CatalogRule\Model\ResourceModel\Rule $catalogRule
52+
+ * @param StoreManagerInterface $storeManager
53+
+ * @param Context $httpContext
54+
+ * @param FilterProvider $filterProvider
55+
+ * @param Rule $catalogRule
56+
* @param TimezoneInterface $dateTime
57+
* @param array $data
58+
+ * @param BannersByStore|null $bannersByStore
59+
+ * @throws NoSuchEntityException
60+
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
61+
*/
62+
public function __construct(
63+
\Magento\Checkout\Model\Session $checkoutSession,
64+
@@ -108,7 +123,8 @@ class Data implements SectionSourceInterface
65+
\Magento\Cms\Model\Template\FilterProvider $filterProvider,
66+
\Magento\CatalogRule\Model\ResourceModel\Rule $catalogRule,
67+
TimezoneInterface $dateTime,
68+
- array $data = []
69+
+ array $data = [],
70+
+ BannersByStore $bannersByStore = null
71+
) {
72+
$this->checkoutSession = $checkoutSession;
73+
$this->bannerResource = $bannerResource;
74+
@@ -120,6 +136,7 @@ class Data implements SectionSourceInterface
75+
$this->catalogRule = $catalogRule;
76+
$this->dateTime = $dateTime;
77+
$this->data = $data;
78+
+ $this->bannersByStore = $bannersByStore ?? ObjectManager::getInstance()->get(BannersByStore::class);
79+
}
80+
81+
/**
82+
@@ -296,7 +313,7 @@ class Data implements SectionSourceInterface
83+
$productId
84+
);
85+
86+
- $ruleIds = count($result) ? array_column($result, 'rule_id'): [];
87+
+ $ruleIds = count($result) ? array_column($result, 'rule_id') : [];
88+
89+
return $ruleIds ? $this->getCatalogRuleRelatedBannerIds($ruleIds) : [];
90+
}
91+
@@ -311,21 +328,20 @@ class Data implements SectionSourceInterface
92+
protected function getBannersData($bannersIds)
93+
{
94+
$banners = [];
95+
- foreach ($bannersIds as $bannerId) {
96+
- if (!isset($this->banners[$bannerId])) {
97+
- $content = $this->bannerResource->getStoreContent($bannerId, $this->storeId);
98+
- if (!empty($content)) {
99+
- $this->banners[$bannerId] = [
100+
- 'content' => $this->filterProvider->getPageFilter()->filter($content),
101+
- 'types' => $this->banner->load($bannerId)->getTypes(),
102+
- 'id' => $bannerId,
103+
- ];
104+
- } else {
105+
- $this->banners[$bannerId] = null;
106+
- }
107+
+
108+
+ $notLoadedBannersIds = array_diff($bannersIds, array_keys($this->banners));
109+
+ $loadedBannerIds = array_intersect($bannersIds, array_keys($this->banners));
110+
+ if (count($notLoadedBannersIds)) {
111+
+ [$banners, $emptyContentBanners] = $this->bannersByStore->execute($notLoadedBannersIds, $this->storeId);
112+
+ $this->banners += $emptyContentBanners;
113+
+ $this->banners += $banners;
114+
+ }
115+
+ if (count($loadedBannerIds)) {
116+
+ foreach ($loadedBannerIds as $loadedBannerId) {
117+
+ $banners[$loadedBannerId] = $this->banners[$loadedBannerId];
118+
}
119+
- $banners[$bannerId] = $this->banners[$bannerId];
120+
}
121+
+
122+
return array_filter($banners);
123+
}
124+
}
125+
diff --git a/vendor/magento/module-banner/Model/ResourceModel/BannersByStore.php b/vendor/magento/module-banner/Model/ResourceModel/BannersByStore.php
126+
new file mode 100644
127+
index 00000000000..4f0bef656bb
128+
--- /dev/null
129+
+++ b/vendor/magento/module-banner/Model/ResourceModel/BannersByStore.php
130+
@@ -0,0 +1,152 @@
131+
+<?php
132+
+/**
133+
+ * Copyright © Magento, Inc. All rights reserved.
134+
+ * See COPYING.txt for license details.
135+
+ */
136+
+declare(strict_types=1);
137+
+
138+
+namespace Magento\Banner\Model\ResourceModel;
139+
+
140+
+use Magento\Banner\Model\Config;
141+
+use Magento\Cms\Model\Template\FilterProvider;
142+
+use Magento\Framework\App\ResourceConnection;
143+
+use Magento\Framework\DB\Adapter\AdapterInterface;
144+
+use Magento\Framework\DB\Select;
145+
+use Magento\Framework\Event\ManagerInterface;
146+
+use Zend_Db_Select_Exception;
147+
+
148+
+/**
149+
+ * Class returns banners content based on provided store and banner ids
150+
+ */
151+
+class BannersByStore
152+
+{
153+
+ /**
154+
+ * @var AdapterInterface
155+
+ */
156+
+ private AdapterInterface $connection;
157+
+
158+
+ /**
159+
+ * @var FilterProvider
160+
+ */
161+
+ private FilterProvider $filterProvider;
162+
+
163+
+ /**
164+
+ * @var ManagerInterface
165+
+ */
166+
+ private ManagerInterface $eventManager;
167+
+
168+
+ /**
169+
+ * @param ResourceConnection $resource
170+
+ * @param FilterProvider $filterProvider
171+
+ * @param ManagerInterface $eventManager
172+
+ */
173+
+ public function __construct(
174+
+ ResourceConnection $resource,
175+
+ FilterProvider $filterProvider,
176+
+ ManagerInterface $eventManager
177+
+ ) {
178+
+ $this->connection = $resource->getConnection();
179+
+ $this->filterProvider = $filterProvider;
180+
+ $this->eventManager = $eventManager;
181+
+ }
182+
+
183+
+ /**
184+
+ * Return types as array
185+
+ *
186+
+ * @param string|array|null $types
187+
+ * @return array
188+
+ */
189+
+ private function getTypes(string|array|null $types): array
190+
+ {
191+
+ if (is_array($types)) {
192+
+ return $types;
193+
+ }
194+
+
195+
+ return empty($types) ? [] : explode(',', $types);
196+
+ }
197+
+
198+
+ /**
199+
+ * Get select for banner content by store
200+
+ *
201+
+ * @param array $bannerIds
202+
+ * @param int $storeId
203+
+ * @return Select
204+
+ */
205+
+ private function getSelect(array $bannerIds, int $storeId): Select
206+
+ {
207+
+ $select = $this->connection->select()->from(
208+
+ ['main_table' => $this->connection->getTableName('magento_banner_content')],
209+
+ ['banner_id as id', 'main_table.banner_content as content']
210+
+ )->where(
211+
+ 'main_table.banner_id IN (?)',
212+
+ $bannerIds,
213+
+ \Zend_Db::INT_TYPE
214+
+ )->where(
215+
+ 'main_table.store_id = ' . $storeId
216+
+ );
217+
+ $select->joinInner(
218+
+ ['banner' => $this->connection->getTableName('magento_banner')],
219+
+ 'main_table.banner_id = ' . 'banner.banner_id',
220+
+ ['types']
221+
+ );
222+
+
223+
+ $this->eventManager->dispatch(
224+
+ 'magento_banner_resource_banner_content_select_init',
225+
+ ['select' => $select, 'banner_id' => $bannerIds]
226+
+ );
227+
+
228+
+ return $select;
229+
+ }
230+
+
231+
+ /**
232+
+ * Get banners contents by specific store id
233+
+ *
234+
+ * @param array $bannerIds
235+
+ * @param int $storeId
236+
+ * @return array
237+
+ * @throws Zend_Db_Select_Exception
238+
+ */
239+
+ private function getBannerContentsByStore(array $bannerIds, int $storeId): array
240+
+ {
241+
+ $defaultStoreSelect = $this->getSelect($bannerIds, 0);
242+
+ $storeSelect = $this->getSelect($bannerIds, $storeId);
243+
+ $select = $this->connection->select()->union([$defaultStoreSelect, $storeSelect]);
244+
+ return $this->connection->fetchAll($select);
245+
+ }
246+
+
247+
+ /**
248+
+ * Return formatted content and types
249+
+ *
250+
+ * @param array $banners
251+
+ * @return array
252+
+ * @throws \Exception
253+
+ */
254+
+ private function getBannersFormattedContent(array $banners): array
255+
+ {
256+
+ $formattedBanners = $emptyContentBanners = [];
257+
+ foreach ($banners as $banner) {
258+
+ $banner['types'] = $this->getTypes($banner['types']);
259+
+ if (!empty($banner['content'])) {
260+
+ $banner['content'] = $this->filterProvider->getPageFilter()->filter($banner['content']);
261+
+ } else {
262+
+ $emptyContentBanners[$banner['id']] = null;
263+
+ }
264+
+ $formattedBanners[$banner['id']] = $banner;
265+
+ }
266+
+ return [$formattedBanners, $emptyContentBanners];
267+
+ }
268+
+
269+
+ /**
270+
+ * Get banners by store
271+
+ *
272+
+ * @param array $bannerIds
273+
+ * @param int $storeId
274+
+ * @return array
275+
+ * @throws \Exception
276+
+ */
277+
+ public function execute(array $bannerIds, int $storeId): array
278+
+ {
279+
+ $banners = $this->getBannerContentsByStore($bannerIds, $storeId);
280+
+ return $this->getBannersFormattedContent($banners);
281+
+ }
282+
+}

0 commit comments

Comments
 (0)