Skip to content

Commit d209ead

Browse files
committed
Merge remote-tracking branch 'origin/2.4.7-beta1-develop' into Sync-2.4.7-beta1-develop
2 parents 524cb80 + bcc5403 commit d209ead

File tree

85 files changed

+821
-435
lines changed

Some content is hidden

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

85 files changed

+821
-435
lines changed

app/code/Magento/Backend/Model/Auth/Session.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ public function __construct(
114114
);
115115
}
116116

117+
/**
118+
* @inheritDoc
119+
*/
120+
public function _resetState(): void
121+
{
122+
parent::_resetState();
123+
$this->_isFirstAfterLogin = null;
124+
$this->acl = null;
125+
}
126+
117127
/**
118128
* Refresh ACL resources stored in session
119129
*

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ public function __construct(
139139
}
140140
}
141141

142+
/**
143+
* @inheritDoc
144+
*/
145+
public function _resetState(): void
146+
{
147+
parent::_resetState();
148+
$this->_quote = null;
149+
$this->_store = null;
150+
$this->_order = null;
151+
}
152+
142153
/**
143154
* Retrieve quote model object
144155
*
@@ -154,7 +165,7 @@ public function getQuote()
154165
$this->_quote->setCustomerGroupId($customerGroupId);
155166
$this->_quote->setIsActive(false);
156167
$this->_quote->setStoreId($this->getStoreId());
157-
168+
158169
$this->quoteRepository->save($this->_quote);
159170
$this->setQuoteId($this->_quote->getId());
160171
$this->_quote = $this->quoteRepository->get($this->getQuoteId(), [$this->getStoreId()]);

app/code/Magento/Backup/Controller/Adminhtml/Index/Download.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
*/
77
namespace Magento\Backup\Controller\Adminhtml\Index;
88

9+
use Magento\Framework\App\Action\HttpGetActionInterface;
910
use Magento\Framework\App\Filesystem\DirectoryList;
1011

11-
class Download extends \Magento\Backup\Controller\Adminhtml\Index
12+
class Download extends \Magento\Backup\Controller\Adminhtml\Index implements HttpGetActionInterface
1213
{
1314
/**
1415
* @var \Magento\Framework\Controller\Result\RawFactory
@@ -66,17 +67,12 @@ public function execute()
6667

6768
$fileName = $this->_objectManager->get(\Magento\Backup\Helper\Data::class)->generateBackupDownloadName($backup);
6869

69-
$this->_fileFactory->create(
70+
return $this->_fileFactory->create(
7071
$fileName,
71-
null,
72+
['type' => 'filename', 'value' => $backup->getPath() . DIRECTORY_SEPARATOR . $backup->getFileName()],
7273
DirectoryList::VAR_DIR,
7374
'application/octet-stream',
7475
$backup->getSize()
7576
);
76-
77-
/** @var \Magento\Framework\Controller\Result\Raw $resultRaw */
78-
$resultRaw = $this->resultRawFactory->create();
79-
$resultRaw->setContents($backup->output());
80-
return $resultRaw;
8177
}
8278
}

app/code/Magento/Backup/Test/Unit/Controller/Adminhtml/Index/DownloadTest.php

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected function setUp(): void
115115
->getMock();
116116
$this->backupModelMock = $this->getMockBuilder(Backup::class)
117117
->disableOriginalConstructor()
118-
->setMethods(['getTime', 'exists', 'getSize', 'output'])
118+
->setMethods(['getTime', 'exists', 'getSize', 'output', 'getPath', 'getFileName'])
119119
->getMock();
120120
$this->dataHelperMock = $this->getMockBuilder(Data::class)
121121
->disableOriginalConstructor()
@@ -169,8 +169,13 @@ public function testExecuteBackupFound()
169169
$type = 'db';
170170
$filename = 'filename';
171171
$size = 10;
172-
$output = 'test';
173-
172+
$path = 'testpath';
173+
$this->backupModelMock->expects($this->atLeastOnce())
174+
->method('getPath')
175+
->willReturn($path);
176+
$this->backupModelMock->expects($this->atLeastOnce())
177+
->method('getFileName')
178+
->willReturn($filename);
174179
$this->backupModelMock->expects($this->atLeastOnce())
175180
->method('getTime')
176181
->willReturn($time);
@@ -180,9 +185,6 @@ public function testExecuteBackupFound()
180185
$this->backupModelMock->expects($this->atLeastOnce())
181186
->method('getSize')
182187
->willReturn($size);
183-
$this->backupModelMock->expects($this->atLeastOnce())
184-
->method('output')
185-
->willReturn($output);
186188
$this->requestMock->expects($this->any())
187189
->method('getParam')
188190
->willReturnMap(
@@ -206,20 +208,14 @@ public function testExecuteBackupFound()
206208
$this->fileFactoryMock->expects($this->once())
207209
->method('create')->with(
208210
$filename,
209-
null,
211+
['type' => 'filename', 'value' => $path . '/' . $filename],
210212
DirectoryList::VAR_DIR,
211213
'application/octet-stream',
212214
$size
213215
)
214216
->willReturn($this->responseMock);
215-
$this->resultRawMock->expects($this->once())
216-
->method('setContents')
217-
->with($output);
218-
$this->resultRawFactoryMock->expects($this->once())
219-
->method('create')
220-
->willReturn($this->resultRawMock);
221217

222-
$this->assertSame($this->resultRawMock, $this->downloadController->execute());
218+
$this->assertSame($this->responseMock, $this->downloadController->execute());
223219
}
224220

225221
/**

app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ public function __construct(
128128
$metadataPool,
129129
$tableMaintainer
130130
);
131-
132131
$this->stockItem = $stockItem
133132
?? ObjectManager::getInstance()->get(\Magento\CatalogInventory\Model\ResourceModel\Stock\Item::class);
134133
}
@@ -145,6 +144,17 @@ protected function _construct()
145144
$this->_selectionTable = $this->getTable('catalog_product_bundle_selection');
146145
}
147146

147+
/**
148+
* @inheritDoc
149+
*/
150+
public function _resetState(): void
151+
{
152+
parent::_resetState();
153+
$this->itemPrototype = null;
154+
$this->catalogRuleProcessor = null;
155+
$this->websiteScopePriceJoined = false;
156+
}
157+
148158
/**
149159
* Set store id for each collection item when collection was loaded.
150160
* phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod
@@ -355,8 +365,6 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false)
355365
* Get Catalog Rule Processor.
356366
*
357367
* @return \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor
358-
*
359-
* @deprecated 100.2.0
360368
*/
361369
private function getCatalogRuleProcessor()
362370
{

app/code/Magento/Catalog/Model/Layer/Resolver.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99

1010
namespace Magento\Catalog\Model\Layer;
1111

12+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
13+
1214
/**
1315
* Layer Resolver
1416
*
1517
* @api
1618
*/
17-
class Resolver
19+
class Resolver implements ResetAfterRequestInterface
1820
{
19-
const CATALOG_LAYER_CATEGORY = 'category';
20-
const CATALOG_LAYER_SEARCH = 'search';
21+
public const CATALOG_LAYER_CATEGORY = 'category';
22+
public const CATALOG_LAYER_SEARCH = 'search';
2123

2224
/**
2325
* Catalog view layer models list
@@ -79,4 +81,12 @@ public function get()
7981
}
8082
return $this->layer;
8183
}
84+
85+
/**
86+
* @inheritDoc
87+
*/
88+
public function _resetState(): void
89+
{
90+
$this->layer = null;
91+
}
8292
}

app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Magento\Catalog\Model\Product\Gallery;
88

9+
use Magento\AwsS3\Driver\AwsS3;
910
use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface;
1011
use Magento\Catalog\Api\Data\ProductInterfaceFactory;
1112
use Magento\Catalog\Api\ProductRepositoryInterface;
@@ -287,10 +288,18 @@ private function getImageContent($product, $entry): ImageContentInterface
287288
$mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA);
288289
$path = $mediaDirectory->getAbsolutePath($product->getMediaConfig()->getMediaPath($entry->getFile()));
289290
$fileName = $this->file->getPathInfo($path)['basename'];
290-
$imageFileContent = $mediaDirectory->getDriver()->fileGetContents($path);
291+
$fileDriver = $mediaDirectory->getDriver();
292+
$imageFileContent = $fileDriver->fileGetContents($path);
293+
294+
if ($fileDriver instanceof AwsS3) {
295+
$remoteMediaMimeType = $fileDriver->getMetadata($path);
296+
$mediaMimeType = $remoteMediaMimeType['mimetype'];
297+
} else {
298+
$mediaMimeType = $this->mime->getMimeType($path);
299+
}
291300
return $this->imageContentInterface->create()
292301
->setName($fileName)
293302
->setBase64EncodedData(base64_encode($imageFileContent))
294-
->setType($this->mime->getMimeType($path));
303+
->setType($mediaMimeType);
295304
}
296305
}

app/code/Magento/Catalog/Model/Product/Media/Config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Config implements ConfigInterface, ResetAfterRequestInterface
3030
private $attributeHelper;
3131

3232
/**
33-
* @var string[]
33+
* @var string[]|null
3434
*/
3535
private $mediaAttributeCodes;
3636

@@ -206,6 +206,6 @@ private function getAttributeHelper()
206206
*/
207207
public function _resetState(): void
208208
{
209-
$this->mediaAttributeCodes = [];
209+
$this->mediaAttributeCodes = null;
210210
}
211211
}

