Skip to content

Commit

Permalink
Merge pull request #2 from magento/2.3-develop
Browse files Browse the repository at this point in the history
Update Magento
  • Loading branch information
Dharmeshvaja91 authored Nov 27, 2018
2 parents c3a64f2 + 7d6b0d7 commit c0d3480
Show file tree
Hide file tree
Showing 248 changed files with 6,723 additions and 1,011 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ env:
- TEST_SUITE=integration INTEGRATION_INDEX=2
- TEST_SUITE=integration INTEGRATION_INDEX=3
- TEST_SUITE=functional
- TEST_SUITE=graphql-api-functional
matrix:
exclude:
- php: 7.1
Expand All @@ -43,6 +44,8 @@ matrix:
env: TEST_SUITE=js GRUNT_COMMAND=static
- php: 7.1
env: TEST_SUITE=functional
- php: 7.1
env: TEST_SUITE=graphql-api-functional
cache:
apt: true
directories:
Expand All @@ -61,5 +64,6 @@ script:

# The scripts for grunt/phpunit type tests
- if [ $TEST_SUITE == "functional" ]; then dev/tests/functional/vendor/phpunit/phpunit/phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
- if [ $TEST_SUITE != "functional" ] && [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
- if [ $TEST_SUITE != "functional" ] && [ $TEST_SUITE != "js"] && [ $TEST_SUITE != "graphql-api-functional" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
- if [ $TEST_SUITE == "js" ]; then grunt $GRUNT_COMMAND; fi
- if [ $TEST_SUITE == "graphql-api-functional" ]; then phpunit -c dev/tests/api-functional; fi
40 changes: 40 additions & 0 deletions app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Backend\Block\DataProviders;

use Magento\Framework\View\Element\Block\ArgumentInterface;
use Magento\Backend\Model\Image\UploadResizeConfigInterface;

/**
* Provides additional data for image uploader
*/
class ImageUploadConfig implements ArgumentInterface
{
/**
* @var UploadResizeConfigInterface
*/
private $imageUploadConfig;

/**
* @param UploadResizeConfigInterface $imageUploadConfig
*/
public function __construct(UploadResizeConfigInterface $imageUploadConfig)
{
$this->imageUploadConfig = $imageUploadConfig;
}

/**
* Get image resize configuration
*
* @return int
*/
public function getIsResizeEnabled(): int
{
return (int)$this->imageUploadConfig->isResizeEnabled();
}
}
22 changes: 17 additions & 5 deletions app/code/Magento/Backend/Block/Media/Uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Serialize\Serializer\Json;
use Magento\Framework\Image\Adapter\UploadConfigInterface;
use Magento\Backend\Model\Image\UploadResizeConfigInterface;

/**
* Adminhtml media library uploader
Expand Down Expand Up @@ -38,8 +39,15 @@ class Uploader extends \Magento\Backend\Block\Widget
*/
private $jsonEncoder;

/**
* @var UploadResizeConfigInterface
*/
private $imageUploadConfig;

/**
* @var UploadConfigInterface
* @deprecated
* @see \Magento\Backend\Model\Image\UploadResizeConfigInterface
*/
private $imageConfig;

Expand All @@ -49,18 +57,22 @@ class Uploader extends \Magento\Backend\Block\Widget
* @param array $data
* @param Json $jsonEncoder
* @param UploadConfigInterface $imageConfig
* @param UploadResizeConfigInterface $imageUploadConfig
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\File\Size $fileSize,
array $data = [],
Json $jsonEncoder = null,
UploadConfigInterface $imageConfig = null
UploadConfigInterface $imageConfig = null,
UploadResizeConfigInterface $imageUploadConfig = null
) {
$this->_fileSizeService = $fileSize;
$this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class);
$this->imageConfig = $imageConfig ?: ObjectManager::getInstance()->get(UploadConfigInterface::class);

$this->imageConfig = $imageConfig
?: ObjectManager::getInstance()->get(UploadConfigInterface::class);
$this->imageUploadConfig = $imageUploadConfig
?: ObjectManager::getInstance()->get(UploadResizeConfigInterface::class);
parent::__construct($context, $data);
}

Expand Down Expand Up @@ -111,7 +123,7 @@ public function getFileSizeService()
*/
public function getImageUploadMaxWidth()
{
return $this->imageConfig->getMaxWidth();
return $this->imageUploadConfig->getMaxWidth();
}

/**
Expand All @@ -121,7 +133,7 @@ public function getImageUploadMaxWidth()
*/
public function getImageUploadMaxHeight()
{
return $this->imageConfig->getMaxHeight();
return $this->imageUploadConfig->getMaxHeight();
}

/**
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Backend/Block/Widget/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ protected function _construct()
parent::_construct();

$this->setDestElementId('edit_form');
$this->setShowGlobalIcon(false);
}

/**
Expand Down
6 changes: 5 additions & 1 deletion app/code/Magento/Backend/Block/Widget/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @api
* @deprecated 100.2.0 in favour of UI component implementation
* @method string getRowClickCallback() getRowClickCallback()
* @method \Magento\Backend\Block\Widget\Grid setRowClickCallback() setRowClickCallback(string $value)
* @method \Magento\Backend\Block\Widget\Grid setRowClickCallback(string $value)
* @SuppressWarnings(PHPMD.TooManyFields)
* @since 100.0.2
*/
Expand Down Expand Up @@ -150,7 +150,10 @@ public function __construct(
}

/**
* Internal constructor, that is called from real constructor
*
* @return void
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
protected function _construct()
Expand Down Expand Up @@ -709,6 +712,7 @@ public function getGridUrl()

/**
* Grid url getter
*
* Version of getGridUrl() but with parameters
*
* @param array $params url parameters
Expand Down
38 changes: 18 additions & 20 deletions app/code/Magento/Backend/Model/AdminPathConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,39 +48,37 @@ public function __construct(
}

/**
* {@inheritdoc}
*
* @param \Magento\Framework\App\RequestInterface $request
* @return string
* @inheritdoc
*/
public function getCurrentSecureUrl(\Magento\Framework\App\RequestInterface $request)
{
return $this->url->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/');
}

/**
* {@inheritdoc}
*
* @param string $path
* @return bool
* @inheritdoc
*/
public function shouldBeSecure($path)
{
return parse_url(
(string)$this->coreConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, 'default'),
PHP_URL_SCHEME
) === 'https'
|| $this->backendConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML)
&& parse_url(
(string)$this->coreConfig->getValue(Store::XML_PATH_SECURE_BASE_URL, 'default'),
PHP_URL_SCHEME
) === 'https';
$baseUrl = (string)$this->coreConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, 'default');
if (parse_url($baseUrl, PHP_URL_SCHEME) === 'https') {
return true;
}

if ($this->backendConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML)) {
if ($this->backendConfig->isSetFlag('admin/url/use_custom')) {
$adminBaseUrl = (string)$this->coreConfig->getValue('admin/url/custom', 'default');
} else {
$adminBaseUrl = (string)$this->coreConfig->getValue(Store::XML_PATH_SECURE_BASE_URL, 'default');
}
return parse_url($adminBaseUrl, PHP_URL_SCHEME) === 'https';
}

return false;
}

/**
* {@inheritdoc}
*
* @return string
* @inheritdoc
*/
public function getDefaultPath()
{
Expand Down
72 changes: 72 additions & 0 deletions app/code/Magento/Backend/Model/Image/UploadResizeConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Backend\Model\Image;

/**
* Image uploader config provider.
*/
class UploadResizeConfig implements UploadResizeConfigInterface
{
/**
* Config path for the maximal image width value
*/
const XML_PATH_MAX_WIDTH_IMAGE = 'system/upload_configuration/max_width';

/**
* Config path for the maximal image height value
*/
const XML_PATH_MAX_HEIGHT_IMAGE = 'system/upload_configuration/max_height';

/**
* Config path for the maximal image height value
*/
const XML_PATH_ENABLE_RESIZE = 'system/upload_configuration/enable_resize';

/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
*/
private $config;

/**
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
*/
public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $config)
{
$this->config = $config;
}

/**
* Get maximal width value for resized image
*
* @return int
*/
public function getMaxWidth(): int
{
return (int)$this->config->getValue(self::XML_PATH_MAX_WIDTH_IMAGE);
}

/**
* Get maximal height value for resized image
*
* @return int
*/
public function getMaxHeight(): int
{
return (int)$this->config->getValue(self::XML_PATH_MAX_HEIGHT_IMAGE);
}

/**
* Get config value for frontend resize
*
* @return bool
*/
public function isResizeEnabled(): bool
{
return (bool)$this->config->getValue(self::XML_PATH_ENABLE_RESIZE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Backend\Model\Image;

/**
* Interface UploadResizeConfigInterface
*
* Used to retrieve configuration for frontend image uploader
*/
interface UploadResizeConfigInterface
{
/**
* Get maximal width value for resized image
*
* @return int
*/
public function getMaxWidth(): int;

/**
* Get maximal height value for resized image
*
* @return int
*/
public function getMaxHeight(): int;

/**
* Get config value for frontend resize
*
* @return bool
*/
public function isResizeEnabled(): bool;
}
Loading

0 comments on commit c0d3480

Please sign in to comment.