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
90 lines
1.9 KiB
PHP
90 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace DeliciousBrains\WP_Offload_Media\Pro\Tools;
|
|
|
|
use DeliciousBrains\WP_Offload_Media\Pro\Background_Tool;
|
|
|
|
abstract class Analyze_And_Repair extends Background_Tool {
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $tool_key = 'analyze_and_repair';
|
|
|
|
/**
|
|
* Limit the item types that this tool handles.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $source_types = array(
|
|
'media-library',
|
|
);
|
|
|
|
/**
|
|
* Should render.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function should_render() {
|
|
if ( ! $this->as3cf->is_pro_plugin_setup() ) {
|
|
return false;
|
|
}
|
|
|
|
if ( false !== static::show_tool_constant() && constant( static::show_tool_constant() ) ) {
|
|
return true;
|
|
}
|
|
|
|
return $this->is_active();
|
|
}
|
|
|
|
/**
|
|
* Get title text.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function get_title_text() {
|
|
return __( 'Analyze & Repair', 'amazon-s3-and-cloudfront' );
|
|
}
|
|
|
|
/**
|
|
* Get button text.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function get_button_text() {
|
|
return __( 'Analyze & Repair', 'amazon-s3-and-cloudfront' );
|
|
}
|
|
|
|
/**
|
|
* Get queued status text.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function get_queued_status(): string {
|
|
return __( 'Analyzing and repairing offload metadata.', 'amazon-s3-and-cloudfront' );
|
|
}
|
|
|
|
/**
|
|
* Get short queued status text.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function get_short_queued_status(): string {
|
|
return _x( 'Repairing…', 'Short tool running message', 'amazon-s3-and-cloudfront' );
|
|
}
|
|
|
|
/**
|
|
* Message for error notice
|
|
*
|
|
* @param string|null $message Optional message to override the default for the tool.
|
|
*
|
|
* @return string
|
|
*/
|
|
protected function get_error_notice_message( $message = null ) {
|
|
$title = __( 'Analyze & Repair Errors', 'amazon-s3-and-cloudfront' );
|
|
$message = empty( $message ) ? __( 'Previous attempts at analyzing and repairing your offload metadata have resulted in errors.', 'amazon-s3-and-cloudfront' ) : $message;
|
|
|
|
return sprintf( '<strong>%s</strong> — %s', $title, $message );
|
|
}
|
|
}
|