Skip to content

Commit 6671af8

Browse files
authored
Merge branch '2.4-develop' into UPS_AC11811_29APR
2 parents 3b6919c + 71370a9 commit 6671af8

File tree

9 files changed

+71
-186
lines changed

9 files changed

+71
-186
lines changed

app/code/Magento/AwsS3/Test/Mftf/Helper/DummyMetadataCache.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,4 @@ public function updateMetadata(string $path, array $objectMetadata, bool $persis
8383
public function storeFileNotExists(string $path): void
8484
{
8585
}
86-
87-
/**
88-
* @inheirtDoc
89-
*/
90-
public function storeDirNotExists(string $path): void
91-
{
92-
}
9386
}

app/code/Magento/AwsS3/Test/Mftf/Helper/S3FileAssertions.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ class S3FileAssertions extends Helper
2626
*/
2727
private $driver;
2828

29-
/**
30-
* @var AwsS3V3Adapter
31-
*/
32-
private $adapter;
33-
3429
/**
3530
* Call the parent constructor then create the AwsS3 driver from environment variables
3631
*
@@ -70,7 +65,6 @@ public function __construct(ModuleContainer $moduleContainer, ?array $config = n
7065
$s3Driver = new AwsS3($adapter, new MockTestLogger(), $objectUrl, $metadataProvider);
7166

7267
$this->driver = $s3Driver;
73-
$this->adapter = $adapter;
7468
}
7569

7670
/**
@@ -202,11 +196,10 @@ public function assertGlobbedFileExists($path, $pattern, $message = ''): void
202196
* @return void
203197
*
204198
* @throws \Magento\Framework\Exception\FileSystemException
205-
* @throws \League\Flysystem\FilesystemException
206199
*/
207200
public function assertDirectoryExists($path, $message = ''): void
208201
{
209-
$this->assertTrue($this->adapter->directoryExists($path), "Failed asserting $path exists. " . $message);
202+
$this->assertTrue($this->driver->isDirectory($path), "Failed asserting $path exists. " . $message);
210203
}
211204

212205
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,8 @@ public function testSearchDirectory(): void
439439
$this->metadataProviderMock->expects(self::any())->method('getMetadata')
440440
->willReturnMap([
441441
['path', ['type' => AwsS3::TYPE_DIR]],
442-
['path/1', ['type' => AwsS3::TYPE_DIR]],
443-
['path/2', ['type' => AwsS3::TYPE_DIR]],
442+
['path/1', ['type' => AwsS3::TYPE_FILE]],
443+
['path/2', ['type' => AwsS3::TYPE_FILE]],
444444
]);
445445
$this->adapterMock->expects(self::atLeastOnce())->method('listContents')
446446
->willReturn(new \ArrayIterator($subPaths));

app/code/Magento/RemoteStorage/Driver/Adapter/Cache/CacheInterface.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,4 @@ public function updateMetadata(string $path, array $objectMetadata, bool $persis
9393
* @param string $path
9494
*/
9595
public function storeFileNotExists(string $path): void;
96-
97-
/**
98-
* Store flag that dir path does not exist
99-
*
100-
* @param string $path
101-
* @return void
102-
*/
103-
public function storeDirNotExists(string $path): void;
10496
}

app/code/Magento/RemoteStorage/Driver/Adapter/Cache/Generic.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -117,23 +117,6 @@ public function storeFileNotExists(string $path): void
117117
);
118118
}
119119

120-
/**
121-
* @inheritdoc
122-
*/
123-
public function storeDirNotExists(string $path): void
124-
{
125-
$object = [
126-
'type' => 'dir',
127-
'path' => $path,
128-
];
129-
$this->cacheData[$path] = $object;
130-
$this->cacheAdapter->save(
131-
$this->serializer->serialize([$path => $this->cacheData[$path]]),
132-
$this->prefix . $path,
133-
[self::CACHE_TAG]
134-
);
135-
}
136-
137120
/**
138121
* @inheritdoc
139122
*/

app/code/Magento/RemoteStorage/Driver/Adapter/CachedAdapter.php

Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(
5050
}
5151

5252
/**
53-
* @inheritdoc
53+
* {@inheritdoc}
5454
*/
5555
public function write(string $path, string $contents, Config $config): void
5656
{
@@ -63,7 +63,7 @@ public function write(string $path, string $contents, Config $config): void
6363
}
6464

6565
/**
66-
* @inheritdoc
66+
* {@inheritdoc}
6767
*/
6868
public function writeStream(string $path, $contents, Config $config): void
6969
{
@@ -76,7 +76,7 @@ public function writeStream(string $path, $contents, Config $config): void
7676
}
7777

7878
/**
79-
* @inheritdoc
79+
* {@inheritdoc}
8080
*/
8181
public function move(string $source, string $destination, Config $config): void
8282
{
@@ -85,7 +85,7 @@ public function move(string $source, string $destination, Config $config): void
8585
}
8686

8787
/**
88-
* @inheritdoc
88+
* {@inheritdoc}
8989
*/
9090
public function copy(string $source, string $destination, Config $config): void
9191
{
@@ -94,7 +94,7 @@ public function copy(string $source, string $destination, Config $config): void
9494
}
9595

9696
/**
97-
* @inheritdoc
97+
* {@inheritdoc}
9898
*/
9999
public function delete(string $path): void
100100
{
@@ -103,7 +103,7 @@ public function delete(string $path): void
103103
}
104104

105105
/**
106-
* @inheritdoc
106+
* {@inheritdoc}
107107
*/
108108
public function deleteDirectory(string $path): void
109109
{
@@ -112,7 +112,7 @@ public function deleteDirectory(string $path): void
112112
}
113113

114114
/**
115-
* @inheritdoc
115+
* {@inheritdoc}
116116
*/
117117
public function createDirectory(string $path, Config $config): void
118118
{
@@ -123,7 +123,7 @@ public function createDirectory(string $path, Config $config): void
123123
}
124124

125125
/**
126-
* @inheritdoc
126+
* {@inheritdoc}
127127
*/
128128
public function setVisibility(string $path, string $visibility): void
129129
{
@@ -132,7 +132,7 @@ public function setVisibility(string $path, string $visibility): void
132132
}
133133

134134
/**
135-
* @inheritdoc
135+
* {@inheritdoc}
136136
*/
137137
public function fileExists(string $path): bool
138138
{
@@ -165,64 +165,31 @@ public function fileExists(string $path): bool
165165
}
166166

167167
/**
168-
* @inheritdoc
169-
*/
170-
public function directoryExists(string $path): bool
171-
{
172-
$cacheHas = $this->cache->exists($path);
173-
174-
if ($cacheHas !== null) {
175-
return $cacheHas;
176-
}
177-
178-
$exists = $this->adapter->directoryExists($path);
179-
180-
if (!$exists) {
181-
try {
182-
// check if target is a directory
183-
$exists = iterator_count($this->adapter->listContents($path, false)) > 0;
184-
} catch (\Throwable $e) {
185-
// catch closed iterator
186-
$exists = false;
187-
}
188-
}
189-
190-
if ($exists) {
191-
$cacheEntry = ['type' => 'dir', 'path' => $path];
192-
$this->cache->updateMetadata($path, $cacheEntry, true);
193-
} else {
194-
$this->cache->storeDirNotExists($path);
195-
}
196-
197-
return $exists;
198-
}
199-
200-
/**
201-
* @inheritdoc
168+
* {@inheritdoc}
202169
*/
203170
public function read(string $path): string
204171
{
205172
return $this->adapter->read($path);
206173
}
207174

208175
/**
209-
* @inheritdoc
176+
* {@inheritdoc}
210177
*/
211178
public function readStream(string $path)
212179
{
213180
return $this->adapter->readStream($path);
214181
}
215182

216183
/**
217-
* @inheritdoc
184+
* {@inheritdoc}
218185
*/
219186
public function listContents(string $path, bool $deep): iterable
220187
{
221188
return $this->adapter->listContents($path, $deep);
222189
}
223190

224191
/**
225-
* @inheritdoc
192+
* {@inheritdoc}
226193
*/
227194
public function fileSize(string $path): FileAttributes
228195
{
@@ -231,7 +198,7 @@ public function fileSize(string $path): FileAttributes
231198
}
232199

233200
/**
234-
* @inheritdoc
201+
* {@inheritdoc}
235202
*/
236203
public function mimeType(string $path): FileAttributes
237204
{
@@ -240,7 +207,7 @@ public function mimeType(string $path): FileAttributes
240207
}
241208

242209
/**
243-
* @inheritdoc
210+
* {@inheritdoc}
244211
*/
245212
public function lastModified(string $path): FileAttributes
246213
{
@@ -249,7 +216,7 @@ public function lastModified(string $path): FileAttributes
249216
}
250217

251218
/**
252-
* @inheritdoc
219+
* {@inheritdoc}
253220
*/
254221
public function visibility(string $path): FileAttributes
255222
{

app/code/Magento/RemoteStorage/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"require": {
55
"php": "~8.1.0||~8.2.0||~8.3.0",
66
"magento/framework": "*",
7-
"league/flysystem": "^3.0",
8-
"league/flysystem-aws-s3-v3": "^3.0"
7+
"league/flysystem": "^2.4",
8+
"league/flysystem-aws-s3-v3": "^2.4"
99
},
1010
"suggest": {
1111
"magento/module-backend": "*",

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
"laminas/laminas-stdlib": "^3.11",
6767
"laminas/laminas-uri": "^2.9",
6868
"laminas/laminas-validator": "^2.23",
69-
"league/flysystem": "^3.0",
70-
"league/flysystem-aws-s3-v3": "^3.0",
69+
"league/flysystem": "^2.4",
70+
"league/flysystem-aws-s3-v3": "^2.4",
7171
"magento/composer": "^1.10.0-beta1",
7272
"magento/composer-dependency-version-audit-plugin": "^0.1",
7373
"magento/magento-composer-installer": ">=0.4.0",

0 commit comments

Comments
 (0)