Skip to content

Commit 5c6d4ba

Browse files
author
Oleksandr Iegorov
committed
Merge branch '2.3-develop' of https://github.com/magento/magento2ce into MAGETWO-98328
2 parents 0a56988 + 310648c commit 5c6d4ba

File tree

81 files changed

+2625
-1695
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2625
-1695
lines changed

app/code/Magento/Backend/Block/Template/Context.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* @api
2020
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2121
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
22+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2223
* @since 100.0.2
2324
*/
2425
class Context extends \Magento\Framework\View\Element\Template\Context
@@ -174,7 +175,7 @@ public function getAuthorization()
174175
}
175176

176177
/**
177-
* Get Backend Session
178+
* Get backend session instance.
178179
*
179180
* @return \Magento\Backend\Model\Session
180181
*/
@@ -184,7 +185,7 @@ public function getBackendSession()
184185
}
185186

186187
/**
187-
* Get Math Random
188+
* Get math random instance.
188189
*
189190
* @return \Magento\Framework\Math\Random
190191
*/
@@ -194,7 +195,7 @@ public function getMathRandom()
194195
}
195196

196197
/**
197-
* Get Form Key
198+
* Get form key instance.
198199
*
199200
* @return \Magento\Framework\Data\Form\FormKey
200201
*/
@@ -204,7 +205,7 @@ public function getFormKey()
204205
}
205206

206207
/**
207-
* Get Class Name Builder
208+
* Get name builder instance.
208209
*
209210
* @return \Magento\Framework\Code\NameBuilder
210211
*/

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ abstract class AbstractRenderer extends \Magento\Backend\Block\AbstractBlock imp
2828
protected $_column;
2929

3030
/**
31+
* Set column for renderer.
32+
*
3133
* @param Column $column
3234
* @return $this
3335
*/
@@ -38,6 +40,8 @@ public function setColumn($column)
3840
}
3941

4042
/**
43+
* Returns row associated with the renderer.
44+
*
4145
* @return Column
4246
*/
4347
public function getColumn()
@@ -48,7 +52,7 @@ public function getColumn()
4852
/**
4953
* Renders grid column
5054
*
51-
* @param Object $row
55+
* @param DataObject $row
5256
* @return string
5357
*/
5458
public function render(DataObject $row)
@@ -66,7 +70,7 @@ public function render(DataObject $row)
6670
/**
6771
* Render column for export
6872
*
69-
* @param Object $row
73+
* @param DataObject $row
7074
* @return string
7175
*/
7276
public function renderExport(DataObject $row)
@@ -75,7 +79,9 @@ public function renderExport(DataObject $row)
7579
}
7680

7781
/**
78-
* @param Object $row
82+
* Returns value of the row.
83+
*
84+
* @param DataObject $row
7985
* @return mixed
8086
*/
8187
protected function _getValue(DataObject $row)
@@ -92,7 +98,9 @@ protected function _getValue(DataObject $row)
9298
}
9399

94100
/**
95-
* @param Object $row
101+
* Get pre-rendered input element.
102+
*
103+
* @param DataObject $row
96104
* @return string
97105
*/
98106
public function _getInputValueElement(DataObject $row)
@@ -108,7 +116,9 @@ public function _getInputValueElement(DataObject $row)
108116
}
109117

110118
/**
111-
* @param Object $row
119+
* Get input value by row.
120+
*
121+
* @param DataObject $row
112122
* @return mixed
113123
*/
114124
protected function _getInputValue(DataObject $row)
@@ -117,6 +127,8 @@ protected function _getInputValue(DataObject $row)
117127
}
118128

119129
/**
130+
* Renders header of the column,
131+
*
120132
* @return string
121133
*/
122134
public function renderHeader()
@@ -148,6 +160,8 @@ public function renderHeader()
148160
}
149161

150162
/**
163+
* Render HTML properties.
164+
*
151165
* @return string
152166
*/
153167
public function renderProperty()
@@ -172,6 +186,8 @@ public function renderProperty()
172186
}
173187

174188
/**
189+
* Returns HTML for CSS.
190+
*
175191
* @return string
176192
*/
177193
public function renderCss()

app/code/Magento/Backend/Controller/Adminhtml/Dashboard/ProductsViewed.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@
66
*/
77
namespace Magento\Backend\Controller\Adminhtml\Dashboard;
88

