Skip to content

Commit b0065b9

Browse files
authored
Merge pull request #134 from magento-commerce/1.1.33-release
1.1.33 Release
2 parents fc91210 + 9112dca commit b0065b9

27 files changed

+2944
-3
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.32",
5+
"version": "1.1.33",
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: 292 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
diff --git a/vendor/magento/module-staging/Model/Operation/Update.php b/vendor/magento/module-staging/Model/Operation/Update.php
2+
index 76a8b5bf02f..6747dab6932 100644
3+
--- a/vendor/magento/module-staging/Model/Operation/Update.php
4+
+++ b/vendor/magento/module-staging/Model/Operation/Update.php
5+
@@ -6,22 +6,23 @@
6+
7+
namespace Magento\Staging\Model\Operation;
8+
9+
-use Magento\Framework\EntityManager\EntityMetadataInterface;
10+
-use Magento\Framework\EntityManager\Operation\UpdateInterface;
11+
-use Magento\Framework\EntityManager\MetadataPool;
12+
-use Magento\Staging\Model\Operation\Update\CampaignIntegrity;
13+
-use Magento\Staging\Model\ResourceModel\Db\ReadEntityVersion;
14+
-use Magento\Staging\Model\Entity\Action\UpdateVersion;
15+
use Magento\Framework\App\ResourceConnection;
16+
+use Magento\Framework\EntityManager\EntityMetadataInterface;
17+
use Magento\Framework\EntityManager\EventManager;
18+
-use Magento\Staging\Model\Operation\Update\CreateEntityVersion;
19+
-use Magento\Staging\Model\Operation\Update\UpdateEntityVersion;
20+
+use Magento\Framework\EntityManager\MetadataPool;
21+
+use Magento\Framework\EntityManager\Operation\UpdateInterface;
22+
use Magento\Framework\EntityManager\TypeResolver;
23+
+use Magento\Staging\Api\Data\UpdateInterface as UpdateInfo;
24+
use Magento\Staging\Api\UpdateRepositoryInterface;
25+
+use Magento\Staging\Model\Entity\Action\UpdateVersion;
26+
+use Magento\Staging\Model\Operation\Update\CampaignIntegrity;
27+
+use Magento\Staging\Model\Operation\Update\CreateEntityVersion;
28+
use Magento\Staging\Model\Operation\Update\RescheduleUpdate;
29+
+use Magento\Staging\Model\Operation\Update\UpdateEntityVersion;
30+
+use Magento\Staging\Model\ResourceModel\Db\ReadEntityVersion;
31+
use Magento\Staging\Model\VersionInfo;
32+
use Magento\Staging\Model\VersionInfoProvider;
33+
-use Magento\Staging\Api\Data\UpdateInterface as UpdateInfo;
34+
+use Magento\Staging\Model\VersionManager;
35+
36+
/**
37+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
38+
@@ -88,6 +89,11 @@ class Update implements UpdateInterface
39+
*/
40+
private $versionInfoProvider;
41+
42+
+ /**
43+
+ * @var VersionManager
44+
+ */
45+
+ private $versionManager;
46+
+
47+
/**
48+
* @param TypeResolver $typeResolver
49+
* @param ReadEntityVersion $entityVersion
50+
@@ -101,6 +107,7 @@ class Update implements UpdateInterface
51+
* @param RescheduleUpdate $rescheduleUpdate
52+
* @param CampaignIntegrity $campaignIntegrity
53+
* @param VersionInfoProvider $versionInfoProvider
54+
+ * @param VersionManager $versionManager
55+
* @internal param PermanentUpdateProcessorPool $permanentUpdateProcessorPool
56+
* @internal param TemporaryUpdateProcessorPool $temporaryUpdateProcessorPool
57+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
58+
@@ -117,7 +124,8 @@ class Update implements UpdateInterface
59+
UpdateRepositoryInterface $updateRepository,
60+
RescheduleUpdate $rescheduleUpdate,
61+
CampaignIntegrity $campaignIntegrity,
62+
- VersionInfoProvider $versionInfoProvider
63+
+ VersionInfoProvider $versionInfoProvider,
64+
+ VersionManager $versionManager
65+
) {
66+
$this->typeResolver = $typeResolver;
67+
$this->entityVersion = $entityVersion;
68+
@@ -131,6 +139,7 @@ class Update implements UpdateInterface
69+
$this->rescheduleUpdate = $rescheduleUpdate;
70+
$this->campaignIntegrity = $campaignIntegrity;
71+
$this->versionInfoProvider = $versionInfoProvider;
72+
+ $this->versionManager = $versionManager;
73+
}
74+
75+
/**
76+
@@ -173,7 +182,12 @@ class Update implements UpdateInterface
77+
$needReschedule = $arguments['created_in'] != $arguments['origin_in']
78+
|| $update->getRollbackId() != $entityData['updated_in'];
79+
if ($needReschedule) {
80+
- $this->rescheduleUpdate->reschedule($arguments['origin_in'], $arguments['created_in'], $entity);
81+
+ $newVersionInfo = $this->rescheduleUpdate->reschedule(
82+
+ $arguments['origin_in'],
83+
+ $arguments['created_in'],
84+
+ $entity
85+
+ );
86+
+ $this->processNewVersion($entity, $newVersionInfo, $hydrator);
87+
}
88+
}
89+
90+
@@ -257,4 +271,26 @@ class Update implements UpdateInterface
91+
$this->campaignIntegrity->createRollbackPoint($update, $entity);
92+
}
93+
}
94+
+
95+
+ /**
96+
+ * Process new version entity
97+
+ *
98+
+ * @param object $entity
99+
+ * @param mixed $newVersionInfo
100+
+ * @param object $hydrator
101+
+ * @return void
102+
+ */
103+
+ private function processNewVersion(object $entity, mixed $newVersionInfo, object $hydrator) : void
104+
+ {
105+
+ if ($newVersionInfo !== null) {
106+
+ $hydrator->hydrate(
107+
+ $entity,
108+
+ [
109+
+ 'created_in' => $newVersionInfo->getCreatedIn(),
110+
+ 'updated_in' => $newVersionInfo->getUpdatedIn()
111+
+ ]
112+
+ );
113+
+ $this->versionManager->setCurrentVersionId($newVersionInfo->getCreatedIn());
114+
+ }
115+
+ }
116+
}
117+
diff --git a/vendor/magento/module-staging/Model/Operation/Update/RescheduleUpdate.php b/vendor/magento/module-staging/Model/Operation/Update/RescheduleUpdate.php
118+
index ac4f8eba0c1..9eae52e5229 100644
119+
--- a/vendor/magento/module-staging/Model/Operation/Update/RescheduleUpdate.php
120+
+++ b/vendor/magento/module-staging/Model/Operation/Update/RescheduleUpdate.php
121+
@@ -5,13 +5,16 @@
122+
*/
123+
namespace Magento\Staging\Model\Operation\Update;
124+
125+
+use Exception;
126+
+use Magento\Framework\App\ResourceConnection;
127+
use Magento\Framework\EntityManager\EntityMetadataInterface;
128+
use Magento\Framework\EntityManager\HydratorPool;
129+
use Magento\Framework\EntityManager\MetadataPool;
130+
use Magento\Framework\EntityManager\TypeResolver;
131+
use Magento\Staging\Api\Data\UpdateInterface;
132+
-use Magento\Framework\App\ResourceConnection;
133+
use Magento\Staging\Api\UpdateRepositoryInterface;
134+
+use Magento\Staging\Model\VersionInfo;
135+
+use Magento\Staging\Model\VersionInfoFactory;
136+
use Magento\Staging\Model\VersionManager;
137+
138+
class RescheduleUpdate
139+
@@ -41,6 +44,11 @@ class RescheduleUpdate
140+
*/
141+
private $updateRepository;
142+
143+
+ /**
144+
+ * @var VersionInfoFactory
145+
+ */
146+
+ private VersionInfoFactory $versionInfoFactory;
147+
+
148+
/**
149+
* RescheduleUpdate constructor.
150+
*
151+
@@ -49,19 +57,22 @@ class RescheduleUpdate
152+
* @param HydratorPool $hydratorPool
153+
* @param TypeResolver $typeResolver
154+
* @param UpdateRepositoryInterface $updateRepository
155+
+ * @param VersionInfoFactory $versionInfoFactory
156+
*/
157+
public function __construct(
158+
ResourceConnection $resourceConnection,
159+
MetadataPool $metadataPool,
160+
HydratorPool $hydratorPool,
161+
TypeResolver $typeResolver,
162+
- UpdateRepositoryInterface $updateRepository
163+
+ UpdateRepositoryInterface $updateRepository,
164+
+ VersionInfoFactory $versionInfoFactory
165+
) {
166+
$this->resourceConnection = $resourceConnection;
167+
$this->metadataPool = $metadataPool;
168+
$this->hydratorPool = $hydratorPool;
169+
$this->typeResolver = $typeResolver;
170+
$this->updateRepository = $updateRepository;
171+
+ $this->versionInfoFactory = $versionInfoFactory;
172+
}
173+
174+
/**
175+
@@ -190,7 +201,7 @@ class RescheduleUpdate
176+
$connection = $this->resourceConnection->getConnectionByName($metadata->getEntityConnectionName());
177+
$previous = $this->getPrevious($metadata, $originVersion, $identifier, $originVersion);
178+
$next = $this->getNext($metadata, $originVersion, $identifier, $originVersion);
179+
- $updatedIn = ($targetVersion < $next && $targetVersion > $originVersion) ? $targetVersion :$next;
180+
+ $updatedIn = ($targetVersion < $next && $targetVersion > $originVersion) ? $targetVersion : $next;
181+
$connection->update(
182+
$metadata->getEntityTable(),
183+
['updated_in' => $updatedIn],
184+
@@ -231,7 +242,7 @@ class RescheduleUpdate
185+
* @param UpdateInterface $origin
186+
* @param UpdateInterface $target
187+
* @param string $identifier
188+
- * @return mixed
189+
+ * @return array|null
190+
*/
191+
private function updateEntry(
192+
EntityMetadataInterface $metadata,
193+
@@ -245,17 +256,19 @@ class RescheduleUpdate
194+
} else {
195+
$updateIn = $this->getNext($metadata, $target->getId(), $identifier, $origin->getId());
196+
}
197+
- return $connection->update(
198+
+ $updatedData = [
199+
+ 'updated_in' => $updateIn,
200+
+ 'created_in' => $target->getId()
201+
+ ];
202+
+ $isUpdated = $connection->update(
203+
$metadata->getEntityTable(),
204+
- [
205+
- 'updated_in' => $updateIn,
206+
- 'created_in' => $target->getId()
207+
- ],
208+
+ $updatedData,
209+
[
210+
$metadata->getIdentifierField() . ' = ?' => $identifier,
211+
'created_in = ?' => $origin->getId()
212+
]
213+
);
214+
+ return $isUpdated ? $updatedData : null;
215+
}
216+
217+
/**
218+
@@ -301,7 +314,7 @@ class RescheduleUpdate
219+
* @param object $entity
220+
* @param UpdateInterface $origin
221+
* @param UpdateInterface $target
222+
- * @return bool
223+
+ * @return array
224+
*/
225+
private function moveEntityVersion($entityType, $entity, UpdateInterface $origin, UpdateInterface $target)
226+
{
227+
@@ -313,8 +326,7 @@ class RescheduleUpdate
228+
$identifier = $entityData[$metadata->getIdentifierField()];
229+
$this->purgeOldInterval($metadata, $originVersion, $targetVersion, $identifier);
230+
$this->prepareNewInterval($metadata, $originVersion, $targetVersion, $identifier);
231+
- $this->updateEntry($metadata, $origin, $target, $identifier);
232+
- return true;
233+
+ return $this->updateEntry($metadata, $origin, $target, $identifier);
234+
}
235+
236+
/**
237+
@@ -323,24 +335,50 @@ class RescheduleUpdate
238+
* @param string $originVersion
239+
* @param string $targetVersion
240+
* @param object $entity
241+
- * @return void
242+
- * @throws \Exception
243+
+ * @return VersionInfo|null
244+
+ * @throws Exception
245+
+ */
246+
+ public function reschedule($originVersion, $targetVersion, object $entity): null|VersionInfo
247+
+ {
248+
+ return $this->rescheduleAndGetVersionInfo($originVersion, $targetVersion, $entity);
249+
+ }
250+
+
251+
+ /**
252+
+ * Reschedules update and get version information for entity
253+
+ *
254+
+ * @param string $originVersion
255+
+ * @param string $targetVersion
256+
+ * @param object $entity
257+
+ * @return null|VersionInfo
258+
+ * @throws Exception
259+
*/
260+
- public function reschedule($originVersion, $targetVersion, $entity)
261+
+ public function rescheduleAndGetVersionInfo($originVersion, $targetVersion, object $entity)
262+
{
263+
$origin = $this->updateRepository->get($originVersion);
264+
$target = $this->updateRepository->get($targetVersion);
265+
$entityType = $this->typeResolver->resolve($entity);
266+
$metadata = $this->metadataPool->getMetadata($entityType);
267+
+ $hydrated = $this->hydratorPool->getHydrator($entityType);
268+
+ $entityData = $hydrated->extract($entity);
269+
+ $identifierField = $metadata->getIdentifierField();
270+
+ $linkField = $metadata->getLinkField();
271+
$connection = $this->resourceConnection->getConnectionByName($metadata->getEntityConnectionName());
272+
$connection->beginTransaction();
273+
try {
274+
if ($origin->getRollbackId() || !$target->getRollbackId()) {
275+
$this->purgeRollbackEntry($entityType, $entity, $origin);
276+
}
277+
- $this->moveEntityVersion($entityType, $entity, $origin, $target);
278+
+ $data = $this->moveEntityVersion($entityType, $entity, $origin, $target);
279+
$connection->commit();
280+
- } catch (\Exception $e) {
281+
+ return $this->versionInfoFactory->create(
282+
+ [
283+
+ 'rowId' => $entityData[$linkField] ?? null,
284+
+ 'identifier' => $entityData[$identifierField] ?? null,
285+
+ 'createdIn' => $data['created_in'] ?? null,
286+
+ 'updatedIn' => $data['updated_in'] ?? null
287+
+ ]
288+
+ );
289+
+ } catch (Exception $e) {
290+
$connection->rollBack();
291+
throw $e;
292+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/vendor/magento/module-google-tag-manager/Plugin/Helper/Data.php b/vendor/magento/module-google-tag-manager/Plugin/Helper/Data.php
2+
index 480409289c85..aff3a7291c55 100644
3+
--- a/vendor/magento/module-google-tag-manager/Plugin/Helper/Data.php
4+
+++ b/vendor/magento/module-google-tag-manager/Plugin/Helper/Data.php
5+
@@ -36,6 +36,6 @@ public function __construct(
6+
*/
7+
public function afterIsTagManagerAvailable(Helper $subject, $result)
8+
{
9+
- return $this->tagManagerConfig->isTagManagerAvailable() ?? $result;
10+
+ return $this->tagManagerConfig->isTagManagerAvailable() ?: $result;
11+
}
12+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
diff --git a/vendor/magento/module-catalog-rule-staging/Model/CatalogRuleApplier.php b/vendor/magento/module-catalog-rule-staging/Model/CatalogRuleApplier.php
2+
index e62cd775e8b3..8ee4258caa18 100644
3+
--- a/vendor/magento/module-catalog-rule-staging/Model/CatalogRuleApplier.php
4+
+++ b/vendor/magento/module-catalog-rule-staging/Model/CatalogRuleApplier.php
5+
@@ -9,10 +9,8 @@
6+
use Magento\Staging\Model\StagingApplierInterface;
7+
use Magento\Framework\App\ObjectManager;
8+
use Magento\Framework\Indexer\IndexerRegistry;
9+
+use Magento\Catalog\Model\Indexer\Product\Price\Processor as PriceProcessor;
10+
11+
-/**
12+
- * Class CatalogRuleApplier
13+
- */
14+
class CatalogRuleApplier implements StagingApplierInterface
15+
{
16+
/**
17+
@@ -36,11 +34,12 @@ public function __construct(
18+
IndexerRegistry $indexerRegistry = null
19+
) {
20+
$this->ruleProductProcessor = $ruleProductProcessor;
21+
- $this->indexerRegistry = $indexerRegistry
22+
- ?: ObjectManager::getInstance()->get(IndexerRegistry::class);
23+
+ $this->indexerRegistry = $indexerRegistry ?: ObjectManager::getInstance()->get(IndexerRegistry::class);
24+
}
25+
26+
/**
27+
+ * Invalidate related indexers
28+
+ *
29+
* @param array $entityIds
30+
* @return void
31+
*/
32+
@@ -48,10 +47,7 @@ public function execute(array $entityIds)
33+
{
34+
if (!empty($entityIds)) {
35+
$this->ruleProductProcessor->markIndexerAsInvalid();
36+
- $this->indexerRegistry->get(\Magento\CatalogRule\Model\Indexer\Product\ProductRuleProcessor::INDEXER_ID)
37+
- ->invalidate();
38+
- $this->indexerRegistry->get(\Magento\Catalog\Model\Indexer\Product\Price\Processor::INDEXER_ID)
39+
- ->invalidate();
40+
+ $this->indexerRegistry->get(PriceProcessor::INDEXER_ID)->invalidate();
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)