Skip to content

Commit 32062b5

Browse files
committed
B2B-1789: First Request For Storefront Image After Deleting Local File System Cached Images Results In Magento Placeholder Image When Using S3 -
Added review changes
1 parent 41d8aca commit 32062b5

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

app/code/Magento/RemoteStorage/Model/File/Storage/SynchronizationFactory.php renamed to app/code/Magento/RemoteStorage/Plugin/MediaStorage.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@
55
*/
66
declare(strict_types=1);
77

8-
namespace Magento\RemoteStorage\Model\File\Storage;
8+
namespace Magento\RemoteStorage\Plugin;
99

10-
use Magento\Framework\ObjectManagerInterface;
10+
use Magento\RemoteStorage\Model\File\Storage\Synchronization;
1111
use Magento\RemoteStorage\Model\Config;
12+
use Magento\Framework\ObjectManagerInterface;
1213

1314
/**
14-
* Factory class for @see \Magento\RemoteStorage\Model\File\Storage\Synchronization
15+
* Helps to synchronize files from remote to local file system
1516
*/
16-
class SynchronizationFactory extends \Magento\MediaStorage\Model\File\Storage\SynchronizationFactory
17+
class MediaStorage
1718
{
18-
/**
19+
/**
1920
* Object Manager instance
2021
*
2122
* @var ObjectManagerInterface
@@ -37,22 +38,17 @@ public function __construct(ObjectManagerInterface $objectManager, Config $confi
3738
{
3839
$this->objectManager = $objectManager;
3940
$this->config = $config;
40-
parent::__construct($objectManager);
4141
}
4242

4343
/**
4444
* Create class instance with specified parameters
4545
*
4646
* @param array $data
47-
* @return \Magento\MediaStorage\Model\File\Storage\Synchronization|mixed
48-
* @throws \Magento\Framework\Exception\FileSystemException
49-
* @throws \Magento\Framework\Exception\RuntimeException
5047
*/
51-
public function create(array $data = [])
48+
public function aroundCreate(array $data = [])
5249
{
5350
if ($this->config->isEnabled()) {
5451
return $this->objectManager->create(Synchronization::class, $data);
5552
}
56-
return parent::create($data);
5753
}
5854
}

app/code/Magento/RemoteStorage/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
"description": "N/A",
44
"require": {
55
"php": "~7.3.0||~7.4.0",
6-
"magento/framework": "*",
7-
"magento/module-media-storage": "*"
6+
"magento/framework": "*"
87
},
98
"suggest": {
109
"magento/module-backend": "*",
1110
"magento/module-sitemap": "*",
1211
"magento/module-cms": "*",
1312
"magento/module-downloadable": "*",
1413
"magento/module-catalog": "*",
14+
"magento/module-media-storage": "*",
1515
"magento/module-import-export": "*",
1616
"magento/module-catalog-import-export": "*",
1717
"magento/module-downloadable-import-export": "*",

app/code/Magento/RemoteStorage/etc/di.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<preference for="Magento\RemoteStorage\Driver\Adapter\CachedAdapterInterface" type="Magento\RemoteStorage\Driver\Adapter\CachedAdapter"/>
1111
<preference for="Magento\RemoteStorage\Driver\Adapter\MetadataProviderInterface" type="Magento\RemoteStorage\Driver\Adapter\MetadataProvider"/>
1212
<preference for="Magento\RemoteStorage\Driver\Adapter\MetadataProviderFactoryInterface" type="Magento\RemoteStorage\Driver\Adapter\MetadataProviderFactory"/>
13-
<preference for="Magento\MediaStorage\Model\File\Storage\SynchronizationFactory" type="Magento\RemoteStorage\Model\File\Storage\SynchronizationFactory"/>
1413
<virtualType name="remoteWriteFactory" type="Magento\Framework\Filesystem\Directory\WriteFactory">
1514
<arguments>
1615
<argument name="driverPool" xsi:type="object">Magento\RemoteStorage\Driver\DriverPool</argument>
@@ -76,6 +75,9 @@
7675
<argument name="filesystem" xsi:type="object">fullRemoteFilesystem</argument>
7776
</arguments>
7877
</type>
78+
<type name="Magento\MediaStorage\Model\File\Storage\SynchronizationFactory">
79+
<plugin name="remoteMedia" type="Magento\RemoteStorage\Plugin\MediaStorage" />
80+
</type>
7981
<type name="Magento\Framework\Data\Collection\Filesystem">
8082
<arguments>
8183
<argument name="filesystem" xsi:type="object">fullRemoteFilesystem</argument>

0 commit comments

Comments
 (0)