9-
class ProductsViewed extends AjaxBlock
9+
use Magento\Framework\App\Action\HttpGetActionInterface;
10+
11+
/**
12+
* Get most viewed products controller.
13+
*/
14+
class ProductsViewed extends AjaxBlock implements HttpGetActionInterface
1015
{
1116
/**
1217
* Gets most viewed products list
1318
*
14-
* @return \Magento\Backend\Model\View\Result\Page
19+
* @return \Magento\Framework\Controller\Result\Raw
1520
*/
1621
public function execute()
1722
{

app/code/Magento/Catalog/Test/Unit/Model/ProductOptions/Config/_files/invalidProductOptionsXmlArray.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
],
3030
],
3131
'renderer_attribute_with_invalid_value' => [
32-
'<?xml version="1.0"?><config><option name="name_one" renderer="true12"><inputType name="name_one"/>' .
32+
'<?xml version="1.0"?><config><option name="name_one" renderer="123true"><inputType name="name_one"/>' .
3333
'</option></config>',
3434
[
35-
"Element 'option', attribute 'renderer': [facet 'pattern'] The value 'true12' is not accepted by the " .
36-
"pattern '[a-zA-Z_\\\\]+'.\nLine: 1\n",
37-
"Element 'option', attribute 'renderer': 'true12' is not a valid value of the atomic" .
35+
"Element 'option', attribute 'renderer': [facet 'pattern'] The value '123true' is not accepted by the " .
36+
"pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
37+
"Element 'option', attribute 'renderer': '123true' is not a valid value of the atomic" .
3838
" type 'modelName'.\nLine: 1\n"
3939
],
4040
],

app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/invalidProductTypesXmlArray.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
'<?xml version="1.0"?><config><type name="some_name" modelInstance="123" /></config>',
2424
[
2525
"Element 'type', attribute 'modelInstance': [facet 'pattern'] The value '123' is not accepted by the" .
26-
" pattern '[a-zA-Z_\\\\]+'.\nLine: 1\n",
26+
" pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
2727
"Element 'type', attribute 'modelInstance': '123' is not a valid value of the atomic type" .
2828
" 'modelName'.\nLine: 1\n"
2929
],
@@ -57,7 +57,7 @@
5757
'<?xml version="1.0"?><config><type name="some_name"><priceModel instance="123123" /></type></config>',
5858
[
5959
"Element 'priceModel', attribute 'instance': [facet 'pattern'] The value '123123' is not accepted " .
60-
"by the pattern '[a-zA-Z_\\\\]+'.\nLine: 1\n",
60+
"by the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
6161
"Element 'priceModel', attribute 'instance': '123123' is not a valid value of the atomic type" .
6262
" 'modelName'.\nLine: 1\n"
6363
],
@@ -66,7 +66,7 @@
6666
'<?xml version="1.0"?><config><type name="some_name"><indexerModel instance="123" /></type></config>',
6767
[
6868
"Element 'indexerModel', attribute 'instance': [facet 'pattern'] The value '123' is not accepted by " .
69-
"the pattern '[a-zA-Z_\\\\]+'.\nLine: 1\n",
69+
"the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
7070
"Element 'indexerModel', attribute 'instance': '123' is not a valid value of the atomic type" .
7171
" 'modelName'.\nLine: 1\n"
7272
],
@@ -83,7 +83,7 @@
8383
'<?xml version="1.0"?><config><type name="some_name"><stockIndexerModel instance="1234"/></type></config>',
8484
[
8585
"Element 'stockIndexerModel', attribute 'instance': [facet 'pattern'] The value '1234' is not " .
86-
"accepted by the pattern '[a-zA-Z_\\\\]+'.\nLine: 1\n",
86+
"accepted by the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
8787
"Element 'stockIndexerModel', attribute 'instance': '1234' is not a valid value of the atomic " .
8888
"type 'modelName'.\nLine: 1\n"
8989
],

app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types_merged.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
<stockIndexerModel instance="instance_name"/>
1616
</type>
1717
<type label="some_label" name="some_name2" modelInstance="model_name">
18+
<allowedSelectionTypes>
19+
<type name="some_name" />
20+
</allowedSelectionTypes>
21+
<priceModel instance="instance_name_with_digits_123" />
22+
<indexerModel instance="instance_name_with_digits_123" />
23+
<stockIndexerModel instance="instance_name_with_digits_123"/>
24+
</type>
25+
<type label="some_label" name="some_name3" modelInstance="model_name">
1826
<allowedSelectionTypes>
1927
<type name="some_name" />
2028
</allowedSelectionTypes>
@@ -25,5 +33,6 @@
2533
<composableTypes>
2634
<type name="some_name"/>
2735
<type name="some_name2"/>
36+
<type name="some_name3"/>
2837
</composableTypes>
2938
</config>

app/code/Magento/Catalog/etc/product_options.xsd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@
6161
<xs:simpleType name="modelName">
6262
<xs:annotation>
6363
<xs:documentation>
64-
Model name can contain only [a-zA-Z_\\].
64+
Model name can contain only ([\\]?[a-zA-Z_][a-zA-Z0-9_]*)+.
6565
</xs:documentation>
6666
</xs:annotation>
6767
<xs:restriction base="xs:string">
68-
<xs:pattern value="[a-zA-Z_\\]+" />
68+
<xs:pattern value="([\\]?[a-zA-Z_][a-zA-Z0-9_]*)+" />
6969
</xs:restriction>
7070
</xs:simpleType>
7171
</xs:schema>

