Skip to content

Commit 741e610

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #21098: Updated Deprecated functions call (by @ankitsrivastavacedcoss) - #19608: Fixed Custom option price calculation is wrong with multi currency when option price type is percentage (by @emiprotech) - #21069: Error icon issue resolved (by @speedy008) - #21093: Removed useless sprintf and removed code no longer needed (by @df2k2) - #21095: Fixing returning types (by @eduard13) - #20923: Fixed issue if there are multiple skus in catalog rule condition combination (by @suneet64) - #20495: #18347 - Element 'css', attribute 'as': The attribute 'as' is not allowed. (CSS preloading) (by @vasilii-b) - #19996: Fixed issue Unable to open URL for downloadable product (by @shikhamis11) - #18852: Changes cache hosts warning / critical levels and continue on multiple hosts (by @wiardvanrij) - magento-engcom/import-export-improvements#130: magento-engcom/import-export-improvements#75: fix stoping on errors (by @sawebvisum) Fixed GitHub Issues: - #19561: Custom option price calculation is wrong with multi currency when option price type is percentage. (reported by @nimitaemipro) has been fixed in #19608 by @emiprotech in 2.3-develop branch Related commits: 1. f7fb186 2. 4d84a7a 3. 8bdedc5 4. fde7fb1 - #19328: Success Message Icon vertically misaligned in admin panel (reported by @speedy008) has been fixed in #21069 by @speedy008 in 2.3-develop branch Related commits: 1. 505352c 2. 5efc288 3. 8d9ec36 - #18347: Element 'css', attribute 'as': The attribute 'as' is not allowed. (CSS preloading) (reported by @benoitrenaud) has been fixed in #20495 by @vasilii-b in 2.3-develop branch Related commits: 1. 57f6957 - #18944: Unable to open URL for downloadable product in 2.2.6 (reported by @supportnubix) has been fixed in #19996 by @shikhamis11 in 2.3-develop branch Related commits: 1. 76040cc 2. d5b7745 3. 3285908 4. 116c4a7 5. 5ecf410 6. 01a5fce 7. f1867c9 8. 2072100 9. 1bb672c 10. 5ba9c1b 11. 420a06d 12. c020b2c - #18056: CacheInvalidate : stop at first server not responding (reported by @synolia-bvo) has been fixed in #18852 by @wiardvanrij in 2.3-develop branch Related commits: 1. a8f662e 2. 04aa94e 3. 0ab520a 4. fb5a9d1 5. 7f2c079 6. d74640a 7. 9a5bc5f 8. de6af27 9. e95de00
2 parents 3b2e305 + 63a874f commit 741e610

File tree

22 files changed

+199
-93
lines changed

22 files changed

+199
-93
lines changed

app/code/Magento/Backend/Block/Template/Context.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* the classes they were introduced for.
1818
*
1919
* @api
20+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2021
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2122
* @since 100.0.2
2223
*/
@@ -173,6 +174,8 @@ public function getAuthorization()
173174
}
174175

175176
/**
177+
* Get Backend Session
178+
*
176179
* @return \Magento\Backend\Model\Session
177180
*/
178181
public function getBackendSession()
@@ -181,6 +184,8 @@ public function getBackendSession()
181184
}
182185

183186
/**
187+
* Get Math Random
188+
*
184189
* @return \Magento\Framework\Math\Random
185190
*/
186191
public function getMathRandom()
@@ -189,6 +194,8 @@ public function getMathRandom()
189194
}
190195

191196
/**
197+
* Get Form Key
198+
*
192199
* @return \Magento\Framework\Data\Form\FormKey
193200
*/
194201
public function getFormKey()
@@ -197,7 +204,9 @@ public function getFormKey()
197204
}
198205

