Skip to content

Commit

Permalink
Merge pull request #142 from magento-commerce/1.1.38-release
Browse files Browse the repository at this point in the history
1.1.38 Release
  • Loading branch information
apoltoratskyi authored Sep 14, 2023
2 parents ef04514 + d640da0 commit f1f193f
Show file tree
Hide file tree
Showing 14 changed files with 2,234 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/quality-patches",
"description": "Provides quality patches for AdobeCommerce & Magento OpenSource",
"type": "magento2-component",
"version": "1.1.37",
"version": "1.1.38",
"license": "proprietary",
"repositories": {
"repo": {
Expand Down
2 changes: 1 addition & 1 deletion patches-info.json

Large diffs are not rendered by default.

94 changes: 94 additions & 0 deletions patches/commerce/ACSD-52287_2.4.5-p2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
diff --git a/vendor/magento/module-sales-archive/Observer/ArchiveGridAsyncUpdateObserver.php b/vendor/magento/module-sales-archive/Observer/ArchiveGridAsyncUpdateObserver.php
new file mode 100644
index 000000000000..a577f245e032
--- /dev/null
+++ b/vendor/magento/module-sales-archive/Observer/ArchiveGridAsyncUpdateObserver.php
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+declare(strict_types=1);
+
+namespace Magento\SalesArchive\Observer;
+
+use Magento\Framework\Event\Observer as EventObserver;
+use Magento\Framework\Event\ObserverInterface;
+
+class ArchiveGridAsyncUpdateObserver implements ObserverInterface
+{
+
+ /**
+ * Archival entity names
+ */
+ private const STATUS = 'status';
+
+ /**
+ * @var \Magento\SalesArchive\Model\Config
+ */
+ private $config;
+
+ /**
+ * @var \Magento\SalesArchive\Model\ResourceModel\Archive
+ */
+ private $archive;
+
+ /**
+ * Global configuration storage.
+ *
+ * @var \Magento\Framework\App\Config\ScopeConfigInterface
+ */
+ private $globalConfig;
+
+ /**
+ * ArchiveGridAsyncUpdateObserver constructor.
+ * @param \Magento\SalesArchive\Model\Config $config
+ * @param \Magento\SalesArchive\Model\ResourceModel\Archive $archive
+ * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
+ */
+ public function __construct(
+ \Magento\SalesArchive\Model\Config $config,
+ \Magento\SalesArchive\Model\ResourceModel\Archive $archive,
+ \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
+ ) {
+ $this->config = $config;
+ $this->archive = $archive;
+ $this->globalConfig = $globalConfig;
+ }
+
+ /**
+ * Handles asynchronous update of the updated entity
+ *
+ * @param EventObserver $observer
+ * @return void
+ */
+ public function execute(EventObserver $observer)
+ {
+ if (!$this->config->isArchiveActive()) {
+ return $this;
+ }
+ $creditmemo = $observer->getEvent()->getCreditmemo();
+ $order = $creditmemo->getOrder();
+ if ($order->getId() && $this->globalConfig->isSetFlag('dev/grid/async_indexing')) {
+ $connection = $this->archive->getConnection();
+ $connection->update(
+ $this->archive->getArchiveEntityTable('order'),
+ [self::STATUS => $order->getStatus()],
+ $connection->quoteInto($order->getIdFieldName() . '= ?', $order->getId())
+ );
+ }
+ }
+}
diff --git a/vendor/magento/module-sales-archive/etc/adminhtml/events.xml b/vendor/magento/module-sales-archive/etc/adminhtml/events.xml
index b9d3cdf35285..8cdbe7231832 100644
--- a/vendor/magento/module-sales-archive/etc/adminhtml/events.xml
+++ b/vendor/magento/module-sales-archive/etc/adminhtml/events.xml
@@ -21,4 +21,7 @@
<event name="sales_order_grid_collection_load_before">
<observer name="magento_salesarchive" instance="Magento\SalesArchive\Observer\SalesObjectAfterLoadObserver" />
</event>
+ <event name="sales_order_creditmemo_save_after">
+ <observer name="magento_salesarchive" instance="Magento\SalesArchive\Observer\ArchiveGridAsyncUpdateObserver" />
+ </event>
</config>
44 changes: 44 additions & 0 deletions patches/commerce/ACSD-53098_1.3.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/vendor/magento/module-shared-catalog/Model/ProductManagement.php b/vendor/magento/module-shared-catalog/Model/ProductManagement.php
index 24bf11605b..1cd10eb66c 100644
--- a/vendor/magento/module-shared-catalog/Model/ProductManagement.php
+++ b/vendor/magento/module-shared-catalog/Model/ProductManagement.php
@@ -142,7 +142,6 @@ class ProductManagement implements ProductManagementInterface
$categoryIds = $this->sharedCatalogCategoryManagement->getCategories($sharedCatalog->getId());
$productsCategoryIds = $this->getProductsCategoryIds($skus);
$assignCategoriesIds = array_diff($productsCategoryIds, $categoryIds);
- $this->catalogPermissionManagement->setAllowPermissions($assignCategoriesIds, $customerGroupIds);

foreach ($customerGroupIds as $customerGroupId) {
$this->sharedCatalogProductItemManagement->addItems($customerGroupId, $skus);
@@ -151,9 +150,12 @@ class ProductManagement implements ProductManagementInterface
foreach ($products as $product) {
if ($product->getId()) {
$ids[] = $product->getId();
+ } elseif ($product->getSku()) {
+ $ids[] = $this->productRepository->get($product->getSku())->getId();
}
}
$this->sharedCatalogInvalidation->reindexCatalogProductPermissions($ids);
+ $this->catalogPermissionManagement->setAllowPermissions($assignCategoriesIds, $customerGroupIds);

return true;
}
diff --git a/vendor/magento/module-shared-catalog/etc/mview.xml b/vendor/magento/module-shared-catalog/etc/mview.xml
index 09afb1e7d8..e1a8e8477b 100644
--- a/vendor/magento/module-shared-catalog/etc/mview.xml
+++ b/vendor/magento/module-shared-catalog/etc/mview.xml
@@ -11,4 +11,14 @@
<table name="sharedcatalog_category_permissions" entity_column="category_id"/>
</subscriptions>
</view>
+ <view id="catalogpermissions_product" class="Magento\CatalogPermissions\Model\Indexer\Product" group="indexer">
+ <subscriptions>
+ <table name="shared_catalog_product_item" subscription_model="Magento\Catalog\Model\Mview\View\Sku\Subscription" entity_column="sku"/>
+ </subscriptions>
+ </view>
+ <view id="catalogsearch_fulltext" class="\Magento\CatalogSearch\Model\Indexer\Mview\Action" group="indexer">
+ <subscriptions>
+ <table name="shared_catalog_product_item" subscription_model="Magento\Catalog\Model\Mview\View\Sku\Subscription" entity_column="sku"/>
+ </subscriptions>
+ </view>
</config>
197 changes: 197 additions & 0 deletions patches/commerce/ACSD-53098_2.4.3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
diff --git a/vendor/magento/module-catalog-permissions/Model/Indexer/Product/Action/GetProductsCategories.php b/vendor/magento/module-catalog-permissions/Model/Indexer/Product/Action/GetProductsCategories.php
new file mode 100644
index 00000000000..daf74bafe61
--- /dev/null
+++ b/vendor/magento/module-catalog-permissions/Model/Indexer/Product/Action/GetProductsCategories.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+declare(strict_types=1);
+
+namespace Magento\CatalogPermissions\Model\Indexer\Product\Action;
+
+use Magento\Catalog\Model\Indexer\Category\Product\TableMaintainer as CategoryProductTableMaintainer;
+use Magento\Framework\App\ResourceConnection;
+use Magento\Store\Model\StoreManagerInterface;
+
+class GetProductsCategories
+{
+ /**
+ * @var ResourceConnection
+ */
+ private $resource;
+
+ /**
+ * @var CategoryProductTableMaintainer
+ */
+ private $categoryProductTableMaintainer;
+
+ /**
+ * @var StoreManagerInterface
+ */
+ private $storeManager;
+
+ /**
+ * @param ResourceConnection $resource
+ * @param CategoryProductTableMaintainer $categoryProductTableMaintainer
+ * @param StoreManagerInterface $storeManager
+ */
+ public function __construct(
+ ResourceConnection $resource,
+ CategoryProductTableMaintainer $categoryProductTableMaintainer,
+ StoreManagerInterface $storeManager
+ ) {
+ $this->resource = $resource;
+ $this->categoryProductTableMaintainer = $categoryProductTableMaintainer;
+ $this->storeManager = $storeManager;
+ }
+
+ /**
+ * Returns list of categories ids for provided products
+ *
+ * @param int[] $productList
+ * @return array
+ */
+ public function execute(
+ array $productList
+ ): array {
+ $connection = $this->resource->getConnection();
+ $categories = [];
+ foreach ($this->storeManager->getStores() as $store) {
+ $select = $connection->select()->from(
+ ['category_product_index' => $this->categoryProductTableMaintainer->getMainTable((int)$store->getId())],
+ ['category_product_index.category_id']
+ );
+ $select->where('category_product_index.product_id IN (?)', $productList, \Zend_Db::INT_TYPE);
+ $select->distinct(true);
+
+ $categories += array_fill_keys($connection->fetchCol($select), true);
+ }
+
+ return array_keys($categories);
+ }
+}
diff --git a/vendor/magento/module-catalog-permissions/Model/Indexer/Product/Action/Rows.php b/vendor/magento/module-catalog-permissions/Model/Indexer/Product/Action/Rows.php
index a08a297570b..7cf01aad9eb 100644
--- a/vendor/magento/module-catalog-permissions/Model/Indexer/Product/Action/Rows.php
+++ b/vendor/magento/module-catalog-permissions/Model/Indexer/Product/Action/Rows.php
@@ -5,7 +5,24 @@
*/
namespace Magento\CatalogPermissions\Model\Indexer\Product\Action;

+use Magento\Catalog\Model\Category;
+use Magento\Catalog\Model\Config as CatalogConfig;
+use Magento\Catalog\Model\Product;
+use Magento\CatalogPermissions\App\ConfigInterface;
use Magento\CatalogPermissions\Model\Indexer\AbstractAction;
+use Magento\CatalogPermissions\Model\Indexer\Category\ModeSwitcher;
+use Magento\CatalogPermissions\Model\Indexer\TableMaintainer;
+use Magento\Customer\Model\ResourceModel\Group\CollectionFactory as GroupCollectionFactory;
+use Magento\Framework\App\CacheInterface;
+use Magento\Framework\App\Config\ScopeConfigInterface;
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\App\ResourceConnection;
+use Magento\Framework\DB\Query\Generator;
+use Magento\Framework\EntityManager\MetadataPool;
+use Magento\Framework\Indexer\CacheContext;
+use Magento\Store\Model\ResourceModel\Website\CollectionFactory as WebsiteCollectionFactory;
+use Magento\CatalogPermissions\Model\Indexer\Product\IndexFiller as ProductIndexFiller;
+use Magento\Store\Model\StoreManagerInterface;

/**
* @api
@@ -20,6 +37,76 @@ class Rows extends AbstractAction
*/
protected $entityIds;

+ /**
+ * @var ScopeConfigInterface
+ */
+ private $scopeConfig;
+
+ /**
+ * @var CacheContext
+ */
+ private $cacheContext;
+
+ /**
+ * @var GetProductsCategories
+ */
+ private $getProductsCategories;
+
+ /**
+ * @param ResourceConnection $resource
+ * @param WebsiteCollectionFactory $websiteCollectionFactory
+ * @param GroupCollectionFactory $groupCollectionFactory
+ * @param ConfigInterface $config
+ * @param StoreManagerInterface $storeManager
+ * @param CatalogConfig $catalogConfig
+ * @param CacheInterface $coreCache
+ * @param MetadataPool $metadataPool
+ * @param Generator|null $batchQueryGenerator
+ * @param ProductSelectDataProvider|null $productSelectDataProvider
+ * @param ProductIndexFiller|null $productIndexFiller
+ * @param TableMaintainer|null $tableMaintainer
+ * @param ScopeConfigInterface|null $scopeConfig
+ * @param CacheContext|null $cacheContext
+ * @param GetProductsCategories|null $getProductsCategories
+ * @throws \Exception
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
+ */
+ public function __construct(
+ ResourceConnection $resource,
+ WebsiteCollectionFactory $websiteCollectionFactory,
+ GroupCollectionFactory $groupCollectionFactory,
+ ConfigInterface $config,
+ StoreManagerInterface $storeManager,
+ CatalogConfig $catalogConfig,
+ CacheInterface $coreCache,
+ \Magento\Framework\EntityManager\MetadataPool $metadataPool,
+ Generator $batchQueryGenerator = null,
+ ProductSelectDataProvider $productSelectDataProvider = null,
+ ProductIndexFiller $productIndexFiller = null,
+ ?CacheContext $cacheContext = null,
+ ?GetProductsCategories $getProductsCategories = null
+ ) {
+ parent::__construct(
+ $resource,
+ $websiteCollectionFactory,
+ $groupCollectionFactory,
+ $config,
+ $storeManager,
+ $catalogConfig,
+ $coreCache,
+ $metadataPool,
+ $batchQueryGenerator,
+ $productSelectDataProvider,
+ $productIndexFiller
+ );
+ $this->scopeConfig = $scopeConfig
+ ??ObjectManager::getInstance()->get(ScopeConfigInterface::class);
+ $this->cacheContext = $cacheContext
+ ?? ObjectManager::getInstance()->get(CacheContext::class);
+ $this->getProductsCategories = $getProductsCategories
+ ?? ObjectManager::getInstance()->get(GetProductsCategories::class);
+ }
+
/**
* Refresh entities index
*
@@ -36,6 +123,14 @@ class Rows extends AbstractAction
$this->removeObsoleteIndexData();

$this->reindex();
+ $this->cacheContext->registerEntities(
+ Product::CACHE_TAG,
+ $entityIds
+ );
+ $this->cacheContext->registerEntities(
+ Category::CACHE_TAG,
+ $this->getProductsCategories->execute($entityIds)
+ );
}
}

Loading

0 comments on commit f1f193f

Please sign in to comment.