Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.3-develop
Browse files Browse the repository at this point in the history
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
  • Loading branch information
magento-engcom-team authored Feb 15, 2019
2 parents 3b2e305 + 63a874f commit 741e610
Show file tree
Hide file tree
Showing 22 changed files with 199 additions and 93 deletions.
11 changes: 10 additions & 1 deletion app/code/Magento/Backend/Block/Template/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* the classes they were introduced for.
*
* @api
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @since 100.0.2
*/
Expand Down Expand Up @@ -173,6 +174,8 @@ public function getAuthorization()
}

/**
* Get Backend Session
*
* @return \Magento\Backend\Model\Session
*/
public function getBackendSession()
Expand All @@ -181,6 +184,8 @@ public function getBackendSession()
}

/**
* Get Math Random
*
* @return \Magento\Framework\Math\Random
*/
public function getMathRandom()
Expand All @@ -189,6 +194,8 @@ public function getMathRandom()
}

/**
* Get Form Key
*
* @return \Magento\Framework\Data\Form\FormKey
*/
public function getFormKey()
Expand All @@ -197,7 +204,9 @@ public function getFormKey()
}

/**
* @return \Magento\Framework\Data\Form\FormKey
* Get Class Name Builder
*
* @return \Magento\Framework\Code\NameBuilder
*/
public function getNameBuilder()
{
Expand Down
15 changes: 13 additions & 2 deletions app/code/Magento/Backup/Model/Backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* @method string getPath()
* @method string getName()
* @method string getTime()
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @api
* @since 100.0.2
Expand Down Expand Up @@ -80,6 +81,7 @@ class Backup extends \Magento\Framework\DataObject implements \Magento\Framework
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @param \Magento\Framework\Filesystem $filesystem
* @param array $data
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function __construct(
\Magento\Backup\Helper\Data $helper,
Expand Down Expand Up @@ -242,7 +244,7 @@ public function setFile(&$content)
/**
* Return content of backup file
*
* @return string
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function &getFile()
Expand Down Expand Up @@ -275,8 +277,9 @@ public function deleteFile()
*
* @param bool $write
* @return $this
* @throws \Magento\Framework\Exception\InputException
* @throws \Magento\Framework\Backup\Exception\NotEnoughPermissions
* @throws \Magento\Framework\Exception\FileSystemException
* @throws \Magento\Framework\Exception\InputException
*/
public function open($write = false)
{
Expand Down Expand Up @@ -330,6 +333,7 @@ protected function _getStream()
*
* @param int $length
* @return string
* @throws \Magento\Framework\Exception\InputException
*/
public function read($length)
{
Expand All @@ -340,6 +344,7 @@ public function read($length)
* Check end of file.
*
* @return bool
* @throws \Magento\Framework\Exception\InputException
*/
public function eof()
{
Expand Down Expand Up @@ -370,6 +375,7 @@ public function write($string)
* Close open backup file
*
* @return $this
* @throws \Magento\Framework\Exception\InputException
*/
public function close()
{
Expand All @@ -383,6 +389,8 @@ public function close()
* Print output
*
* @return string
* @return \Magento\Framework\Filesystem\Directory\ReadInterface|string|void
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function output()
{
Expand All @@ -398,6 +406,8 @@ public function output()
}

/**
* Get Size
*
* @return int|mixed
*/
public function getSize()
Expand All @@ -419,6 +429,7 @@ public function getSize()
*
* @param string $password
* @return bool
* @throws \Exception
*/
public function validateUserPassword($password)
{
Expand Down
23 changes: 22 additions & 1 deletion app/code/Magento/CacheInvalidate/Model/PurgeCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ private function splitTags($tagsPattern)
private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedTagsChunk)
{
$headers = [self::HEADER_X_MAGENTO_TAGS_PATTERN => $formattedTagsChunk];
$unresponsiveServerError = [];
foreach ($servers as $server) {
$headers['Host'] = $server->getHost();
try {
Expand All @@ -131,10 +132,30 @@ private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedT
$socketAdapter->read();
$socketAdapter->close();
} catch (\Exception $e) {
$this->logger->critical($e->getMessage(), compact('server', 'formattedTagsChunk'));
$unresponsiveServerError[] = "Cache host: " . $server->getHost() . ":" . $server->getPort() .
"resulted in error message: " . $e->getMessage();
}
}

$errorCount = count($unresponsiveServerError);

if ($errorCount > 0) {
$loggerMessage = implode(" ", $unresponsiveServerError);

if ($errorCount == count($servers)) {
$this->logger->critical(
'No cache server(s) could be purged ' . $loggerMessage,
compact('server', 'formattedTagsChunk')
);
return false;
}

$this->logger->warning(
'Unresponsive cache server(s) hit' . $loggerMessage,
compact('server', 'formattedTagsChunk')
);
}

$this->logger->execute(compact('servers', 'formattedTagsChunk'));
return true;
}
Expand Down
22 changes: 14 additions & 8 deletions app/code/Magento/Catalog/Block/Product/View/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
* See COPYING.txt for license details.
*/

/**
* Product options block
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\Catalog\Block\Product\View;

use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Option\Value;

/**
* Product options block
*
* @author Magento Core Team <[email protected]>
* @api
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @since 100.0.2
Expand Down Expand Up @@ -121,6 +120,8 @@ public function setProduct(Product $product = null)
}

/**
* Get group of option.
*
* @param string $type
* @return string
*/
Expand All @@ -142,6 +143,8 @@ public function getOptions()
}

/**
* Check if block has options.
*
* @return bool
*/
public function hasOptions()
Expand All @@ -160,7 +163,10 @@ public function hasOptions()
*/
protected function _getPriceConfiguration($option)
{
$optionPrice = $this->pricingHelper->currency($option->getPrice(true), false, false);
$optionPrice = $option->getPrice(true);
if ($option->getPriceType() !== Value::TYPE_PERCENT) {
$optionPrice = $this->pricingHelper->currency($optionPrice, false, false);
}
$data = [
'prices' => [
'oldPrice' => [
Expand Down Expand Up @@ -195,7 +201,7 @@ protected function _getPriceConfiguration($option)
],
],
'type' => $option->getPriceType(),
'name' => $option->getTitle()
'name' => $option->getTitle(),
];
return $data;
}
Expand Down Expand Up @@ -231,7 +237,7 @@ public function getJsonConfig()
//pass the return array encapsulated in an object for the other modules to be able to alter it eg: weee
$this->_eventManager->dispatch('catalog_product_option_price_configuration_after', ['configObj' => $configObj]);

$config=$configObj->getConfig();
$config = $configObj->getConfig();

return $this->_jsonEncoder->encode($config);
}
Expand Down
37 changes: 25 additions & 12 deletions app/code/Magento/Downloadable/Helper/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/**
* Downloadable Products Download Helper
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
*/
class Download extends \Magento\Framework\App\Helper\AbstractHelper
{
Expand Down Expand Up @@ -186,19 +187,20 @@ public function getFileSize()
public function getContentType()
{
$this->_getHandle();
if ($this->_linkType == self::LINK_TYPE_FILE) {
if (function_exists(
'mime_content_type'
) && ($contentType = mime_content_type(
$this->_workingDirectory->getAbsolutePath($this->_resourceFile)
))
if ($this->_linkType === self::LINK_TYPE_FILE) {
if (function_exists('mime_content_type')
&& ($contentType = mime_content_type(
$this->_workingDirectory->getAbsolutePath($this->_resourceFile)
))
) {
return $contentType;
} else {
return $this->_downloadableFile->getFileType($this->_resourceFile);
}
} elseif ($this->_linkType == self::LINK_TYPE_URL) {
return $this->_handle->stat($this->_resourceFile)['type'];
return $this->_downloadableFile->getFileType($this->_resourceFile);
}
if ($this->_linkType === self::LINK_TYPE_URL) {
return (is_array($this->_handle->stat($this->_resourceFile)['type'])
? end($this->_handle->stat($this->_resourceFile)['type'])
: $this->_handle->stat($this->_resourceFile)['type']);
}
return $this->_contentType;
}
Expand Down Expand Up @@ -252,10 +254,21 @@ public function setResource($resourceFile, $linkType = self::LINK_TYPE_FILE)
);
}
}

$this->_resourceFile = $resourceFile;

/**
* check header for urls
*/
if ($linkType === self::LINK_TYPE_URL) {
$headers = array_change_key_case(get_headers($this->_resourceFile, 1), CASE_LOWER);
if (isset($headers['location'])) {
$this->_resourceFile = is_array($headers['location']) ? current($headers['location'])
: $headers['location'];
}
}

$this->_linkType = $linkType;

return $this;
}

Expand Down
28 changes: 3 additions & 25 deletions app/code/Magento/Downloadable/Model/ResourceModel/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
*/
namespace Magento\Downloadable\Model\ResourceModel;

use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\EntityManager\MetadataPool;

/**
* Downloadable Product Samples resource model
*
Expand All @@ -17,11 +13,6 @@
*/
class Link extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
/**
* @var MetadataPool
*/
private $metadataPool;

/**
* Catalog data
*
Expand Down Expand Up @@ -210,10 +201,7 @@ public function getSearchableData($productId, $storeId)
[]
)->join(
['cpe' => $this->getTable('catalog_product_entity')],
sprintf(
'cpe.entity_id = m.product_id',
$this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField()
),
'cpe.entity_id = m.product_id',
[]
)->joinLeft(
['st' => $this->getTable('downloadable_link_title')],
Expand All @@ -228,22 +216,12 @@ public function getSearchableData($productId, $storeId)
}

/**
* Get Currency model.
*
* @return \Magento\Directory\Model\Currency
*/
protected function _createCurrency()
{
return $this->_currencyFactory->create();
}

/**
* Get MetadataPool instance
* @return MetadataPool
*/
private function getMetadataPool()
{
if (!$this->metadataPool) {
$this->metadataPool = ObjectManager::getInstance()->get(MetadataPool::class);
}
return $this->metadataPool;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private function processValidationResult($validationResult, $resultBlock)
$resultBlock->addError(
__('Data validation failed. Please fix the following errors and upload the file again.')
);
$this->addErrorMessages($resultBlock, $errorAggregator);

if ($errorAggregator->getErrorsCount()) {
$this->addMessageToSkipErrors($resultBlock);
}
Expand All @@ -100,6 +100,8 @@ private function processValidationResult($validationResult, $resultBlock)
$errorAggregator->getErrorsCount()
)
);

$this->addErrorMessages($resultBlock, $errorAggregator);
} else {
if ($errorAggregator->getErrorsCount()) {
$this->collectErrors($resultBlock);
Expand Down
Loading

0 comments on commit 741e610

Please sign in to comment.