Skip to content

Commit cc8277e

Browse files
[Magento Community Engineering] Community Contributions - 2.3-develop
- merged latest code from mainline branch
2 parents f140681 + 54244f7 commit cc8277e

File tree

37 files changed

+184
-88
lines changed

37 files changed

+184
-88
lines changed

app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ public function beforeEnqueue(SubjectExchange $subject, $topic, array $envelopes
9191
if ($headers instanceof AMQPTable) {
9292
try {
9393
$headers->set('store_id', $storeId);
94-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
9594
} catch (AMQPInvalidArgumentException $ea) {
9695
$errorMessage = sprintf("Can't set storeId to amqp message. Error %s.", $ea->getMessage());
9796
$this->logger->error($errorMessage);

app/code/Magento/Backup/Controller/Adminhtml/Index/Rollback.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ public function execute()
127127
$adminSession->destroy();
128128

129129
$response->setRedirectUrl($this->getUrl('*'));
130-
// phpcs:disable Magento2.Exceptions.ThrowCatch
131130
} catch (\Magento\Framework\Backup\Exception\CantLoadSnapshot $e) {
132131
$errorMsg = __('We can\'t find the backup file.');
133132
} catch (\Magento\Framework\Backup\Exception\FtpConnectionFailed $e) {

app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,8 @@ public function create($sku, ProductAttributeMediaGalleryEntryInterface $entry)
7171
$product->setMediaGalleryEntries($existingMediaGalleryEntries);
7272
try {
7373
$product = $this->productRepository->save($product);
74-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
7574
} catch (InputException $inputException) {
7675
throw $inputException;
77-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
7876
} catch (\Exception $e) {
7977
throw new StateException(__("The product can't be saved."));
8078
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ private function getCollectionProcessor()
735735
{
736736
if (!$this->collectionProcessor) {
737737
$this->collectionProcessor = \Magento\Framework\App\ObjectManager::getInstance()->get(
738-
'Magento\Catalog\Model\Api\SearchCriteria\ProductCollectionProcessor'
738+
\Magento\Catalog\Model\Api\SearchCriteria\ProductCollectionProcessor::class
739739
);
740740
}
741741
return $this->collectionProcessor;
@@ -845,7 +845,6 @@ private function saveProduct($product): void
845845
throw new CouldNotSaveException(__($e->getMessage()));
846846
} catch (LocalizedException $e) {
847847
throw $e;
848-
// phpcs:disable Magento2.Exceptions.ThrowCatch
849848
} catch (\Exception $e) {
850849
throw new CouldNotSaveException(
851850
__('The product was unable to be saved. Please try again.'),

app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ public function beforeSave()
193193
if ($this->_data[self::KEY_IS_GLOBAL] != $this->_origData[self::KEY_IS_GLOBAL]) {
194194
try {
195195
$this->attrLockValidator->validate($this);
196-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
197196
} catch (\Magento\Framework\Exception\LocalizedException $exception) {
198197
throw new \Magento\Framework\Exception\LocalizedException(
199198
__('Do not change the scope. %1', $exception->getMessage())

app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ public function createDirectory($name, $path)
447447
'id' => $this->_cmsWysiwygImages->convertPathToId($newPath),
448448
];
449449
return $result;
450-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
451450
} catch (\Magento\Framework\Exception\FileSystemException $e) {
452451
throw new \Magento\Framework\Exception\LocalizedException(__('We cannot create a new directory.'));
453452
}
@@ -474,7 +473,6 @@ public function deleteDirectory($path)
474473
$this->_deleteByPath($path);
475474
$path = $this->getThumbnailRoot() . $this->_getRelativePathToRoot($path);
476475
$this->_deleteByPath($path);
477-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
478476
} catch (\Magento\Framework\Exception\FileSystemException $e) {
479477
throw new \Magento\Framework\Exception\LocalizedException(
480478
__('We cannot delete directory %1.', $this->_getRelativePathToRoot($path))

app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
<dataScope>identifier</dataScope>
112112
</settings>
113113
</field>
114-
<field name="storeviews" formElement="multiselect">
114+
<field name="storeviews" formElement="multiselect" class="Magento\Store\Ui\Component\Form\Field\StoreView">
115115
<argument name="data" xsi:type="array">
116116
<item name="config" xsi:type="array">
117117
<item name="source" xsi:type="string">block</item>

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,49 +66,65 @@
6666
class AccountManagement implements AccountManagementInterface
6767
{
6868
/**
69-
* Configuration paths for email templates and identities
69+
* Configuration paths for create account email template
7070
*
7171
* @deprecated
7272
*/
7373
const XML_PATH_REGISTER_EMAIL_TEMPLATE = 'customer/create_account/email_template';
7474

7575
/**
76+
* Configuration paths for register no password email template
77+
*
7678
* @deprecated
7779
*/
7880
const XML_PATH_REGISTER_NO_PASSWORD_EMAIL_TEMPLATE = 'customer/create_account/email_no_password_template';
7981

8082
/**
83+
* Configuration paths for remind email identity
84+
*
8185
* @deprecated
8286
*/
8387
const XML_PATH_REGISTER_EMAIL_IDENTITY = 'customer/create_account/email_identity';
8488

8589
/**
90+
* Configuration paths for remind email template
91+
*
8692
* @deprecated
8793
*/
8894
const XML_PATH_REMIND_EMAIL_TEMPLATE = 'customer/password/remind_email_template';
8995

9096
/**
97+
* Configuration paths for forgot email email template
98+
*
9199
* @deprecated
92100
*/
93101
const XML_PATH_FORGOT_EMAIL_TEMPLATE = 'customer/password/forgot_email_template';
94102

95103
/**
104+
* Configuration paths for forgot email identity
105+
*
96106
* @deprecated
97107
*/
98108
const XML_PATH_FORGOT_EMAIL_IDENTITY = 'customer/password/forgot_email_identity';
99109

100110
/**
111+
* Configuration paths for account confirmation required
112+
*
101113
* @deprecated
102114
* @see AccountConfirmation::XML_PATH_IS_CONFIRM
103115
*/
104116
const XML_PATH_IS_CONFIRM = 'customer/create_account/confirm';
105117

106118
/**
119+
* Configuration paths for account confirmation email template
120+
*
107121
* @deprecated
108122
*/
109123
const XML_PATH_CONFIRM_EMAIL_TEMPLATE = 'customer/create_account/email_confirmation_template';
110124

111125
/**
126+
* Configuration paths for confirmation confirmed email template
127+
*
112128
* @deprecated
113129
*/
114130
const XML_PATH_CONFIRMED_EMAIL_TEMPLATE = 'customer/create_account/email_confirmed_template';
@@ -161,11 +177,15 @@ class AccountManagement implements AccountManagementInterface
161177
const XML_PATH_REQUIRED_CHARACTER_CLASSES_NUMBER = 'customer/password/required_character_classes_number';
162178

163179
/**
180+
* Configuration path to customer reset password email template
181+
*
164182
* @deprecated
165183
*/
166184
const XML_PATH_RESET_PASSWORD_TEMPLATE = 'customer/password/reset_password_template';
167185

168186
/**
187+
* Minimum password length
188+
*
169189
* @deprecated
170190
*/
171191
const MIN_PASSWORD_LENGTH = 6;
@@ -579,7 +599,6 @@ public function authenticate($username, $password)
579599
}
580600
try {
581601
$this->getAuthentication()->authenticate($customerId, $password);
582-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
583602
} catch (InvalidEmailOrPasswordException $e) {
584603
throw new InvalidEmailOrPasswordException(__('Invalid login or password.'));
585604
}
@@ -890,7 +909,6 @@ public function createAccountWithPasswordHash(CustomerInterface $customer, $hash
890909
throw new InputMismatchException(
891910
__('A customer with the same email address already exists in an associated website.')
892911
);
893-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
894912
} catch (LocalizedException $e) {
895913
throw $e;
896914
}
@@ -910,7 +928,6 @@ public function createAccountWithPasswordHash(CustomerInterface $customer, $hash
910928
}
911929
}
912930
$this->customerRegistry->remove($customer->getId());
913-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
914931
} catch (InputException $e) {
915932
$this->customerRepository->delete($customer);
916933
throw $e;
@@ -1017,7 +1034,6 @@ private function changePasswordForCustomer($customer, $currentPassword, $newPass
10171034
{
10181035
try {
10191036
$this->getAuthentication()->authenticate($customer->getId(), $currentPassword);
1020-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
10211037
} catch (InvalidEmailOrPasswordException $e) {
10221038
throw new InvalidEmailOrPasswordException(
10231039
__("The password doesn't match this account. Verify the password and try again.")

app/code/Magento/Email/Model/Template/Filter.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,6 @@ public function getCssFilesContent(array $files)
956956
}
957957
} catch (ContentProcessorException $exception) {
958958
$css = $exception->getMessage();
959-
// phpcs:disable Magento2.Exceptions.ThrowCatch
960959
} catch (\Magento\Framework\View\Asset\File\NotFoundException $exception) {
961960
$css = '';
962961
}

app/code/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function _prepareForm()
4545
'name' => 'generate_random',
4646
'label' => __('Auto-generate a Key'),
4747
'options' => [0 => __('No'), 1 => __('Yes')],
48-
'onclick' => "var cryptKey = jQuery('#crypt_key'); var cryptKeyBlock = cryptKey.parent().parent(); ".
48+
'onchange' => "var cryptKey = jQuery('#crypt_key'); var cryptKeyBlock = cryptKey.parent().parent(); ".
4949
"cryptKey.prop('disabled', this.value === '1'); " .
5050
"if (cryptKey.prop('disabled')) { cryptKeyBlock.hide() } " .
5151
"else { cryptKeyBlock.show() }",

app/code/Magento/ImportExport/Controller/Adminhtml/Export/File/Download.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public function execute()
7272
DirectoryList::VAR_DIR
7373
);
7474
}
75-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
7675
} catch (LocalizedException | \Exception $exception) {
7776
throw new LocalizedException(__('There are no export file with such name %1', $fileName));
7877
}

app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Info.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ protected function _addGeneralFieldset($form, $integrationData)
146146
'label' => __('Callback URL'),
147147
'name' => self::DATA_ENDPOINT,
148148
'disabled' => $disabled,
149+
'class' => 'validate-url',
149150
// @codingStandardsIgnoreStart
150151
'note' => __(
151152
'Enter URL where Oauth credentials can be sent when using Oauth for token exchange. We strongly recommend using https://.'

app/code/Magento/Newsletter/Model/Subscriber.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,6 @@ public function subscribe($email)
495495
$this->sendConfirmationSuccessEmail();
496496
}
497497
return $this->getStatus();
498-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
499498
} catch (\Exception $e) {
500499
// phpcs:ignore Magento2.Exceptions.DirectThrow
501500
throw new \Exception($e->getMessage());

app/code/Magento/Paypal/Model/Payflow/Transparent.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ public function authorize(InfoInterface $payment, $amount)
195195
} catch (LocalizedException $exception) {
196196
$payment->setParentTransactionId($response->getData(self::PNREF));
197197
$this->void($payment);
198-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
199198
throw new LocalizedException(__("The payment couldn't be processed at this time. Please try again later."));
200199
}
201200

app/code/Magento/Quote/Model/QuoteManagement.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,6 @@ private function rollbackAddresses(
688688
'exception' => $e,
689689
]
690690
);
691-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
692691
} catch (\Exception $consecutiveException) {
693692
$message = sprintf(
694693
"An exception occurred on 'sales_model_service_quote_submit_failure' event: %s",

app/code/Magento/Sales/Model/AdminOrder/Create.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,6 @@ public function updateQuoteItems($items)
11341134
} catch (\Magento\Framework\Exception\LocalizedException $e) {
11351135
$this->recollectCart();
11361136
throw $e;
1137-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
11381137
} catch (\Exception $e) {
11391138
$this->_logger->critical($e);
11401139
}
@@ -1991,6 +1990,7 @@ protected function _validate()
19911990
/** @var \Magento\Quote\Model\Quote\Item $item */
19921991
$messages = $item->getMessage(false);
19931992
if ($item->getHasError() && is_array($messages) && !empty($messages)) {
1993+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
19941994
$this->_errors = array_merge($this->_errors, $messages);
19951995
}
19961996
}
@@ -2010,7 +2010,6 @@ protected function _validate()
20102010
} else {
20112011
try {
20122012
$method->validate();
2013-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
20142013
} catch (\Magento\Framework\Exception\LocalizedException $e) {
20152014
$this->_errors[] = $e->getMessage();
20162015
}

app/code/Magento/Sales/Model/Order/Payment.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,6 @@ public function refund($creditmemo)
684684
$gateway->refund($this, $baseAmountToRefund);
685685

686686
$creditmemo->setTransactionId($this->getLastTransId());
687-
// phpcs:ignore Magento2.Exceptions.ThrowCatch
688687
} catch (\Magento\Framework\Exception\LocalizedException $e) {
689688
if (!$captureTxn) {
690689
throw new \Magento\Framework\Exception\LocalizedException(

app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Sales\Model\Order\Pdf;
710

811
/**
912
* Sales Order Creditmemo PDF model
13+
*
1014
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1115
*/
1216
class Creditmemo extends AbstractPdf
@@ -180,11 +184,11 @@ public function getPdf($creditmemos = [])
180184
}
181185
/* Add totals */
182186
$this->insertTotals($page, $creditmemo);
187+
if ($creditmemo->getStoreId()) {
188+
$this->_localeResolver->revert();
189+
}
183190
}
184191
$this->_afterGetPdf();
185-
if ($creditmemo->getStoreId()) {
186-
$this->_localeResolver->revert();
187-
}
188192
return $pdf;
189193
}
190194

app/code/Magento/Sitemap/etc/adminhtml/system.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@
8383
<label>Sitemap File Limits</label>
8484
<field id="max_lines" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
8585
<label>Maximum No of URLs Per File</label>
86+
<validate>validate-number validate-greater-than-zero</validate>
8687
</field>
8788
<field id="max_file_size" translate="label comment" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
8889
<label>Maximum File Size</label>
8990
<comment>File size in bytes.</comment>
91+
<validate>validate-number validate-greater-than-zero</validate>
9092
</field>
9193
</group>
9294
<group id="search_engines" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1">
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Store\Ui\Component\Form\Field;
9+
10+
use Magento\Framework\View\Element\UiComponent\ContextInterface;
11+
use Magento\Framework\View\Element\UiComponentFactory;
12+
use Magento\Store\Model\StoreManagerInterface as StoreManager;
13+
use Magento\Ui\Component\Form\Field;
14+
15+
/**
16+
* Check to disable store view field
17+
*
18+
* Class \Magento\Store\Ui\Component\Form\Field\StoreView
19+
*/
20+
class StoreView extends Field
21+
{
22+
/**
23+
* Store manager
24+
*
25+
* @var StoreManager
26+
*/
27+
private $storeManager;
28+
29+
/**
30+
* StoreView constructor.
31+
*
32+
* @param ContextInterface $context
33+
* @param UiComponentFactory $uiComponentFactory
34+
* @param StoreManager $storeManager
35+
* @param array $components
36+
* @param array $data
37+
*/
38+
public function __construct(
39+
ContextInterface $context,
40+
UiComponentFactory $uiComponentFactory,
41+
StoreManager $storeManager,
42+
array $components = [],
43+
array $data = []
44+
) {
45+
parent::__construct($context, $uiComponentFactory, $components, $data);
46+
$this->storeManager = $storeManager;
47+
}
48+
49+
/**
50+
* Prepare component configuration
51+
*
52+
* @return void
53+
*/
54+
public function prepare()
55+
{
56+
parent::prepare();
57+
if ($this->storeManager->isSingleStoreMode()) {
58+
$this->_data['config']['componentDisabled'] = true;
59+
}
60+
}
61+
}

app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme/UploadJs.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public function execute()
5252
\Magento\Framework\View\Design\Theme\Customization\File\Js::TYPE
5353
);
5454
$result = ['error' => false, 'files' => $customization->generateFileInfo($customJsFiles)];
55-
// phpcs:disable Magento2.Exceptions.ThrowCatch
5655
} catch (\Magento\Framework\Exception\LocalizedException $e) {
5756
$result = ['error' => true, 'message' => $e->getMessage()];
5857
} catch (\Exception $e) {

0 commit comments

Comments
 (0)