app/code/Magento/Catalog/etc/product_types_base.xsd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@
9292
<xs:simpleType name="modelName">
9393
<xs:annotation>
9494
<xs:documentation>
95-
Model name can contain only [a-zA-Z_\\].
95+
Model name can contain only ([\\]?[a-zA-Z_][a-zA-Z0-9_]*)+.
9696
</xs:documentation>
9797
</xs:annotation>
9898
<xs:restriction base="xs:string">
99-
<xs:pattern value="[a-zA-Z_\\]+" />
99+
<xs:pattern value="([\\]?[a-zA-Z_][a-zA-Z0-9_]*)+" />
100100
</xs:restriction>
101101
</xs:simpleType>
102102
</xs:schema>

app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Aggregation/DataProvider/SelectBuilderForAttribute.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ public function __construct(
7474
}
7575

7676
/**
77+
* Build select for attribute search
78+
*
7779
* @param Select $select
7880
* @param AbstractAttribute $attribute
7981
* @param int $currentScope
@@ -101,7 +103,7 @@ public function build(Select $select, AbstractAttribute $attribute, int $current
101103
$subSelect = $select;
102104
$subSelect->from(['main_table' => $table], ['main_table.entity_id', 'main_table.value'])
103105
->distinct()
104-
->where('main_table.attribute_id = ?', $attribute->getAttributeId())
106+
->where('main_table.attribute_id = ?', (int) $attribute->getAttributeId())
105107
->where('main_table.store_id = ? ', $currentScopeId);
106108
if ($this->isAddStockFilter()) {
107109
$subSelect = $this->applyStockConditionToSelect->execute($subSelect);
@@ -116,6 +118,8 @@ public function build(Select $select, AbstractAttribute $attribute, int $current
116118
}
117119

118120
/**
121+
* Is add stock filter
122+
*
119123
* @return bool
120124
*/
121125
private function isAddStockFilter()

app/code/Magento/Cron/Model/Schedule.php

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Framework\Exception\CronException;
1010
use Magento\Framework\App\ObjectManager;
1111
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
12+
use Magento\Framework\Intl\DateTimeFactory;
1213

1314
/**
1415
* Crontab schedule model
@@ -50,24 +51,32 @@ class Schedule extends \Magento\Framework\Model\AbstractModel
5051
*/
5152
private $timezoneConverter;
5253

54+
/**
55+
* @var DateTimeFactory
56+
*/
57+
private $dateTimeFactory;
58+
5359
/**
5460
* @param \Magento\Framework\Model\Context $context
5561
* @param \Magento\Framework\Registry $registry
5662
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
5763
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
5864
* @param array $data
59-
* @param TimezoneInterface $timezoneConverter
65+
* @param TimezoneInterface|null $timezoneConverter
66+
* @param DateTimeFactory|null $dateTimeFactory
6067
*/
6168
public function __construct(
6269
\Magento\Framework\Model\Context $context,
6370
\Magento\Framework\Registry $registry,
6471
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
6572
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
6673
array $data = [],
67-
TimezoneInterface $timezoneConverter = null
74+
TimezoneInterface $timezoneConverter = null,
75+
DateTimeFactory $dateTimeFactory = null
6876
) {
6977
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
7078
$this->timezoneConverter = $timezoneConverter ?: ObjectManager::getInstance()->get(TimezoneInterface::class);
79+
$this->dateTimeFactory = $dateTimeFactory ?: ObjectManager::getInstance()->get(DateTimeFactory::class);
7180
}
7281

7382
/**
@@ -111,17 +120,20 @@ public function trySchedule()
111120
if (!$e || !$time) {
112121
return false;
113122
}
123+
$configTimeZone = $this->timezoneConverter->getConfigTimezone();
124+
$storeDateTime = $this->dateTimeFactory->create(null, new \DateTimeZone($configTimeZone));
114125
if (!is_numeric($time)) {
115126
//convert time from UTC to admin store timezone
116127
//we assume that all schedules in configuration (crontab.xml and DB tables) are in admin store timezone
117-
$time = $this->timezoneConverter->date($time)->format('Y-m-d H:i');
118-
$time = strtotime($time);
128+
$dateTimeUtc = $this->dateTimeFactory->create($time);
129+
$time = $dateTimeUtc->getTimestamp();
119130
}
120-
$match = $this->matchCronExpression($e[0], strftime('%M', $time))
121-
&& $this->matchCronExpression($e[1], strftime('%H', $time))
122-
&& $this->matchCronExpression($e[2], strftime('%d', $time))
123-
&& $this->matchCronExpression($e[3], strftime('%m', $time))
124-
&& $this->matchCronExpression($e[4], strftime('%w', $time));
131+
$time = $storeDateTime->setTimestamp($time);
132+
$match = $this->matchCronExpression($e[0], $time->format('i'))
133+
&& $this->matchCronExpression($e[1], $time->format('H'))
134+
&& $this->matchCronExpression($e[2], $time->format('d'))
135+
&& $this->matchCronExpression($e[3], $time->format('m'))
136+
&& $this->matchCronExpression($e[4], $time->format('w'));
125137

126138
return $match;
127139
}

0 commit comments

Comments
 (0)