Skip to content

Commit 199272b

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #12410: Add argument on app:config:dump to skip dumping all system settings. (by @jalogut) - #14765: Display Wrong Data On Cart Update Page (by @nit-it) - #14753: [Backport] Fix bug with retry connect and custom db port (by @julienanquetil) - #14719: Fixed setting of triggerRecollection flag (by @philippsander) Fixed GitHub Issues: - #11396: app:config:dump locks every configuration setting no alternative to dump specific setting only (reported by @gulshan-streammarket) has been fixed in #12410 by @jalogut in 2.2-develop branch Related commits: 1. 3202e94 2. 0812ba8 3. 6751504 - #9580: Quote Attribute trigger_recollect causes a timeout (reported by @bh-ref) has been fixed in #14719 by @philippsander in 2.2-develop branch Related commits: 1. 646de48
2 parents b39852c + 549ff7e commit 199272b

File tree

8 files changed

+67
-13
lines changed

8 files changed

+67
-13
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<input type="hidden" name="product" value="<?= /* @escapeNotVerified */ $_product->getId() ?>" />
2323
<input type="hidden" name="selected_configurable_option" value="" />
2424
<input type="hidden" name="related_product" id="related-products-field" value="" />
25+
<input type="hidden" name="item" value="<?= /* @noEscape */ $block->getRequest()->getParam('id') ?>" />
2526
<?= $block->getBlockHtml('formkey') ?>
2627
<?= $block->getChildHtml('form_top') ?>
2728
<?php if (!$block->hasOptions()):?>

