3.0.0
This commit is contained in:
parent
917c25c99b
commit
fd1d5a988a
|
|
@ -3,7 +3,7 @@
|
||||||
* Plugin Name: Flysystem Offload
|
* Plugin Name: Flysystem Offload
|
||||||
* Plugin URI: https://git.brasdrive.com.br/Brasdrive/flysystem-offload
|
* Plugin URI: https://git.brasdrive.com.br/Brasdrive/flysystem-offload
|
||||||
* Description: Reemplaza el filesystem local de WordPress con almacenamiento remoto transparente usando Flysystem v3.
|
* Description: Reemplaza el filesystem local de WordPress con almacenamiento remoto transparente usando Flysystem v3.
|
||||||
* Version: 0.3.0
|
* Version: 3.0.0
|
||||||
* Author: Brasdrive
|
* Author: Brasdrive
|
||||||
* License: GPLv2 or later
|
* License: GPLv2 or later
|
||||||
* Text Domain: flysystem-offload
|
* Text Domain: flysystem-offload
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,27 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FlysystemOffload\Filesystem;
|
namespace FlysystemOffload\Filesystem;
|
||||||
|
|
||||||
use FlysystemOffload\Filesystem\Adapters\S3Adapter;
|
use FlysystemOffload\Filesystem\Adapters\S3Adapter;
|
||||||
|
use FlysystemOffload\Filesystem\Adapters\WebdavAdapter;
|
||||||
use League\Flysystem\Filesystem;
|
use League\Flysystem\Filesystem;
|
||||||
use League\Flysystem\FilesystemOperator;
|
use League\Flysystem\FilesystemOperator;
|
||||||
use League\Flysystem\Visibility;
|
use League\Flysystem\Visibility;
|
||||||
|
|
||||||
final class FilesystemFactory {
|
final class FilesystemFactory
|
||||||
public function make(array $config): FilesystemOperator {
|
{
|
||||||
|
public function make(array $config): FilesystemOperator
|
||||||
|
{
|
||||||
$driver = $config['driver'] ?? 's3';
|
$driver = $config['driver'] ?? 's3';
|
||||||
|
|
||||||
$adapter = match ($driver) {
|
$adapter = match ($driver) {
|
||||||
's3' => (new S3Adapter())->createAdapter($config),
|
's3' => (new S3Adapter())->createAdapter($config),
|
||||||
default => throw new \InvalidArgumentException(sprintf('Driver de Flysystem no soportado: "%s".', $driver)),
|
'webdav' => (new WebdavAdapter())->createAdapter($config),
|
||||||
|
default => throw new \InvalidArgumentException(
|
||||||
|
sprintf('Driver de Flysystem no soportado: "%s".', $driver)
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
$filesystemConfig = [
|
$filesystemConfig = [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue