Skip to content

Commit 33711ab

Browse files
AnujnehraAnujnehra
authored andcommitted
Merge branch '2.4-develop' into ACP2E-2301
2 parents fca38f6 + bc1c7ba commit 33711ab

File tree

285 files changed

+3897
-778
lines changed

Some content is hidden

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

285 files changed

+3897
-778
lines changed

app/code/Magento/AwsS3/Driver/AwsS3.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -893,16 +893,24 @@ public function fileClose($resource): bool
893893
*/
894894
public function fileOpen($path, $mode)
895895
{
896+
$_mode = str_replace(['b', '+'], '', strtolower($mode));
897+
if (!in_array($_mode, ['r', 'w', 'a'], true)) {
898+
throw new FileSystemException(new Phrase('Invalid file open mode "%1".', [$mode]));
899+
}
896900
$path = $this->normalizeRelativePath($path, true);
897901

898902
if (!isset($this->streams[$path])) {
899903
$this->streams[$path] = tmpfile();
900904
try {
901905
if ($this->adapter->fileExists($path)) {
902-
//phpcs:ignore Magento2.Functions.DiscouragedFunction
903-
fwrite($this->streams[$path], $this->adapter->read($path));
904-
//phpcs:ignore Magento2.Functions.DiscouragedFunction
905-
rewind($this->streams[$path]);
906+
if ($_mode !== 'w') {
907+
//phpcs:ignore Magento2.Functions.DiscouragedFunction
908+
fwrite($this->streams[$path], $this->adapter->read($path));
909+
//phpcs:ignore Magento2.Functions.DiscouragedFunction
910+
if ($_mode !== 'a') {
911+
rewind($this->streams[$path]);
912+
}
913+
}
906914
}
907915
} catch (FlysystemFilesystemException $e) {
908916
$this->logger->error($e->getMessage());

app/code/Magento/AwsS3/Test/Unit/Driver/AwsS3Test.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,4 +537,42 @@ public function testFileCloseShouldReturnFalseIfTheArgumentIsNotAResource(): voi
537537
$this->assertEquals(false, $this->driver->fileClose(null));
538538
$this->assertEquals(false, $this->driver->fileClose(false));
539539
}
540+
541+
/**
542+
* @dataProvider fileOpenModesDataProvider
543+
*/
544+
public function testFileOppenedMode($mode, $expected): void
545+
{
546+
$this->adapterMock->method('fileExists')->willReturn(true);
547+
if ($mode !== 'w') {
548+
$this->adapterMock->expects($this->once())->method('read')->willReturn('aaa');
549+
} else {
550+
$this->adapterMock->expects($this->never())->method('read');
551+
}
552+
$resource = $this->driver->fileOpen('test/path', $mode);
553+
$this->assertEquals($expected, ftell($resource));
554+
}
555+
556+
/**
557+
* Data provider for testFileOppenedMode
558+
*
559+
* @return array[]
560+
*/
561+
public function fileOpenModesDataProvider(): array
562+
{
563+
return [
564+
[
565+
"mode" => "a",
566+
"expected" => 3
567+
],
568+
[
569+
"mode" => "r",
570+
"expected" => 0
571+
],
572+
[
573+
"mode" => "w",
574+
"expected" => 0
575+
]
576+
];
577+
}
540578
}

app/code/Magento/Catalog/Block/Adminhtml/Category/Checkboxes/Tree.php

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

77
/**
88
* Categories tree with checkboxes
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
119
*/
1210
namespace Magento\Catalog\Block\Adminhtml\Category\Checkboxes;
1311

app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Image.php

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

77
/**
88
* Category form image field helper
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
119
*/
1210
namespace Magento\Catalog\Block\Adminhtml\Category\Helper;
1311

@@ -39,6 +37,8 @@ public function __construct(
3937
}
4038

4139
/**
40+
* Return the URL
41+
*
4242
* @return bool|string
4343
*/
4444
protected function _getUrl()

app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Pricestep.php

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

77
/**
88
* Adminhtml additional helper block for sort by
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
119
*/
1210
namespace Magento\Catalog\Block\Adminhtml\Category\Helper;
1311

app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Sortby/Available.php

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

77
/**
88
* Adminhtml additional helper block for sort by
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
119
*/
1210
namespace Magento\Catalog\Block\Adminhtml\Category\Helper\Sortby;
1311

app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Sortby/DefaultSortby.php

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

77
/**
88
* Adminhtml additional helper block for sort by
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
119
*/
1210
namespace Magento\Catalog\Block\Adminhtml\Category\Helper\Sortby;
1311

app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php

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

77
/**
88
* Product in category grid
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
119
*/
1210
namespace Magento\Catalog\Block\Adminhtml\Category\Tab;
1311

@@ -127,6 +125,7 @@ protected function _prepareCollection()
127125
if ($this->getCategory()->getId()) {
128126
$this->setDefaultFilter(['in_category' => 1]);
129127
}
128+
130129
$collection = $this->_productFactory->create()->getCollection()->addAttributeToSelect(
131130
'name'
132131
)->addAttributeToSelect(
@@ -150,13 +149,15 @@ protected function _prepareCollection()
150149
if ($storeId > 0) {
151150
$collection->addStoreFilter($storeId);
152151
}
152+
153153
$this->setCollection($collection);
154154

155155
if ($this->getCategory()->getProductsReadonly()) {
156156
$productIds = $this->_getSelectedProducts();
157157
if (empty($productIds)) {
158158
$productIds = 0;
159159
}
160+
160161
$this->getCollection()->addFieldToFilter('entity_id', ['in' => $productIds]);
161162
}
162163

@@ -183,6 +184,7 @@ protected function _prepareColumns()
183184
]
184185
);
185186
}
187+
186188
$this->addColumn(
187189
'entity_id',
188190
[
@@ -264,6 +266,7 @@ protected function _getSelectedProducts()
264266
$products = $this->getCategory()->getProductsPosition();
265267
return array_keys($products);
266268
}
269+
267270
return $products;
268271
}
269272
}

app/code/Magento/Catalog/Block/Adminhtml/Category/Widget/Chooser.php

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

77
/**
88
* Category chooser for Wysiwyg CMS widget
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
119
*/
1210
namespace Magento\Catalog\Block\Adminhtml\Category\Widget;
1311

@@ -27,6 +25,8 @@ class Chooser extends \Magento\Catalog\Block\Adminhtml\Category\Tree
2725
protected $_template = 'Magento_Catalog::catalog/category/widget/tree.phtml';
2826

2927
/**
28+
* Initialise the block
29+
*
3030
* @return void
3131
*/
3232
protected function _construct()

app/code/Magento/Catalog/Block/Adminhtml/Form.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/**
8-
* Base block for rendering category and product forms
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
11-
*/
127
namespace Magento\Catalog\Block\Adminhtml;
138

149
use Magento\Backend\Block\Widget\Form\Generic;
1510

11+
/**
12+
* Base block for rendering category and product forms
13+
*/
1614
class Form extends Generic
1715
{
1816
/**
17+
* Prepare the layout
18+
*
1919
* @return void
2020
*/
2121
protected function _prepareLayout()

0 commit comments

Comments
 (0)