Skip to content

Commit 69d8e65

Browse files
committed
MC-21671: [S4] Unreliable implementation for the release publishing functionality
1 parent 42c2672 commit 69d8e65

File tree

13 files changed

+395
-478
lines changed

13 files changed

+395
-478
lines changed

app/code/Magento/AuthorizenetAcceptjs/Block/Form.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
*
2020
* @api
2121
* @since 100.3.0
22+
* @deprecated Starting from Magento 2.3.4 Authorize.net payment method core integration is deprecated in favor of
23+
* official payment integration available on the marketplace
2224
*/
2325
class Form extends Cc
2426
{

app/code/Magento/AuthorizenetAcceptjs/Block/Info.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*
1717
* @api
1818
* @since 100.3.0
19+
* @deprecated Starting from Magento 2.3.4 Authorize.net payment method core integration is deprecated in favor of
20+
* official payment integration available on the marketplace
1921
*/
2022
class Info extends ConfigurableInfo
2123
{

app/code/Magento/AuthorizenetAcceptjs/Block/Payment.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
*
2020
* @api
2121
* @since 100.3.0
22+
* @deprecated Starting from Magento 2.3.4 Authorize.net payment method core integration is deprecated in favor of
23+
* official payment integration available on the marketplace
2224
*/
2325
class Payment extends Template
2426
{

app/code/Magento/Catalog/Model/Category.php

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55
*/
66
namespace Magento\Catalog\Model;
77

8-
use Magento\Authorization\Model\UserContextInterface;
98
use Magento\Catalog\Api\CategoryRepositoryInterface;
109
use Magento\Catalog\Api\Data\CategoryInterface;
1110
use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator;
1211
use Magento\Framework\Api\AttributeValueFactory;
13-
use Magento\Framework\App\ObjectManager;
14-
use Magento\Framework\AuthorizationInterface;
1512
use Magento\Framework\Convert\ConvertArray;
1613
use Magento\Framework\Exception\NoSuchEntityException;
1714
use Magento\Framework\Profiler;
@@ -132,6 +129,8 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
132129
'page_layout',
133130
'custom_layout_update',
134131
'custom_apply_to_products',
132+
'custom_layout_update_file',
133+
'custom_use_parent_settings'
135134
];
136135

137136
/**
@@ -215,16 +214,6 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
215214
*/
216215
protected $metadataService;
217216

218-
/**
219-
* @var UserContextInterface
220-
*/
221-
private $userContext;
222-
223-
/**
224-
* @var AuthorizationInterface
225-
*/
226-
private $authorization;
227-
228217
/**
229218
* @param \Magento\Framework\Model\Context $context
230219
* @param \Magento\Framework\Registry $registry
@@ -325,7 +314,6 @@ protected function getCustomAttributesCodes()
325314
return $this->customAttributesCodes;
326315
}
327316

328-
// phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod
329317
/**
330318
* Returns model resource
331319
*
@@ -334,11 +322,10 @@ protected function getCustomAttributesCodes()
334322
* @deprecated 102.0.6 because resource models should be used directly
335323
* @since 102.0.6
336324
*/
337-
protected function _getResource()
325+
protected function _getResource() //phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod
338326
{
339327
return parent::_getResource();
340328
}
341-
// phpcs:enable
342329

343330
/**
344331
* Get flat resource model flag
@@ -450,7 +437,9 @@ public function move($parentId, $afterCategoryId)
450437
if ($this->flatState->isFlatEnabled()) {
451438
$flatIndexer = $this->indexerRegistry->get(Indexer\Category\Flat\State::INDEXER_ID);
452439
if (!$flatIndexer->isScheduled()) {
453-
$flatIndexer->reindexList([$this->getId(), $oldParentId, $parentId]);
440+
$sameLevelCategories = explode(',', $this->getParentCategory()->getChildren());
441+
$list = array_unique(array_merge($sameLevelCategories, [$this->getId(), $oldParentId, $parentId]));
442+
$flatIndexer->reindexList($list);
454443
}
455444
}
456445
$productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);
@@ -492,7 +481,7 @@ public function getProductCollection()
492481
* Retrieve all customer attributes
493482
*
494483
* @param bool $noDesignAttributes
495-
* @return array
484+
* @return \Magento\Eav\Api\Data\AttributeInterface[]
496485
* @todo Use with Flat Resource
497486
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
498487
*/
@@ -761,7 +750,7 @@ public function getCustomDesignDate()
761750
/**
762751
* Retrieve design attributes array
763752
*
764-
* @return array
753+
* @return \Magento\Eav\Api\Data\AttributeInterface[]
765754
*/
766755
public function getDesignAttributes()
767756
{
@@ -934,6 +923,7 @@ public function beforeDelete()
934923
}
935924

936925
/**
926+
<<<<<<< HEAD
937927
* Get user context.
938928
*
939929
* @return UserContextInterface
@@ -989,6 +979,8 @@ public function beforeSave()
989979
}
990980

991981
/**
982+
=======
983+
>>>>>>> 2.3.4-develop
992984
* Retrieve anchors above
993985
*
994986
* @return array
@@ -1199,8 +1191,6 @@ public function reindex()
11991191
|| $this->dataHasChangedFor('is_active')) {
12001192
if (!$productIndexer->isScheduled()) {
12011193
$productIndexer->reindexList($this->getPathIds());
1202-
} else {
1203-
$productIndexer->invalidate();
12041194
}
12051195
}
12061196
}
@@ -1358,6 +1348,7 @@ public function getChildrenData()
13581348

13591349
//@codeCoverageIgnoreEnd
13601350

1351+
// phpcs:disable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames
13611352
/**
13621353
* Return Data Object data in array format.
13631354
*
@@ -1366,6 +1357,7 @@ public function getChildrenData()
13661357
*/
13671358
public function __toArray()
13681359
{
1360+
// phpcs:enable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames
13691361
$data = $this->_data;
13701362
$hasToArray = function ($model) {
13711363
return is_object($model) && method_exists($model, '__toArray') && is_callable([$model, '__toArray']);

app/code/Magento/CatalogSearch/Setup/Patch/Data/SetInitialSearchWeightForAttributes.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66

77
namespace Magento\CatalogSearch\Setup\Patch\Data;
88

9+
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
910
use Magento\Framework\App\State;
11+
use Magento\Framework\Indexer\IndexerInterfaceFactory;
1012
use Magento\Framework\Setup\Patch\DataPatchInterface;
1113
use Magento\Framework\Setup\Patch\PatchVersionInterface;
12-
use Magento\Framework\Indexer\IndexerInterfaceFactory;
13-
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
1414

1515
/**
16+
* This patch sets up search weight for the product's system attributes, reindex required after patch applying.
17+
*
1618
* @deprecated 101.0.0
1719
* @see \Magento\ElasticSearch
1820
*/
@@ -50,7 +52,7 @@ public function __construct(
5052
}
5153

5254
/**
53-
* {@inheritdoc}
55+
* @inheritdoc
5456
*/
5557
public function apply()
5658
{
@@ -60,29 +62,31 @@ public function apply()
6062
$this->state->emulateAreaCode(
6163
\Magento\Framework\App\Area::AREA_CRONTAB,
6264
function () use ($indexer) {
63-
$indexer->reindexAll();
65+
$indexer->getState()
66+
->setStatus(\Magento\Framework\Indexer\StateInterface::STATUS_INVALID)
67+
->save();
6468
}
6569
);
6670
}
6771

6872
/**
69-
* {@inheritdoc}
73+
* @inheritdoc
7074
*/
7175
public static function getDependencies()
7276
{
7377
return [];
7478
}
7579

7680
/**
77-
* {@inheritdoc}
81+
* @inheritdoc
7882
*/
7983
public static function getVersion()
8084
{
8185
return '2.0.0';
8286
}
8387

8488
/**
85-
* {@inheritdoc}
89+
* @inheritdoc
8690
*/
8791
public function getAliases()
8892
{

app/code/Magento/Checkout/Model/Session.php

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
use Magento\Customer\Api\Data\CustomerInterface;
99
use Magento\Framework\App\ObjectManager;
10+
use Magento\Framework\Exception\NoSuchEntityException;
11+
use Magento\Quote\Api\Data\CartInterface;
1012
use Magento\Quote\Model\Quote;
1113
use Magento\Quote\Model\QuoteIdMaskFactory;
1214
use Psr\Log\LoggerInterface;
@@ -17,13 +19,11 @@
1719
* @api
1820
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1921
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
22+
* @SuppressWarnings(PHPMD.TooManyFields)
2023
* @since 100.0.2
2124
*/
2225
class Session extends \Magento\Framework\Session\SessionManager
2326
{
24-
/**
25-
* Checkout state begin
26-
*/
2727
const CHECKOUT_STATE_BEGIN = 'begin';
2828

2929
/**
@@ -47,6 +47,15 @@ class Session extends \Magento\Framework\Session\SessionManager
4747
*/
4848
protected $_loadInactive = false;
4949

50+
/**
51+
* A flag to track when the quote is being loaded and attached to the session object.
52+
*
53+
* Used in trigger_recollect infinite loop detection.
54+
*
55+
* @var bool
56+
*/
57+
private $isLoading = false;
58+
5059
/**
5160
* Loaded order instance
5261
*
@@ -219,7 +228,7 @@ public function setLoadInactive($load = true)
219228
*
220229
* @return Quote
221230
* @throws \Magento\Framework\Exception\LocalizedException
222-
* @throws \Magento\Framework\Exception\NoSuchEntityException
231+
* @throws NoSuchEntityException
223232
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
224233
* @SuppressWarnings(PHPMD.NPathComplexity)
225234
*/
@@ -228,6 +237,10 @@ public function getQuote()
228237
$this->_eventManager->dispatch('custom_quote_process', ['checkout_session' => $this]);
229238

230239
if ($this->_quote === null) {
240+
if ($this->isLoading) {
241+
throw new \LogicException("Infinite loop detected, review the trace for the looping path");
242+
}
243+
$this->isLoading = true;
231244
$quote = $this->quoteFactory->create();
232245
if ($this->getQuoteId()) {
233246
try {
@@ -260,21 +273,17 @@ public function getQuote()
260273
*/
261274
$quote = $this->quoteRepository->get($this->getQuoteId());
262275
}
263-
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
276+
} catch (NoSuchEntityException $e) {
264277
$this->setQuoteId(null);
265278
}
266279
}
267280

268281
if (!$this->getQuoteId()) {
269282
if ($this->_customerSession->isLoggedIn() || $this->_customer) {
270-
$customerId = $this->_customer
271-
? $this->_customer->getId()
272-
: $this->_customerSession->getCustomerId();
273-
try {
274-
$quote = $this->quoteRepository->getActiveForCustomer($customerId);
275-
$this->setQuoteId($quote->getId());
276-
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
277-
$this->logger->critical($e);
283+
$quoteByCustomer = $this->getQuoteByCustomer();
284+
if ($quoteByCustomer !== null) {
285+
$this->setQuoteId($quoteByCustomer->getId());
286+
$quote = $quoteByCustomer;
278287
}
279288
} else {
280289
$quote->setIsCheckoutCart(true);
@@ -290,6 +299,7 @@ public function getQuote()
290299

291300
$quote->setStore($this->_storeManager->getStore());
292301
$this->_quote = $quote;
302+
$this->isLoading = false;
293303
}
294304

295305
if (!$this->isQuoteMasked() && !$this->_customerSession->isLoggedIn() && $this->getQuoteId()) {
@@ -361,7 +371,7 @@ public function loadCustomerQuote()
361371

362372
try {
363373
$customerQuote = $this->quoteRepository->getForCustomer($this->_customerSession->getCustomerId());
364-
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
374+
} catch (NoSuchEntityException $e) {
365375
$customerQuote = $this->quoteFactory->create();
366376
}
367377
$customerQuote->setStoreId($this->_storeManager->getStore()->getId());
@@ -371,6 +381,11 @@ public function loadCustomerQuote()
371381
$this->quoteRepository->save(
372382
$customerQuote->merge($this->getQuote())->collectTotals()
373383
);
384+
$newQuote = $this->quoteRepository->get($customerQuote->getId());
385+
$this->quoteRepository->save(
386+
$newQuote->collectTotals()
387+
);
388+
$customerQuote = $newQuote;
374389
}
375390

376391
$this->setQuoteId($customerQuote->getId());
@@ -539,7 +554,7 @@ public function restoreQuote()
539554
$this->replaceQuote($quote)->unsLastRealOrderId();
540555
$this->_eventManager->dispatch('restore_quote', ['order' => $order, 'quote' => $quote]);
541556
return true;
542-
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
557+
} catch (NoSuchEntityException $e) {
543558
$this->logger->critical($e);
544559
}
545560
}
@@ -569,4 +584,22 @@ protected function isQuoteMasked()
569584
{
570585
return $this->isQuoteMasked;
571586
}
587+
588+
/**
589+
* Returns quote for customer if there is any
590+
*/
591+
private function getQuoteByCustomer(): ?CartInterface
592+
{
593+
$customerId = $this->_customer
594+
? $this->_customer->getId()
595+
: $this->_customerSession->getCustomerId();
596+
597+
try {
598+
$quote = $this->quoteRepository->getActiveForCustomer($customerId);
599+
} catch (NoSuchEntityException $e) {
600+
$quote = null;
601+
}
602+
603+
return $quote;
604+
}
572605
}

0 commit comments

Comments
 (0)