Skip to content

Commit

Permalink
Reverted:
Browse files Browse the repository at this point in the history
ECP-261 Offload Catalog Image Resizing from Magento
ECP-262 Offload Catalog Image Watermarking from Magento
ECP-263 Deprecate Rotation Support in Magento
  • Loading branch information
paliarush committed Mar 10, 2020
1 parent 06b999f commit aabff22
Show file tree
Hide file tree
Showing 33 changed files with 981 additions and 492 deletions.
4 changes: 3 additions & 1 deletion app/code/Magento/Catalog/Block/Rss/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
use Magento\Framework\Exception\NoSuchEntityException;

/**
* Category feed block
* Class Category
*
* @package Magento\Catalog\Block\Rss
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
Expand Down
28 changes: 10 additions & 18 deletions app/code/Magento/Catalog/Block/Rss/Product/NewProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
use Magento\Framework\App\Rss\DataProviderInterface;

/**
* New products feed block
* Class NewProducts
* @package Magento\Catalog\Block\Rss\Product
*/
class NewProducts extends \Magento\Framework\View\Element\AbstractBlock implements DataProviderInterface
{
Expand Down Expand Up @@ -54,8 +55,6 @@ public function __construct(
}

/**
* Init
*
* @return void
*/
protected function _construct()
Expand All @@ -65,15 +64,15 @@ protected function _construct()
}

/**
* @inheritdoc
* {@inheritdoc}
*/
public function isAllowed()
{
return $this->_scopeConfig->isSetFlag('rss/catalog/new', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
}

/**
* @inheritdoc
* {@inheritdoc}
*/
public function getRssData()
{
Expand All @@ -98,13 +97,10 @@ public function getRssData()
$item->setAllowedInRss(true);
$item->setAllowedPriceInRss(true);

$this->_eventManager->dispatch(
'rss_catalog_new_xml_callback',
[
'row' => $item->getData(),
'product' => $item
]
);
$this->_eventManager->dispatch('rss_catalog_new_xml_callback', [
'row' => $item->getData(),
'product' => $item
]);

if (!$item->getAllowedInRss()) {
continue;
Expand Down Expand Up @@ -136,8 +132,6 @@ public function getRssData()
}

/**
* Get store id
*
* @return int
*/
protected function getStoreId()
Expand Down Expand Up @@ -183,16 +177,14 @@ protected function renderPriceHtml(\Magento\Catalog\Model\Product $product)
}

/**
* @inheritdoc
* {@inheritdoc}
*/
public function getCacheLifetime()
{
return 600;
}

/**
* Get feeds
*
* @return array
*/
public function getFeeds()
Expand All @@ -207,7 +199,7 @@ public function getFeeds()
}

/**
* @inheritdoc
* {@inheritdoc}
*/
public function isAuthRequired()
{
Expand Down
15 changes: 4 additions & 11 deletions app/code/Magento/Catalog/Block/Rss/Product/Special.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
use Magento\Framework\App\Rss\DataProviderInterface;

/**
* Special products feed block
* Class Special
* @package Magento\Catalog\Block\Rss\Product
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Special extends \Magento\Framework\View\Element\AbstractBlock implements DataProviderInterface
Expand Down Expand Up @@ -97,8 +98,6 @@ public function __construct(
}

/**
* Init
*
* @return void
*/
protected function _construct()
Expand All @@ -108,8 +107,6 @@ protected function _construct()
}

/**
* Get RSS data
*
* @return array
*/
public function getRssData()
Expand Down Expand Up @@ -159,8 +156,6 @@ public function getRssData()
}

/**
* Get entry data
*
* @param \Magento\Catalog\Model\Product $item
* @return array
*/
Expand Down Expand Up @@ -250,16 +245,14 @@ public function isAllowed()
}

/**
* @inheritdoc
* {@inheritdoc}
*/
public function getCacheLifetime()
{
return 600;
}

/**
* Get feeds
*
* @return array
*/
public function getFeeds()
Expand All @@ -273,7 +266,7 @@ public function getFeeds()
}

/**
* @inheritdoc
* {@inheritdoc}
*/
public function isAuthRequired()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Magento\Framework\Exception\LocalizedException;