199206
/**
200-
* @return \Magento\Framework\Data\Form\FormKey
207+
* Get Class Name Builder
208+
*
209+
* @return \Magento\Framework\Code\NameBuilder
201210
*/
202211
public function getNameBuilder()
203212
{

app/code/Magento/Backup/Model/Backup.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* @method string getPath()
1515
* @method string getName()
1616
* @method string getTime()
17+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1718
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1819
* @api
1920
* @since 100.0.2
@@ -80,6 +81,7 @@ class Backup extends \Magento\Framework\DataObject implements \Magento\Framework
8081
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
8182
* @param \Magento\Framework\Filesystem $filesystem
8283
* @param array $data
84+
* @throws \Magento\Framework\Exception\FileSystemException
8385
*/
8486
public function __construct(
8587
\Magento\Backup\Helper\Data $helper,
@@ -242,7 +244,7 @@ public function setFile(&$content)
242244
/**
243245
* Return content of backup file
244246
*
245-
* @return string
247+
* @return array
246248
* @throws \Magento\Framework\Exception\LocalizedException
247249
*/
248250
public function &getFile()
@@ -275,8 +277,9 @@ public function deleteFile()
275277
*
276278
* @param bool $write
277279
* @return $this
278-
* @throws \Magento\Framework\Exception\InputException
279280
* @throws \Magento\Framework\Backup\Exception\NotEnoughPermissions
281+
* @throws \Magento\Framework\Exception\FileSystemException
282+
* @throws \Magento\Framework\Exception\InputException
280283
*/
281284
public function open($write = false)
282285
{
@@ -330,6 +333,7 @@ protected function _getStream()
330333
*
331334
* @param int $length
332335
* @return string
336+
* @throws \Magento\Framework\Exception\InputException
333337
*/
334338
public function read($length)
335339
{
@@ -340,6 +344,7 @@ public function read($length)
340344
* Check end of file.
341345
*
342346
* @return bool
347+
* @throws \Magento\Framework\Exception\InputException
343348
*/
344349
public function eof()
345350
{
@@ -370,6 +375,7 @@ public function write($string)
370375
* Close open backup file
371376
*
372377
* @return $this
378+
* @throws \Magento\Framework\Exception\InputException
373379
*/
374380
public function close()
375381
{
@@ -383,6 +389,8 @@ public function close()
383389
* Print output
384390
*
385391
* @return string
392+
* @return \Magento\Framework\Filesystem\Directory\ReadInterface|string|void
393+
* @throws \Magento\Framework\Exception\FileSystemException
386394
*/
387395
public function output()
388396
{
@@ -398,6 +406,8 @@ public function output()
398406
}
399407

400408
/**
409+
* Get Size
410+
*
401411
* @return int|mixed
402412
*/
403413
public function getSize()
@@ -419,6 +429,7 @@ public function getSize()
419429
*
420430
* @param string $password
421431
* @return bool
432+
* @throws \Exception
422433
*/
423434
public function validateUserPassword($password)
424435
{

app/code/Magento/CacheInvalidate/Model/PurgeCache.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ private function splitTags($tagsPattern)
118118
private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedTagsChunk)
119119
{
120120
$headers = [self::HEADER_X_MAGENTO_TAGS_PATTERN => $formattedTagsChunk];
121+
$unresponsiveServerError = [];
121122
foreach ($servers as $server) {
122123
$headers['Host'] = $server->getHost();
123124
try {
@@ -131,10 +132,30 @@ private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedT
131132
$socketAdapter->read();
132133
$socketAdapter->close();
133134
} catch (\Exception $e) {
134-
$this->logger->critical($e->getMessage(), compact('server', 'formattedTagsChunk'));
135+
$unresponsiveServerError[] = "Cache host: " . $server->getHost() . ":" . $server->getPort() .
136+
"resulted in error message: " . $e->getMessage();
137+
}
138+
}
139+
140+
$errorCount = count($unresponsiveServerError);
141+
142+
if ($errorCount > 0) {
143+
$loggerMessage = implode(" ", $unresponsiveServerError);
144+
145+
if ($errorCount == count($servers)) {
146+
$this->logger->critical(
147+
'No cache server(s) could be purged ' . $loggerMessage,
148+
compact('server', 'formattedTagsChunk')
149+
);
135150
return false;
136151
}
152+
153+
$this->logger->warning(
154+
'Unresponsive cache server(s) hit' . $loggerMessage,
155+
compact('server', 'formattedTagsChunk')
156+
);
137157
}
158+
138159
$this->logger->execute(compact('servers', 'formattedTagsChunk'));
139160
return true;
140161
}

app/code/Magento/Catalog/Block/Product/View/Options.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/**
8-
* Product options block
9-
*
10-
* @author Magento Core Team <[email protected]>
11-
*/
127
namespace Magento\Catalog\Block\Product\View;
138

149
use Magento\Catalog\Model\Product;
10+
use Magento\Catalog\Model\Product\Option\Value;
1511

1612
/**
13+
* Product options block
14+
*
15+
* @author Magento Core Team <[email protected]>
1716
* @api
1817
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1918
* @since 100.0.2
@@ -121,6 +120,8 @@ public function setProduct(Product $product = null)
121120
}
122121

123122
/**
123+
* Get group of option.
124+
*
124125
* @param string $type
125126
* @return string
126127
*/
@@ -142,6 +143,8 @@ public function getOptions()
142143
}
143144

144145
/**
146+
* Check if block has options.
147+
*
145148
* @return bool
146149
*/
147150
public function hasOptions()
@@ -160,7 +163,10 @@ public function hasOptions()
160163
*/
161164
protected function _getPriceConfiguration($option)
162165
{
163-
$optionPrice = $this->pricingHelper->currency($option->getPrice(true), false, false);
166+
$optionPrice = $option->getPrice(true);
167+
if ($option->getPriceType() !== Value::TYPE_PERCENT) {
168+
$optionPrice = $this->pricingHelper->currency($optionPrice, false, false);
169+
}
164170
$data = [
165171
'prices' => [
166172
'oldPrice' => [
@@ -195,7 +201,7 @@ protected function _getPriceConfiguration($option)
195201
],
196202
],
197203
'type' => $option->getPriceType(),
198-
'name' => $option->getTitle()
204+
'name' => $option->getTitle(),
199205
];
200206
return $data;
201207
}
@@ -231,7 +237,7 @@ public function getJsonConfig()
231237
//pass the return array encapsulated in an object for the other modules to be able to alter it eg: weee
232238
$this->_eventManager->dispatch('catalog_product_option_price_configuration_after', ['configObj' => $configObj]);
233239

234-
$config=$configObj->getConfig();
240+
$config = $configObj->getConfig();
235241

236242
return $this->_jsonEncoder->encode($config);
237243
}

app/code/Magento/Downloadable/Helper/Download.php

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/**
1414
* Downloadable Products Download Helper
1515
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
16+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1617
*/
1718
class Download extends \Magento\Framework\App\Helper\AbstractHelper
1819
{
@@ -186,19 +187,20 @@ public function getFileSize()
186187
public function getContentType()
187188
{
188189
$this->_getHandle();
189-
if ($this->_linkType == self::LINK_TYPE_FILE) {
190-
if (function_exists(
191-
'mime_content_type'
192-
) && ($contentType = mime_content_type(
193-
$this->_workingDirectory->getAbsolutePath($this->_resourceFile)
194-
))
190+
if ($this->_linkType === self::LINK_TYPE_FILE) {
191+
if (function_exists('mime_content_type')
192+
&& ($contentType = mime_content_type(
193+
$this->_workingDirectory->getAbsolutePath($this->_resourceFile)
194+
))
195195
) {
196196
return $contentType;
197-
} else {
198-
return $this->_downloadableFile->getFileType($this->_resourceFile);
199197
}
200-
} elseif ($this->_linkType == self::LINK_TYPE_URL) {
201-
return $this->_handle->stat($this->_resourceFile)['type'];
198+
return $this->_downloadableFile->getFileType($this->_resourceFile);
199+
}
200+
if ($this->_linkType === self::LINK_TYPE_URL) {
201+
return (is_array($this->_handle->stat($this->_resourceFile)['type'])
202+
? end($this->_handle->stat($this->_resourceFile)['type'])
203+
: $this->_handle->stat($this->_resourceFile)['type']);
202204
}
203205
return $this->_contentType;
204206
}
@@ -252,10 +254,21 @@ public function setResource($resourceFile, $linkType = self::LINK_TYPE_FILE)
252254
);
253255
}
254256
}
255-
257+
256258
$this->_resourceFile = $resourceFile;
259+
260+
/**
261+
* check header for urls
262+
*/
263+
if ($linkType === self::LINK_TYPE_URL) {
264+
$headers = array_change_key_case(get_headers($this->_resourceFile, 1), CASE_LOWER);
265+
if (isset($headers['location'])) {
266+
$this->_resourceFile = is_array($headers['location']) ? current($headers['location'])
267+
: $headers['location'];
268+
}
269+
}
270+
257271
$this->_linkType = $linkType;
258-
259272
return $this;
260273
}
261274

app/code/Magento/Downloadable/Model/ResourceModel/Link.php

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
*/
66
namespace Magento\Downloadable\Model\ResourceModel;
77

8-
use Magento\Catalog\Api\Data\ProductInterface;
9-
use Magento\Framework\App\ObjectManager;
10-
use Magento\Framework\EntityManager\MetadataPool;
11-
128
/**
139
* Downloadable Product Samples resource model
1410
*
@@ -17,11 +13,6 @@
1713
*/
1814
class Link extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
1915
{
20-
/**
21-
* @var MetadataPool
22-
*/
23-
private $metadataPool;
24-
2516
/**
2617
* Catalog data
2718
*
@@ -210,10 +201,7 @@ public function getSearchableData($productId, $storeId)
210201
[]
211202
)->join(
212203
['cpe' => $this->getTable('catalog_product_entity')],
213-
sprintf(
214-
'cpe.entity_id = m.product_id',
215-
$this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField()
216-
),
204+
'cpe.entity_id = m.product_id',
217205
[]
218206
)->joinLeft(
219207
['st' => $this->getTable('downloadable_link_title')],
@@ -228,22 +216,12 @@ public function getSearchableData($productId, $storeId)
228216
}
229217

230218
/**
219+
* Get Currency model.
220+
*
231221
* @return \Magento\Directory\Model\Currency
232222
*/
233223
protected function _createCurrency()
234224
{
235225
return $this->_currencyFactory->create();
236226
}
237-
238-
/**
239-
* Get MetadataPool instance
240-
* @return MetadataPool
241-
*/
242-
private function getMetadataPool()
243-
{
244-
if (!$this->metadataPool) {
245-
$this->metadataPool = ObjectManager::getInstance()->get(MetadataPool::class);
246-
}
247-
return $this->metadataPool;
248-
}
249227
}

app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private function processValidationResult($validationResult, $resultBlock)
8686
$resultBlock->addError(
8787
__('Data validation failed. Please fix the following errors and upload the file again.')
8888
);
89-
$this->addErrorMessages($resultBlock, $errorAggregator);
89+
9090
if ($errorAggregator->getErrorsCount()) {
9191
$this->addMessageToSkipErrors($resultBlock);
9292
}
@@ -100,6 +100,8 @@ private function processValidationResult($validationResult, $resultBlock)
100100
$errorAggregator->getErrorsCount()
101101
)
102102
);
103+
104+
$this->addErrorMessages($resultBlock, $errorAggregator);
103105
} else {
104106
if ($errorAggregator->getErrorsCount()) {
105107
$this->collectErrors($resultBlock);

0 commit comments

Comments
 (0)