Files
WPS3Media/vendor/Aws3/Aws/Command.php
Malin 3248cbb029 feat: add S3-compatible storage provider (MinIO, Ceph, R2, etc.)
Adds a new 'S3-Compatible Storage' provider that works with any
S3-API-compatible object storage service, including MinIO, Ceph,
Cloudflare R2, Backblaze B2, and others.

Changes:
- New provider class: classes/providers/storage/s3-compatible-provider.php
  - Provider key: s3compatible
  - Reads user-configured endpoint URL from settings
  - Uses path-style URL access (required by most S3-compatible services)
  - Supports credentials via AS3CF_S3COMPAT_ACCESS_KEY_ID /
    AS3CF_S3COMPAT_SECRET_ACCESS_KEY wp-config.php constants
  - Disables AWS-specific features (Block Public Access, Object Ownership)
- New provider SVG icons (s3compatible.svg, -link.svg, -round.svg)
- Registered provider in main plugin class with endpoint setting support
- Updated StorageProviderSubPage to show endpoint URL input for S3-compatible
- Built pro settings bundle with rollup (Svelte 4.2.19)
- Added package.json and updated rollup.config.mjs for pro-only builds
2026-03-03 12:30:18 +01:00

93 lines
2.9 KiB
PHP

<?php
namespace DeliciousBrains\WP_Offload_Media\Aws3\Aws;
/**
* AWS command object.
*/
class Command implements CommandInterface
{
use HasDataTrait;
/** @var string */
private $name;
/** @var HandlerList */
private $handlerList;
/** @var Array */
private $authSchemes;
/**
* Accepts an associative array of command options, including:
*
* - @http: (array) Associative array of transfer options.
*
* @param string $name Name of the command
* @param array $args Arguments to pass to the command
* @param HandlerList $list Handler list
*/
public function __construct($name, array $args = [], HandlerList $list = null)
{
$this->name = $name;
$this->data = $args;
$this->handlerList = $list ?: new HandlerList();
if (!isset($this->data['@http'])) {
$this->data['@http'] = [];
}
if (!isset($this->data['@context'])) {
$this->data['@context'] = [];
}
}
public function __clone()
{
$this->handlerList = clone $this->handlerList;
}
public function getName()
{
return $this->name;
}
public function hasParam($name)
{
return \array_key_exists($name, $this->data);
}
public function getHandlerList()
{
return $this->handlerList;
}
/**
* For overriding auth schemes on a per endpoint basis when using
* EndpointV2 provider. Intended for internal use only.
*
* @param array $authSchemes
*
* @deprecated In favor of using the @context property bag.
* Auth Schemes are now accessible via the `signature_version` key
* in a Command's context, if applicable. Auth Schemes set using
* This method are no longer consumed.
*
* @internal
*/
public function setAuthSchemes(array $authSchemes)
{
\trigger_error(__METHOD__ . ' is deprecated. Auth schemes ' . 'resolved using the service `auth` trait or via endpoint resolution ' . 'are now set in the command `@context` property.`', \E_USER_WARNING);
$this->authSchemes = $authSchemes;
}
/**
* Get auth schemes added to command as required
* for endpoint resolution
*
* @returns array
*
* @deprecated In favor of using the @context property bag.
* Auth schemes are now accessible via the `signature_version` key
* in a Command's context, if applicable.
*/
public function getAuthSchemes()
{
\trigger_error(__METHOD__ . ' is deprecated. Auth schemes ' . 'resolved using the service `auth` trait or via endpoint resolution ' . 'can now be found in the command `@context` property.`', \E_USER_WARNING);
return $this->authSchemes ?: [];
}
/** @deprecated */
public function get($name)
{
return $this[$name];
}
}