/**
* Upload product image action controller
* Class Upload
*/
class Upload extends \Magento\Backend\App\Action implements HttpPostActionInterface
{
Expand Down
43 changes: 8 additions & 35 deletions app/code/Magento/Catalog/Helper/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@
*/
namespace Magento\Catalog\Helper;

use Magento\Catalog\Model\Config\CatalogMediaConfig;
use Magento\Catalog\Model\View\Asset\PlaceholderFactory;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\View\Element\Block\ArgumentInterface;

/**
* Catalog image helper.
* Catalog image helper
*
* @api
* @SuppressWarnings(PHPMD.TooManyFields)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @since 100.0.2
*/
class Image extends AbstractHelper implements ArgumentInterface
Expand Down Expand Up @@ -45,15 +40,13 @@ class Image extends AbstractHelper implements ArgumentInterface
* Scheduled for rotate image
*
* @var bool
* @deprecated unused
*/
protected $_scheduleRotate = false;

/**
* Angle
*
* @var int
* @deprecated unused
*/
protected $_angle;

Expand Down Expand Up @@ -136,38 +129,31 @@ class Image extends AbstractHelper implements ArgumentInterface
protected $attributes = [];

/**
* @var PlaceholderFactory
* @var \Magento\Catalog\Model\View\Asset\PlaceholderFactory
*/
private $viewAssetPlaceholderFactory;

/**
* @var CatalogMediaConfig
*/
private $mediaConfig;

/**
* @param \Magento\Framework\App\Helper\Context $context
* @param \Magento\Catalog\Model\Product\ImageFactory $productImageFactory
* @param \Magento\Framework\View\Asset\Repository $assetRepo
* @param \Magento\Framework\View\ConfigInterface $viewConfig
* @param PlaceholderFactory $placeholderFactory
* @param CatalogMediaConfig $mediaConfig
* @param \Magento\Catalog\Model\View\Asset\PlaceholderFactory $placeholderFactory
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Catalog\Model\Product\ImageFactory $productImageFactory,
\Magento\Framework\View\Asset\Repository $assetRepo,
\Magento\Framework\View\ConfigInterface $viewConfig,
PlaceholderFactory $placeholderFactory = null,
CatalogMediaConfig $mediaConfig = null
\Magento\Catalog\Model\View\Asset\PlaceholderFactory $placeholderFactory = null
) {
$this->_productImageFactory = $productImageFactory;
parent::__construct($context);
$this->_assetRepo = $assetRepo;
$this->viewConfig = $viewConfig;
$this->viewAssetPlaceholderFactory = $placeholderFactory
?: ObjectManager::getInstance()->get(PlaceholderFactory::class);
$this->mediaConfig = $mediaConfig ?: ObjectManager::getInstance()->get(CatalogMediaConfig::class);
?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Catalog\Model\View\Asset\PlaceholderFactory::class);
}

/**
Expand Down Expand Up @@ -396,10 +382,9 @@ public function constrainOnly($flag)
*/
public function backgroundColor($colorRGB)
{
$args = func_get_args();
// assume that 3 params were given instead of array
if (!is_array($colorRGB)) {
$colorRGB = $args;
$colorRGB = func_get_args();
}
$this->_getModel()->setBackgroundColor($colorRGB);
return $this;
Expand All @@ -410,7 +395,6 @@ public function backgroundColor($colorRGB)
*
* @param int $angle
* @return $this
* @deprecated unused
*/
public function rotate($angle)
{
Expand Down Expand Up @@ -542,16 +526,7 @@ protected function isScheduledActionsAllowed()
public function getUrl()
{
try {
switch ($this->mediaConfig->getMediaUrlFormat()) {
case CatalogMediaConfig::IMAGE_OPTIMIZATION_PARAMETERS:
$this->initBaseFile();
break;
case CatalogMediaConfig::HASH:
$this->applyScheduledActions();
break;
default:
throw new LocalizedException(__("The specified Catalog media URL format is not supported."));
}
$this->applyScheduledActions();
return $this->_getModel()->getUrl();
} catch (\Exception $e) {
return $this->getDefaultPlaceholderUrl();
Expand Down Expand Up @@ -620,7 +595,6 @@ protected function _getModel()
*
* @param int $angle
* @return $this
* @deprecated unused
*/
protected function setAngle($angle)
{
Expand All @@ -632,7 +606,6 @@ protected function setAngle($angle)
* Get Rotation Angle
*
* @return int
* @deprecated unused
*/
protected function getAngle()
{
Expand Down
50 changes: 0 additions & 50 deletions app/code/Magento/Catalog/Model/Config/CatalogMediaConfig.php

This file was deleted.

This file was deleted.

Loading

0 comments on commit aabff22

Please sign in to comment.