Skip to content

Commit 59b3d72

Browse files
authored
Merge pull request #4120 from magento-performance/Performance-PR-2.3.2
MAGETWO-99418: Deliver critical PR for 2.3.2
2 parents f1da369 + 74f2369 commit 59b3d72

File tree

26 files changed

+294
-183
lines changed

26 files changed

+294
-183
lines changed

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@
182182
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
183183
<comment>Minification is not applied in developer mode.</comment>
184184
</field>
185+
<field id="move_inline_to_bottom" translate="label" type="select" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
186+
<label>Move JS code to the bottom of the page</label>
187+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
188+
</field>
185189
</group>
186190
<group id="css" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
187191
<label>CSS Settings</label>

app/code/Magento/Config/Model/Config.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class Config extends \Magento\Framework\DataObject
115115
private $scopeTypeNormalizer;
116116

117117
/**
118-
* @var \Magento\MessageQueue\Api\PoisonPillPutInterface
118+
* @var \Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface
119119
*/
120120
private $pillPut;
121121

@@ -131,7 +131,7 @@ class Config extends \Magento\Framework\DataObject
131131
* @param array $data
132132
* @param ScopeResolverPool|null $scopeResolverPool
133133
* @param ScopeTypeNormalizer|null $scopeTypeNormalizer
134-
* @param \Magento\MessageQueue\Api\PoisonPillPutInterface|null $pillPut
134+
* @param \Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface|null $pillPut
135135
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
136136
*/
137137
public function __construct(
@@ -146,7 +146,7 @@ public function __construct(
146146
array $data = [],
147147
ScopeResolverPool $scopeResolverPool = null,
148148
ScopeTypeNormalizer $scopeTypeNormalizer = null,
149-
\Magento\MessageQueue\Api\PoisonPillPutInterface $pillPut = null
149+
\Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface $pillPut = null
150150
) {
151151
parent::__construct($data);
152152
$this->_eventManager = $eventManager;
@@ -163,7 +163,7 @@ public function __construct(
163163
$this->scopeTypeNormalizer = $scopeTypeNormalizer
164164
?? ObjectManager::getInstance()->get(ScopeTypeNormalizer::class);
165165
$this->pillPut = $pillPut ?: \Magento\Framework\App\ObjectManager::getInstance()
166-
->get(\Magento\MessageQueue\Api\PoisonPillPutInterface::class);
166+
->get(\Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface::class);
167167
}
168168

169169
/**

app/code/Magento/Config/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"require": {
88
"php": "~7.1.3||~7.2.0",
99
"magento/framework": "*",
10-
"magento/module-message-queue": "*",
1110
"magento/module-backend": "*",
1211
"magento/module-cron": "*",
1312
"magento/module-deploy": "*",

app/code/Magento/MessageQueue/Model/CallbackInvoker.php

Lines changed: 0 additions & 66 deletions
This file was deleted.

app/code/Magento/MessageQueue/Model/PoisonPillCompare.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
namespace Magento\MessageQueue\Model;
99

10-
use Magento\MessageQueue\Api\PoisonPillCompareInterface;
11-
use Magento\MessageQueue\Api\PoisonPillReadInterface;
10+
use Magento\Framework\MessageQueue\PoisonPill\PoisonPillCompareInterface;
11+
use Magento\Framework\MessageQueue\PoisonPill\PoisonPillReadInterface;
1212

1313
/**
1414
* Poison pill compare
@@ -33,7 +33,7 @@ public function __construct(
3333
/**
3434
* @inheritdoc
3535
*/
36-
public function isLatestVersion(int $poisonPillVersion): bool
36+
public function isLatestVersion(string $poisonPillVersion): bool
3737
{
3838
return $poisonPillVersion === $this->poisonPillRead->getLatestVersion();
3939
}

app/code/Magento/MessageQueue/Model/ResourceModel/PoisonPill.php

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77

88
namespace Magento\MessageQueue\Model\ResourceModel;
99

10-
use Magento\MessageQueue\Api\PoisonPillReadInterface;
11-
use Magento\MessageQueue\Api\PoisonPillPutInterface;
12-
use Magento\Framework\Model\ResourceModel\Db\Context;
10+
use Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface;
11+
use Magento\Framework\MessageQueue\PoisonPill\PoisonPillReadInterface;
1312
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
1413

1514
/**
16-
* PoisonPill.
15+
* PoisonPill class that enclose read and put interface.
1716
*/
1817
class PoisonPill extends AbstractDb implements PoisonPillPutInterface, PoisonPillReadInterface
1918
{
@@ -22,19 +21,6 @@ class PoisonPill extends AbstractDb implements PoisonPillPutInterface, PoisonPil
2221
*/
2322
const QUEUE_POISON_PILL_TABLE = 'queue_poison_pill';
2423

25-
/**
26-
* PoisonPill constructor.
27-
*
28-
* @param Context $context
29-
* @param string|null $connectionName
30-
*/
31-
public function __construct(
32-
Context $context,
33-
string $connectionName = null
34-
) {
35-
parent::__construct($context, $connectionName);
36-
}
37-
3824
/**
3925
* @inheritdoc
4026
*/
@@ -46,30 +32,43 @@ protected function _construct()
4632
/**
4733
* @inheritdoc
4834
*/
49-
public function put(): int
35+
public function put(): string
5036
{
5137
$connection = $this->getConnection();
5238
$table = $this->getMainTable();
53-
$connection->insert($table, []);
54-
return (int)$connection->lastInsertId($table);
39+
$uuid = uniqid('version-');
40+
$version = $this->getVersionFromDb();
41+
if ($version !== '') {
42+
$connection->update($table, ['version' => $uuid]);
43+
} else {
44+
$connection->insert($table, ['version' => $uuid]);
45+
}
46+
47+
return $uuid;
5548
}
5649

5750
/**
5851
* @inheritdoc
5952
*/
60-
public function getLatestVersion() : int
53+
public function getLatestVersion(): string
54+
{
55+
return $this->getVersionFromDb();
56+
}
57+
58+
/**
59+
* Returns version form DB or null.
60+
*
61+
* @return string
62+
*/
63+
private function getVersionFromDb(): string
6164
{
6265
$select = $this->getConnection()->select()->from(
6366
$this->getTable(self::QUEUE_POISON_PILL_TABLE),
6467
'version'
65-
)->order(
66-
'version ' . \Magento\Framework\DB\Select::SQL_DESC
67-
)->limit(
68-
1
6968
);
7069

71-
$version = (int)$this->getConnection()->fetchOne($select);
70+
$result = $this->getConnection()->fetchOne($select);
7271

73-
return $version;
72+
return (string)$result;
7473
}
7574
}

app/code/Magento/MessageQueue/etc/db_schema.xml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@
2121
<column name="message_code"/>
2222
</constraint>
2323
</table>
24-
<table name="queue_poison_pill" resource="default" engine="innodb"
25-
comment="Sequence table for poison pill versions">
26-
<column xsi:type="int" name="version" padding="10" unsigned="true" nullable="false" identity="true"
27-
comment="Poison Pill version."/>
28-
<constraint xsi:type="primary" referenceId="PRIMARY">
29-
<column name="version"/>
30-
</constraint>
24+
<table name="queue_poison_pill" resource="default" engine="innodb" comment="Sequence table for poison pill versions">
25+
<column xsi:type="varchar" name="version" length="255" nullable="false" comment="Poison Pill version."/>
3126
</table>
3227
</schema>

app/code/Magento/MessageQueue/etc/db_schema_whitelist.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
"queue_poison_pill": {
1414
"column": {
1515
"version": true
16-
},
17-
"constraint": {
18-
"PRIMARY": true
1916
}
2017
}
2118
}

app/code/Magento/MessageQueue/etc/di.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
<preference for="Magento\Framework\MessageQueue\EnvelopeInterface" type="Magento\Framework\MessageQueue\Envelope"/>
1414
<preference for="Magento\Framework\MessageQueue\ConsumerInterface" type="Magento\Framework\MessageQueue\Consumer"/>
1515
<preference for="Magento\Framework\MessageQueue\MergedMessageInterface" type="Magento\Framework\MessageQueue\MergedMessage"/>
16-
<preference for="Magento\MessageQueue\Api\PoisonPillCompareInterface" type="Magento\MessageQueue\Model\PoisonPillCompare"/>
17-
<preference for="Magento\MessageQueue\Api\PoisonPillPutInterface" type="Magento\MessageQueue\Model\ResourceModel\PoisonPill"/>
18-
<preference for="Magento\MessageQueue\Api\PoisonPillReadInterface" type="Magento\MessageQueue\Model\ResourceModel\PoisonPill"/>
19-
<preference for="Magento\Framework\MessageQueue\CallbackInvokerInterface" type="Magento\MessageQueue\Model\CallbackInvoker"/>
16+
<preference for="Magento\Framework\MessageQueue\PoisonPill\PoisonPillCompareInterface" type="Magento\MessageQueue\Model\PoisonPillCompare"/>
17+
<preference for="Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface" type="Magento\MessageQueue\Model\ResourceModel\PoisonPill"/>
18+
<preference for="Magento\Framework\MessageQueue\PoisonPill\PoisonPillReadInterface" type="Magento\MessageQueue\Model\ResourceModel\PoisonPill"/>
2019
<type name="Magento\Framework\Console\CommandListInterface">
2120
<arguments>
2221
<argument name="commands" xsi:type="array">

app/code/Magento/Search/view/frontend/templates/form.mini.phtml

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,26 @@ $helper = $this->helper(\Magento\Search\Helper\Data::class);
1616
<div class="block block-content">
1717
<form class="form minisearch" id="search_mini_form" action="<?= /* @escapeNotVerified */ $helper->getResultUrl() ?>" method="get">
1818
<div class="field search">
19+
<label class="label" for="search" data-role="minisearch-label">
20+
<span><?= /* @escapeNotVerified */ __('Search') ?></span>
21+
</label>
1922
<div class="control">
20-
<label for="search" data-role="minisearch-label">
21-
<span class="label">
22-
<?= /* @escapeNotVerified */ __('Search') ?>
23-
</span>
24-
<input
25-
aria-expanded="false"
26-
id="search"
27-
data-mage-init='{"quickSearch":{
23+
<input id="search"
24+
data-mage-init='{"quickSearch":{
2825
"formSelector":"#search_mini_form",
2926
"url":"<?= /* @escapeNotVerified */ $helper->getSuggestUrl()?>",
3027
"destinationSelector":"#search_autocomplete"}
31-
}'
32-
type="text"
33-
name="<?= /* @escapeNotVerified */ $helper->getQueryParamName() ?>"
34-
value="<?= /* @escapeNotVerified */ $helper->getEscapedQueryText() ?>"
35-
placeholder="<?= /* @escapeNotVerified */ __('Search entire store here...') ?>"
36-
class="input-text"
37-
maxlength="<?= /* @escapeNotVerified */ $helper->getMaxQueryLength() ?>"
38-
role="combobox"
39-
aria-haspopup="false"
40-
aria-autocomplete="both"
41-
autocomplete="off"
42-
/>
43-
</label>
28+
}'
29+
type="text"
30+
name="<?= /* @escapeNotVerified */ $helper->getQueryParamName() ?>"
31+
value="<?= /* @escapeNotVerified */ $helper->getEscapedQueryText() ?>"
32+
placeholder="<?= /* @escapeNotVerified */ __('Search entire store here...') ?>"
33+
class="input-text"
34+
maxlength="<?= /* @escapeNotVerified */ $helper->getMaxQueryLength() ?>"
35+
role="combobox"
36+
aria-haspopup="false"
37+
aria-autocomplete="both"
38+
autocomplete="off"/>
4439
<div id="search_autocomplete" class="search-autocomplete"></div>
4540
<?= $block->getChildHtml() ?>
4641
</div>

0 commit comments

Comments
 (0)