Skip to content

Commit cda1b9d

Browse files
committed
Revert "lib/internal/Magento/Framework/Filesystem/ExtendedDriverInterface.php was removed. getMetadata method was movet to lib/internal/Magento/Framework/Filesystem/DriverInterface"
This reverts commit 0a7c0b3452208df4709632e7aa12741b1153457e.
1 parent 1b8a9f7 commit cda1b9d

File tree

7 files changed

+58
-35
lines changed

7 files changed

+58
-35
lines changed

app/code/Magento/Eav/Model/Attribute/Data/Image.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\Eav\Model\Attribute\Data;
77

8-
use Magento\Framework\Filesystem\DriverInterface;
8+
use Magento\Framework\Filesystem\ExtendedDriverInterface;
99

1010
/**
1111
* EAV Entity Attribute Image File Data Model
@@ -29,7 +29,7 @@ protected function _validateByRules($value)
2929
{
3030
$label = __($this->getAttribute()->getStoreLabel());
3131
$rules = $this->getAttribute()->getValidateRules();
32-
$localStorage = !$this->_directory->getDriver() instanceof DriverInterface;
32+
$localStorage = !$this->_directory->getDriver() instanceof ExtendedDriverInterface;
3333
$imageProp = $localStorage
3434
? @getimagesize($value['tmp_name'])
3535
: $this->_directory->getDriver()->getMetadata($value['tmp_name']);

app/code/Magento/MediaGallerySynchronization/Model/CreateAssetFromFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function execute(string $path): AssetInterface
7575
$absolutePath = $this->getMediaDirectory()->getAbsolutePath($path);
7676
$driver = $this->getMediaDirectory()->getDriver();
7777

78-
if ($driver instanceof Filesystem\DriverInterface) {
78+
if ($driver instanceof Filesystem\ExtendedDriverInterface) {
7979
$meta = $driver->getMetadata($absolutePath);
8080
} else {
8181
/**

app/code/Magento/RemoteStorage/Driver/RemoteDriverInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
namespace Magento\RemoteStorage\Driver;
99

10-
use Magento\Framework\Filesystem\DriverInterface;
10+
use Magento\Framework\Filesystem\ExtendedDriverInterface;
1111

1212
/**
1313
* Remote storage driver.
1414
*/
15-
interface RemoteDriverInterface extends DriverInterface
15+
interface RemoteDriverInterface extends ExtendedDriverInterface
1616
{
1717
/**
1818
* Test storage connection.

lib/internal/Magento/Framework/File/Mime.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Utility for mime type retrieval
1616
*
1717
* @deprecated
18-
* @see Filesystem\DriverInterface::getMetadata()
18+
* @see Filesystem\ExtendedDriverInterface::getMetadata()
1919
*/
2020
class Mime
2121
{
@@ -113,7 +113,7 @@ public function getMimeType($file)
113113
throw new FileSystemException(__("File '$file' doesn't exist"));
114114
}
115115

116-
if ($driver instanceof Filesystem\DriverInterface) {
116+
if ($driver instanceof Filesystem\ExtendedDriverInterface) {
117117
return $driver->getMetadata($file)['mimetype'];
118118
}
119119

lib/internal/Magento/Framework/File/Test/Unit/MimeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class MimeTest extends TestCase
5656
protected function setUp(): void
5757
{
5858
$this->localDriverMock = $this->getMockForAbstractClass(Filesystem\DriverInterface::class);
59-
$this->remoteDriverMock = $this->getMockForAbstractClass(Filesystem\DriverInterface::class);
59+
$this->remoteDriverMock = $this->getMockForAbstractClass(Filesystem\ExtendedDriverInterface::class);
6060

6161
$this->localDirectoryMock = $this->getMockForAbstractClass(Filesystem\Directory\WriteInterface::class);
6262
$this->localDirectoryMock->method('getDriver')

lib/internal/Magento/Framework/Filesystem/DriverInterface.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -393,31 +393,4 @@ public function getRealPathSafety($path);
393393
* @return mixed
394394
*/
395395
public function getRelativePath($basePath, $path = null);
396-
397-
/**
398-
* Retrieve file metadata.
399-
*
400-
* Implementation must return associative array with next keys:
401-
*
402-
* ```
403-
* [
404-
* 'path',
405-
* 'dirname',
406-
* 'basename',
407-
* 'extension',
408-
* 'filename',
409-
* 'timestamp',
410-
* 'size',
411-
* 'mimetype',
412-
* 'extra' => [
413-
* 'image-width',
414-
* 'image-height'
415-
* ]
416-
* ];
417-
*
418-
* @param string $path Absolute path to file
419-
* @return array
420-
* @throws FileSystemException
421-
*/
422-
public function getMetadata(string $path): array;
423396
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Framework\Filesystem;
9+
10+
use Magento\Framework\Exception\FileSystemException;
11+
12+
/**
13+
* Provides extension for Driver interface.
14+
*
15+
* @see DriverInterface
16+
*
17+
* @deprecated Method will be moved to DriverInterface
18+
* @see DriverInterface
19+
*/
20+
interface ExtendedDriverInterface extends DriverInterface
21+
{
22+
/**
23+
* Retrieve file metadata.
24+
*
25+
* Implementation must return associative array with next keys:
26+
*
27+
* ```
28+
* [
29+
* 'path',
30+
* 'dirname',
31+
* 'basename',
32+
* 'extension',
33+
* 'filename',
34+
* 'timestamp',
35+
* 'size',
36+
* 'mimetype',
37+
* 'extra' => [
38+
* 'image-width',
39+
* 'image-height'
40+
* ]
41+
* ];
42+
*
43+
* @param string $path Absolute path to file
44+
* @return array
45+
* @throws FileSystemException
46+
*
47+
* @deprecated Method will be moved to DriverInterface
48+
*/
49+
public function getMetadata(string $path): array;
50+
}

0 commit comments

Comments
 (0)