Skip to content

Commit cb09209

Browse files
MC-39033: Rename AWS S3 module
1 parent 26acabe commit cb09209

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

app/code/Magento/AwsS3/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "magento/module-aws-s-3",
2+
"name": "magento/module-aws-s3",
33
"description": "N/A",
44
"config": {
55
"sort-packages": true

app/code/Magento/RemoteStorage/Driver/Cache/CacheFactory.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@
77

88
namespace Magento\RemoteStorage\Driver\Cache;
99

10+
use League\Flysystem\Adapter\Local;
1011
use League\Flysystem\Cached\CacheInterface;
1112
use League\Flysystem\Cached\Storage\Memory;
1213
use League\Flysystem\Cached\Storage\Predis;
14+
use League\Flysystem\Cached\Storage\Adapter;
15+
use Magento\Framework\App\Filesystem\DirectoryList;
16+
use Magento\Framework\Filesystem;
1317
use Magento\RemoteStorage\Driver\DriverException;
18+
use Magento\RemoteStorage\Driver\DriverPool;
1419
use Predis\Client;
1520

1621
/**
@@ -20,14 +25,32 @@ class CacheFactory
2025
{
2126
public const ADAPTER_PREDIS = 'predis';
2227
public const ADAPTER_MEMORY = 'memory';
28+
public const ADAPTER_LOCAL = 'local';
2329

2430
private const CACHE_KEY = 'storage';
31+
private const CACHE_FILE = 'storage_cache.json';
2532

2633
/**
2734
* Cache for 30 days.
2835
*/
2936
private const CACHE_EXPIRATION = 30 * 86400;
3037

38+
/**
39+
* @var string
40+
*/
41+
private $localCacheRoot;
42+
43+
/**
44+
* @param Filesystem $filesystem
45+
*/
46+
public function __construct(Filesystem $filesystem)
47+
{
48+
$this->localCacheRoot = $filesystem->getDirectoryRead(
49+
DirectoryList::VAR_DIR,
50+
DriverPool::FILE
51+
)->getAbsolutePath();
52+
}
53+
3154
/**
3255
* Create cache adapter.
3356
*
@@ -47,6 +70,8 @@ public function create(string $adapter, array $config = []): CacheInterface
4770
return new Predis(new Client($config), self::CACHE_KEY, self::CACHE_EXPIRATION);
4871
case self::ADAPTER_MEMORY:
4972
return new Memory();
73+
case self::ADAPTER_LOCAL:
74+
return new Adapter(new Local($this->localCacheRoot), self::CACHE_FILE, self::CACHE_EXPIRATION);
5075
}
5176

5277
throw new DriverException(__('Cache adapter %1 is not supported', $adapter));

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@
3131
</arguments>
3232
</virtualType>
3333
<virtualType name="fullRemoteFilesystem" type="Magento\RemoteStorage\Filesystem" />
34+
<virtualType name="stdFilesystem" type="Magento\Framework\Filesystem" />
3435
<preference for="Magento\Framework\Filesystem" type="customRemoteFilesystem"/>
36+
<type name="Magento\RemoteStorage\Driver\Cache\CacheFactory">
37+
<arguments>
38+
<argument name="filesystem" xsi:type="object">stdFilesystem</argument>
39+
</arguments>
40+
</type>
3541
<type name="Magento\Framework\Filesystem\Directory\TargetDirectory">
3642
<arguments>
3743
<argument name="filesystem" xsi:type="object">fullRemoteFilesystem</argument>

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@
327327
"tinymce/tinymce": "3.4.7",
328328
"magento/module-tinymce-3": "*",
329329
"magento/module-csp": "*",
330-
"magento/module-aws-s-3": "*",
330+
"magento/module-aws-s3": "*",
331331
"magento/module-remote-storage": "*"
332332
},
333333
"conflict": {

0 commit comments

Comments
 (0)