Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.3-develop' into 2.3-develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Dharmeshvaja91 committed Feb 21, 2019
2 parents 7320e1b + 310648c commit 0fcf041
Show file tree
Hide file tree
Showing 172 changed files with 4,293 additions and 6,617 deletions.
12 changes: 11 additions & 1 deletion app/code/Magento/Backend/Block/Template/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
* the classes they were introduced for.
*
* @api
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
* @since 100.0.2
*/
class Context extends \Magento\Framework\View\Element\Template\Context
Expand Down Expand Up @@ -173,6 +175,8 @@ public function getAuthorization()
}

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

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

/**
* Get form key instance.
*
* @return \Magento\Framework\Data\Form\FormKey
*/
public function getFormKey()
Expand All @@ -197,7 +205,9 @@ public function getFormKey()
}

/**
* @return \Magento\Framework\Data\Form\FormKey
* Get name builder instance.
*
* @return \Magento\Framework\Code\NameBuilder
*/
public function getNameBuilder()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ abstract class AbstractRenderer extends \Magento\Backend\Block\AbstractBlock imp
protected $_column;

/**
* Set column for renderer.
*
* @param Column $column
* @return $this
*/
Expand All @@ -38,6 +40,8 @@ public function setColumn($column)
}

/**
* Returns row associated with the renderer.
*
* @return Column
*/
public function getColumn()
Expand All @@ -48,7 +52,7 @@ public function getColumn()
/**
* Renders grid column
*
* @param Object $row
* @param DataObject $row
* @return string
*/
public function render(DataObject $row)
Expand All @@ -66,7 +70,7 @@ public function render(DataObject $row)
/**
* Render column for export
*
* @param Object $row
* @param DataObject $row
* @return string
*/
public function renderExport(DataObject $row)
Expand All @@ -75,7 +79,9 @@ public function renderExport(DataObject $row)
}

/**
* @param Object $row
* Returns value of the row.
*
* @param DataObject $row
* @return mixed
*/
protected function _getValue(DataObject $row)
Expand All @@ -92,7 +98,9 @@ protected function _getValue(DataObject $row)
}

/**
* @param Object $row
* Get pre-rendered input element.
*
* @param DataObject $row
* @return string
*/
public function _getInputValueElement(DataObject $row)
Expand All @@ -108,7 +116,9 @@ public function _getInputValueElement(DataObject $row)
}

/**
* @param Object $row
* Get input value by row.
*
* @param DataObject $row
* @return mixed
*/
protected function _getInputValue(DataObject $row)
Expand All @@ -117,6 +127,8 @@ protected function _getInputValue(DataObject $row)
}

/**
* Renders header of the column,
*
* @return string
*/
public function renderHeader()
Expand Down Expand Up @@ -148,6 +160,8 @@ public function renderHeader()
}

/**
* Render HTML properties.
*
* @return string
*/
public function renderProperty()
Expand All @@ -172,6 +186,8 @@ public function renderProperty()
}

/**
* Returns HTML for CSS.
*
* @return string
*/
public function renderCss()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
*/
namespace Magento\Backend\Controller\Adminhtml\Dashboard;

class ProductsViewed extends AjaxBlock
use Magento\Framework\App\Action\HttpGetActionInterface;

/**
* Get most viewed products controller.
*/
class ProductsViewed extends AjaxBlock implements HttpGetActionInterface
{
/**
* Gets most viewed products list
*
* @return \Magento\Backend\Model\View\Result\Page
* @return \Magento\Framework\Controller\Result\Raw
*/
public function execute()
{
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __get($name)
}

/**
* Checks for the existance of a property stored in the private $_attributes property
* Checks for the existence of a property stored in the private $_attributes property
*
* @ignore
* @param string $name
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
6 changes: 5 additions & 1 deletion app/code/Magento/Captcha/Observer/CheckUserLoginObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Captcha\Observer;

use Magento\Customer\Model\AuthenticationInterface;
Expand All @@ -11,7 +12,10 @@
use Magento\Customer\Api\CustomerRepositoryInterface;

/**
* Check captcha on user login page observer.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
*/
class CheckUserLoginObserver implements ObserverInterface
{
Expand Down Expand Up @@ -140,7 +144,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
$customer = $this->getCustomerRepository()->get($login);
$this->getAuthentication()->processAuthenticationFailure($customer->getId());
} catch (NoSuchEntityException $e) {
//do nothing as customer existance is validated later in authenticate method
//do nothing as customer existence is validated later in authenticate method
}
$this->messageManager->addError(__('Incorrect CAPTCHA'));
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, 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 <core@magentocommerce.com>
*/
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 <core@magentocommerce.com>
* @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
Loading

0 comments on commit 0fcf041

Please sign in to comment.