Skip to content

Commit

Permalink
Merge branch '2.3-develop' into forwardport-2.3-develop-magento-magen…
Browse files Browse the repository at this point in the history
…to2-11539

# Conflicts:
#	lib/web/mage/adminhtml/form.js
  • Loading branch information
magento-engcom-team committed Mar 2, 2018
2 parents 9775cd8 + 0f61d2d commit e10a3ff
Show file tree
Hide file tree
Showing 1,689 changed files with 41,259 additions and 21,081 deletions.
4 changes: 2 additions & 2 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

/**
* Pre-commit hook installation:
* vendor/bin/static-review.php hook:install dev/tools/Magento/Tools/StaticReview/pre-commit .git/hooks/pre-commit
* PHP Coding Standards fixer configuration
*/

$finder = PhpCsFixer\Finder::create()
->name('*.phtml')
->exclude('dev/tests/functional/generated')
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=develop)](https://travis-ci.org/magento/magento2)
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=2.3-develop)](https://travis-ci.org/magento/magento2)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.png)](https://crowdin.com/project/magento-2)
<h2>Welcome</h2>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AdminNotification/etc/db_schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:setup:Model/Declaration/Schema/etc/schema.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="adminnotification_inbox" resource="default" engine="innodb" comment="Adminnotification Inbox">
<column xsi:type="int" name="notification_id" padding="10" unsigned="true" nullable="false" identity="true"
comment="Notification id"/>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AdminNotification/etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_AdminNotification" setup_version="2.0.0">
<module name="Magento_AdminNotification" >
<sequence>
<module name="Magento_Store"/>
</sequence>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_AdvancedPricingImportExport" setup_version="2.0.0">
<module name="Magento_AdvancedPricingImportExport" >
</module>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,45 @@
*/
namespace Magento\Analytics\Block\Adminhtml\System\Config;

use Magento\Framework\App\ObjectManager;

/**
* Provides label with default Time Zone
*/
class CollectionTimeLabel extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* Add default time zone to comment
* @var \Magento\Framework\Locale\ResolverInterface
*/
private $localeResolver;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
* @param \Magento\Framework\Locale\ResolverInterface|null $localeResolver
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
array $data = [],
\Magento\Framework\Locale\ResolverInterface $localeResolver = null
) {
$this->localeResolver = $localeResolver ?:
ObjectManager::getInstance()->get(\Magento\Framework\Locale\ResolverInterface::class);
parent::__construct($context, $data);
}

/**
* Add current time zone to comment, properly translated according to locale
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$timeZoneCode = $this->_localeDate->getConfigTimezone();
$getLongTimeZoneName = \IntlTimeZone::createTimeZone($timeZoneCode)->getDisplayName();
$locale = $this->localeResolver->getLocale();
$getLongTimeZoneName = \IntlTimeZone::createTimeZone($timeZoneCode)
->getDisplayName(false, \IntlTimeZone::DISPLAY_LONG, $locale);
$element->setData(
'comment',
sprintf("%s (%s)", $getLongTimeZoneName, $timeZoneCode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public function afterSave()
$result = preg_match('#(?<hour>\d{2}),(?<min>\d{2}),(?<sec>\d{2})#', $this->getValue(), $time);

if (!$result) {
throw new LocalizedException(__('Time value has an unsupported format'));
throw new LocalizedException(
__('The time value is using an unsupported format. Enter a supported format and try again.')
);
}

$cronExprArray = [
Expand Down
13 changes: 9 additions & 4 deletions app/code/Magento/Analytics/Model/Cryptographer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,18 @@ public function encode($source)
try {
$source = (string)$source;
} catch (\Exception $e) {
throw new LocalizedException(__('Input data must be string or convertible into string.'));
throw new LocalizedException(
__(
'The data is invalid. '
. 'Enter the data as a string or data that can be converted into a string and try again.'
)
);
}
} elseif (!$source) {
throw new LocalizedException(__('Input data must be non-empty string.'));
throw new LocalizedException(__('The data is invalid. Enter the data as a string and try again.'));
}
if (!$this->validateCipherMethod($this->cipherMethod)) {
throw new LocalizedException(__('Not valid cipher method.'));
throw new LocalizedException(__('The data is invalid. Use a valid cipher method and try again.'));
}
$initializationVector = $this->getInitializationVector();

Expand Down Expand Up @@ -90,7 +95,7 @@ private function getKey()
{
$token = $this->analyticsToken->getToken();
if (!$token) {
throw new LocalizedException(__('Encryption key can\'t be empty.'));
throw new LocalizedException(__('Enter the encryption key and try again.'));
}
return hash('sha256', $token);
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Analytics/Model/ExportDataHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private function pack($source, $destination)
private function validateSource(WriteInterface $directory, $path)
{
if (!$directory->isExist($path)) {
throw new LocalizedException(__('Source "%1" is not exist', $directory->getAbsolutePath($path)));
throw new LocalizedException(__('The "%1" source doesn\'t exist.', $directory->getAbsolutePath($path)));
}

return $directory->getAbsolutePath($path);
Expand Down
52 changes: 0 additions & 52 deletions app/code/Magento/Analytics/Setup/InstallData.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Analytics\Setup\Patch\Data;

use Magento\Analytics\Model\Config\Backend\Enabled\SubscriptionHandler;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;

/**
* Initial patch.
*
* @package Magento\Analytics\Setup\Patch
*/
class PrepareInitialConfig implements DataPatchInterface, PatchVersionInterface
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;

/**
* PrepareInitialConfig constructor.
* @param ModuleDataSetupInterface $moduleDataSetup
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup
) {
$this->moduleDataSetup = $moduleDataSetup;
}

/**
* {@inheritdoc}
*/
public function apply()
{
$this->moduleDataSetup->getConnection()->insertMultiple(
$this->moduleDataSetup->getTable('core_config_data'),
[
[
'scope' => 'default',
'scope_id' => 0,
'path' => 'analytics/subscription/enabled',
'value' => 1
],
[
'scope' => 'default',
'scope_id' => 0,
'path' => SubscriptionHandler::CRON_STRING_PATH,
'value' => join(' ', SubscriptionHandler::CRON_EXPR_ARRAY)
]
]
);

$this->moduleDataSetup->getConnection()->insert(
$this->moduleDataSetup->getTable('flag'),
[
'flag_code' => SubscriptionHandler::ATTEMPTS_REVERSE_COUNTER_FLAG_CODE,
'state' => 0,
'flag_data' => 24,
]
);
}

/**
* {@inheritdoc}
*/
public static function getDependencies()
{
return [];
}

/**
* {@inheritdoc}
*/
public static function getVersion()
{
return '2.0.0';
}

/**
* {@inheritdoc}
*/
public function getAliases()
{
return [];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Magento\Backend\Block\Template\Context;
use Magento\Framework\Data\Form;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Locale\ResolverInterface;
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;

Expand All @@ -34,6 +35,11 @@ class CollectionTimeLabelTest extends \PHPUnit\Framework\TestCase
*/
private $abstractElementMock;

/**
* @var ResolverInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $localeResolver;

protected function setUp()
{
$this->abstractElementMock = $this->getMockBuilder(AbstractElement::class)
Expand All @@ -53,12 +59,17 @@ protected function setUp()
$this->contextMock->expects($this->any())
->method('getLocaleDate')
->willReturn($this->timeZoneMock);
$this->localeResolver = $this->getMockBuilder(ResolverInterface::class)
->disableOriginalConstructor()
->setMethods(['getLocale'])
->getMockForAbstractClass();

$objectManager = new ObjectManager($this);
$this->collectionTimeLabel = $objectManager->getObject(
CollectionTimeLabel::class,
[
'context' => $this->contextMock
'context' => $this->contextMock,
'localeResolver' => $this->localeResolver
]
);
}
Expand All @@ -73,6 +84,9 @@ public function testRender()
$this->abstractElementMock->expects($this->any())
->method('getComment')
->willReturn('Eastern Standard Time (America/New_York)');
$this->localeResolver->expects($this->once())
->method('getLocale')
->willReturn('en_US');
$this->assertRegexp(
"/Eastern Standard Time \(America\/New_York\)/",
$this->collectionTimeLabel->render($this->abstractElementMock)
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Analytics/etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_Analytics" setup_version="2.0.0">
<module name="Magento_Analytics" >
<sequence>
<module name="Magento_Integration"/>
<module name="Magento_Backend"/>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Authorization/Model/Acl/AclRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function getAllowedResourcesByUser($userType, $userId)
$role = $this->_getUserRole($userType, $userId);
if (!$role) {
throw new AuthorizationException(
__('We can\'t find the role for the user you wanted.')
__("The role wasn't found for the user. Verify the role and try again.")
);
}
$allowedResources = $this->getAllowedResourcesByRole($role->getId());
Expand Down
Loading

0 comments on commit e10a3ff

Please sign in to comment.