app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@ protected function _construct()
137137
$this->_init(Category::class, \Magento\Catalog\Model\ResourceModel\Category::class);
138138
}
139139

140+
/**
141+
* @inheritDoc
142+
*/
143+
public function _resetState(): void
144+
{
145+
parent::_resetState();
146+
$this->_productTable = null;
147+
$this->_productStoreId = null;
148+
$this->_productWebsiteTable = null;
149+
$this->_loadWithProductCount = false;
150+
}
151+
140152
/**
141153
* Add Id filter
142154
*

app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ public function __construct(
7676
);
7777
}
7878

79+
/**
80+
* @inheritDoc
81+
*/
82+
public function _resetState(): void
83+
{
84+
parent::_resetState();
85+
$this->_storeId = null;
86+
}
87+
7988
/**
8089
* Retrieve Entity Primary Key
8190
*

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Collection\Abstrac
102102
*/
103103
protected $_productLimitationFilters;
104104

105+
/**
106+
* @var ProductLimitationFactory
107+
*/
108+
private $productLimitationFactory;
109+
105110
/**
106111
* Category product count select
107112
*
@@ -354,10 +359,10 @@ public function __construct(
354359
$this->_resourceHelper = $resourceHelper;
355360
$this->dateTime = $dateTime;
356361
$this->_groupManagement = $groupManagement;
357-
$productLimitationFactory = $productLimitationFactory ?: ObjectManager::getInstance()->get(
362+
$this->productLimitationFactory = $productLimitationFactory ?: ObjectManager::getInstance()->get(
358363
\Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitationFactory::class
359364
);
360-
$this->_productLimitationFilters = $productLimitationFactory->create();
365+
$this->_productLimitationFilters = $this->productLimitationFactory->create();
361366
$this->metadataPool = $metadataPool ?: ObjectManager::getInstance()->get(MetadataPool::class);
362367
parent::__construct(
363368
$entityFactory,
@@ -387,6 +392,36 @@ public function __construct(
387392
->get(Gallery::class);
388393
}
389394

395+
/**
396+
* @inheritDoc
397+
*/
398+
public function _resetState(): void
399+
{
400+
parent::_resetState();
401+
$this->_flatEnabled = [];
402+
$this->_addUrlRewrite = false;
403+
$this->_urlRewriteCategory = '';
404+
$this->_addFinalPrice = false;
405+
$this->_allIdsCache = null;
406+
$this->_addTaxPercents = false;
407+
$this->_productLimitationFilters = $this->productLimitationFactory->create();
408+
$this->_productCountSelect = null;
409+
$this->_isWebsiteFilter = false;
410+
$this->_priceDataFieldFilters = [];
411+
$this->_priceExpression = null;
412+
$this->_additionalPriceExpression = null;
413+
$this->_maxPrice = null;
414+
$this->_minPrice = null;
415+
$this->_priceStandardDeviation = null;
416+
$this->_pricesCount = null;
417+
$this->_catalogPreparePriceSelect = null;
418+
$this->needToAddWebsiteNamesToResult = null;
419+
$this->linkField = null;
420+
$this->backend = null;
421+
$this->emptyItem = null;
422+
$this->_construct();
423+
}
424+
390425
/**
391426
* Get cloned Select after dispatching 'catalog_prepare_price_select' event
392427
*

app/code/Magento/Catalog/Model/ResourceModel/Product/Compare/Item/Collection.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,11 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
4646
protected $_comparableAttributes;
4747

4848
/**
49-
* Catalog product compare
50-
*
5149
* @var \Magento\Catalog\Helper\Product\Compare
5250
*/
5351
protected $_catalogProductCompare = null;
5452

5553
/**
56-
* Catalog product compare item
57-
*
5854
* @var \Magento\Catalog\Model\ResourceModel\Product\Compare\Item
5955
*/
6056
protected $_catalogProductCompareItem;
@@ -150,6 +146,18 @@ protected function _construct()
150146
$this->_initTables();
151147
}
152148

149+
/**
150+
* @inheritDoc
151+
*/
152+
public function _resetState(): void
153+
{
154+
parent::_resetState();
155+
$this->_customerId = 0;
156+
$this->_visitorId = 0;
157+
$this->listId = 0;
158+
$this->_comparableAttributes = null;
159+
}
160+
153161
/**
154162
* Set customer filter to collection
155163
*
@@ -287,7 +295,6 @@ public function getProductsByListId(int $listId): array
287295
return $this->getConnection()->fetchCol($select);
288296
}
289297

290-
291298
/**
292299
* Set list_id for customer compare item
293300
*

0 commit comments

Comments
 (0)