Skip to content

Commit a23f067

Browse files
Merge pull request #5451 from magento-qwerty/2.3.5-bugfixes-031320
Fixed Issues: - MC-31679: FPC doesn't work with Varnish enabled - MC-32145: Wishlist upgrade db update
2 parents 8fe2661 + b1ce6d7 commit a23f067

File tree

2 files changed

+112
-22
lines changed

2 files changed

+112
-22
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
namespace Magento\Wishlist\Setup\Patch\Data;
8+
9+
use Magento\Framework\DB\Select\QueryModifierFactory;
10+
use Magento\Framework\Serialize\Serializer\Json;
11+
use Magento\Framework\Setup\Patch\DataPatchInterface;
12+
use Magento\Framework\DB\Query\Generator;
13+
use Magento\Framework\App\ResourceConnection;
14+
use Magento\Framework\DB\Adapter\AdapterInterface;
15+
16+
/**
17+
* Class Clean Up Data Removes unused data
18+
*/
19+
class CleanUpData implements DataPatchInterface
20+
{
21+
/**
22+
* Batch size for query
23+
*/
24+
private const BATCH_SIZE = 1000;
25+
26+
/**
27+
* @var AdapterInterface
28+
*/
29+
private $adapter;
30+
31+
/**
32+
* @var Generator
33+
*/
34+
private $queryGenerator;
35+
36+
/**
37+
* @var Json
38+
*/
39+
private $json;
40+
/**
41+
* @var QueryModifierFactory
42+
*/
43+
private $queryModifierFactory;
44+
45+
/**
46+
* RemoveData constructor.
47+
* @param Json $json
48+
* @param Generator $queryGenerator
49+
* @param QueryModifierFactory $queryModifierFactory
50+
* @param ResourceConnection $resourceConnection
51+
*/
52+
public function __construct(
53+
Json $json,
54+
Generator $queryGenerator,
55+
QueryModifierFactory $queryModifierFactory,
56+
ResourceConnection $resourceConnection
57+
) {
58+
$this->json = $json;
59+
$this->queryGenerator = $queryGenerator;
60+
$this->queryModifierFactory = $queryModifierFactory;
61+
$this->adapter = $resourceConnection;
62+
}
63+
64+
/**
65+
* @inheritdoc
66+
*/
67+
public function apply()
68+
{
69+
$wishListItemOptionTable = $this->adapter->getTableName('wishlist_item_option');
70+
$select = $this->adapter
71+
->getConnection()
72+
->select()
73+
->from(
74+
$wishListItemOptionTable,
75+
['option_id', 'value']
76+
);
77+
$iterator = $this->queryGenerator->generate('option_id', $select, self::BATCH_SIZE);
78+
foreach ($iterator as $selectByRange) {
79+
$optionRows = $this->adapter->getConnection()->fetchAll($selectByRange);
80+
foreach ($optionRows as $optionRow) {
81+
$rowValue = $this->json->unserialize($optionRow['value']);
82+
unset($rowValue['login']);
83+
$rowValue = $this->json->serialize($rowValue);
84+
$this->adapter->getConnection()->update(
85+
$wishListItemOptionTable,
86+
['value' => $rowValue],
87+
['option_id = ?' => $optionRow['option_id']]
88+
);
89+
}
90+
}
91+
92+
return $this;
93+
}
94+
95+
/**
96+
* @inheritdoc
97+
*/
98+
public static function getDependencies()
99+
{
100+
return [
101+
ConvertSerializedData::class
102+
];
103+
}
104+
105+
/**
106+
* @inheritdoc
107+
*/
108+
public function getAliases()
109+
{
110+
return [];
111+
}
112+
}

lib/internal/Magento/Framework/HTTP/PhpEnvironment/Response.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -191,26 +191,4 @@ public function __sleep()
191191
{
192192
return ['content', 'isRedirect', 'statusCode'];
193193
}
194-
195-
/**
196-
* Sending provided headers.
197-
*
198-
* Had to be overridden because the original did not work correctly with multi-headers.
199-
*/
200-
public function sendHeaders()
201-
{
202-
if ($this->headersSent()) {
203-
return $this;
204-
}
205-
206-
$status = $this->renderStatusLine();
207-
header($status);
208-
209-
/** @var \Zend\Http\Header\HeaderInterface $header */
210-
foreach ($this->getHeaders() as $header) {
211-
header($header->toString(), false);
212-
}
213-
214-
return $this;
215-
}
216194
}

0 commit comments

Comments
 (0)