app/code/Magento/Checkout/view/frontend/web/js/view/configure/product-customer-data.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ require([
77

88
var selectors = {
99
qtySelector: '#product_addtocart_form [name="qty"]',
10-
productIdSelector: '#product_addtocart_form [name="product"]'
10+
productIdSelector: '#product_addtocart_form [name="product"]',
11+
itemIdSelector: '#product_addtocart_form [name="item"]'
1112
},
1213
cartData = customerData.get('cart'),
1314
productId = $(selectors.productIdSelector).val(),
15+
itemId = $(selectors.itemIdSelector).val(),
1416
productQty,
1517
productQtyInput,
1618

@@ -40,8 +42,10 @@ require([
4042
return;
4143
}
4244
product = data.items.find(function (item) {
43-
return item['product_id'] === productId ||
44-
item['item_id'] === productId;
45+
if (item['item_id'] === itemId) {
46+
return item['product_id'] === productId ||
47+
item['item_id'] === productId;
48+
}
4549
});
4650

4751
if (!product) {

app/code/Magento/ConfigurableProduct/view/frontend/web/js/options-updater.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ define([
77

88
var selectors = {
99
formSelector: '#product_addtocart_form',
10-
productIdSelector: '#product_addtocart_form [name="product"]'
10+
productIdSelector: '#product_addtocart_form [name="product"]',
11+
itemIdSelector: '#product_addtocart_form [name="item"]'
1112
},
1213
cartData = customerData.get('cart'),
1314
productId = $(selectors.productIdSelector).val(),
15+
itemId = $(selectors.itemIdSelector).val(),
1416

1517
/**
1618
* set productOptions according to cart data from customer-data
@@ -24,8 +26,10 @@ define([
2426
if (!(data && data.items && data.items.length && productId)) {
2527
return false;
2628
}
27-
changedProductOptions = _.find(data.items, function (item) {
28-
return item['product_id'] === productId;
29+
changedProductOptions = data.items.find(function (item) {
30+
if (item['item_id'] === itemId) {
31+
return item['product_id'] === productId;
32+
}
2933
});
3034
changedProductOptions = changedProductOptions && changedProductOptions.options &&
3135
changedProductOptions.options.reduce(function (obj, val) {

app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Framework\Config\File\ConfigFilePool;
1313
use Magento\Framework\Console\Cli;
1414
use Symfony\Component\Console\Command\Command;
15+
use Symfony\Component\Console\Input\InputArgument;
1516
use Symfony\Component\Console\Input\InputInterface;
1617
use Symfony\Component\Console\Output\OutputInterface;
1718

@@ -20,6 +21,8 @@
2021
*/
2122
class ApplicationDumpCommand extends Command
2223
{
24+
const INPUT_CONFIG_TYPES = 'config-types';
25+
2326
/**
2427
* @var Writer
2528
*/
@@ -47,10 +50,10 @@ public function __construct(
4750
array $sources,
4851
Hash $configHash = null
4952
) {
50-
parent::__construct();
5153
$this->writer = $writer;
5254
$this->sources = $sources;
5355
$this->configHash = $configHash ?: ObjectManager::getInstance()->get(Hash::class);
56+
parent::__construct();
5457
}
5558

5659
/**
@@ -60,6 +63,13 @@ protected function configure()
6063
{
6164
$this->setName('app:config:dump');
6265
$this->setDescription('Create dump of application');
66+
67+
$configTypes = array_unique(array_column($this->sources, 'namespace'));
68+
$this->addArgument(
69+
self::INPUT_CONFIG_TYPES,
70+
InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
71+
sprintf('Space-separated list of config types or omit to dump all [%s]', implode(', ', $configTypes))
72+
);
6373
parent::configure();
6474
}
6575

@@ -74,11 +84,14 @@ protected function configure()
7484
protected function execute(InputInterface $input, OutputInterface $output)
7585
{
7686
$this->groupSourcesByPool();
77-
87+
$dumpedTypes = [];
7888
foreach ($this->sources as $pool => $sources) {
7989
$dump = [];
8090
$comments = [];
8191
foreach ($sources as $sourceData) {
92+
if ($this->skipDump($input, $sourceData)) {
93+
continue;
94+
}
8295
/** @var ConfigSourceInterface $source */
8396
$source = $sourceData['source'];
8497
$namespace = $sourceData['namespace'];
@@ -95,15 +108,21 @@ protected function execute(InputInterface $input, OutputInterface $output)
95108
null,
96109
$comments
97110
);
111+
$dumpedTypes = array_unique($dumpedTypes + array_keys($dump));
98112
if (!empty($comments)) {
99113
$output->writeln($comments);
100114
}
101115
}
102116

117+
if (!$dumpedTypes) {
118+
$output->writeln('<error>Nothing dumped. Check the config types specified and try again');
119+
return Cli::RETURN_FAILURE;
120+
}
121+
103122
// Generate and save new hash of deployment configuration.
104123
$this->configHash->regenerate();
105124

106-
$output->writeln('<info>Done.</info>');
125+
$output->writeln(sprintf('<info>Done. Config types dumped: %s</info>', implode(', ', $dumpedTypes)));
107126
return Cli::RETURN_SUCCESS;
108127
}
109128

@@ -127,4 +146,20 @@ private function groupSourcesByPool()
127146

128147
$this->sources = $sources;
129148
}
149+
150+
/**
151+
* Check whether the dump source should be skipped
152+
*
153+
* @param InputInterface $input
154+
* @param array $sourceData
155+
* @return bool
156+
*/
157+
private function skipDump(InputInterface $input, array $sourceData): bool
158+
{
159+
$allowedTypes = $input->getArgument(self::INPUT_CONFIG_TYPES);
160+
if ($allowedTypes && !in_array($sourceData['namespace'], $allowedTypes)) {
161+
return true;
162+
}
163+
return false;
164+
}
130165
}

app/code/Magento/Deploy/Test/Unit/Console/Command/ApplicationDumpCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function testExport()
130130
->method('writeln')
131131
->withConsecutive(
132132
[['system' => 'Some comment message']],
133-
['<info>Done.</info>']
133+
['<info>Done. Config types dumped: system</info>']
134134
);
135135

136136
$method = new \ReflectionMethod(ApplicationDumpCommand::class, 'execute');

app/code/Magento/Quote/Model/Quote.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,8 +2389,9 @@ protected function _afterLoad()
23892389
{
23902390
// collect totals and save me, if required
23912391
if (1 == $this->getTriggerRecollect()) {
2392-
$this->collectTotals()->save();
2393-
$this->setTriggerRecollect(0);
2392+
$this->collectTotals()
2393+
->setTriggerRecollect(0)
2394+
->save();
23942395
}
23952396
return parent::_afterLoad();
23962397
}

dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function testExecute()
176176
->with(['system' => $comment]);
177177
$outputMock->expects($this->at(1))
178178
->method('writeln')
179-
->with('<info>Done.</info>');
179+
->with('<info>Done. Config types dumped: scopes, themes, system, i18n</info>');
180180

181181
/** @var ApplicationDumpCommand command */
182182
$command = $this->objectManager->create(ApplicationDumpCommand::class);

lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,15 @@ protected function _query($sql, $bind = [])
557557
) {
558558
$retry = true;
559559
$triesCount++;
560+
561+
/**
562+
* _connect() function does not allow port parameter, so put the port back with the host
563+
*/
564+
if (!empty($this->_config['port'])) {
565+
$this->_config['host'] = implode(':', [$this->_config['host'], $this->_config['port']]);
566+
unset($this->_config['port']);
567+
}
568+
560569
$this->closeConnection();
561570
$this->_connect();
562571
}

0 commit comments

Comments
 (0)