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
96 lines
2.3 KiB
PHP
96 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace DeliciousBrains\WP_Offload_Media\Pro\Tools;
|
|
|
|
use DeliciousBrains\WP_Offload_Media\Pro\Background_Processes\Background_Tool_Process;
|
|
use DeliciousBrains\WP_Offload_Media\Pro\Background_Processes\Download_And_Remover_Process;
|
|
|
|
class Download_And_Remover extends Downloader {
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $tool_key = 'download_and_remover';
|
|
|
|
/**
|
|
* 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 = __( 'Removal Errors', 'amazon-s3-and-cloudfront' );
|
|
$message = empty( $message ) ? __( 'Previous attempts at removing your media library from the bucket have resulted in errors.', 'amazon-s3-and-cloudfront' ) : $message;
|
|
|
|
return sprintf( '<strong>%s</strong> — %s', $title, $message );
|
|
}
|
|
|
|
/**
|
|
* Should render.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function should_render() {
|
|
if ( ! $this->as3cf->is_plugin_setup() ) {
|
|
return false;
|
|
}
|
|
|
|
return (bool) $this->count_offloaded_media_files();
|
|
}
|
|
|
|
/**
|
|
* Get title text.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function get_title_text() {
|
|
return __( 'Remove all files from bucket', 'amazon-s3-and-cloudfront' );
|
|
}
|
|
|
|
/**
|
|
* Get more info text.
|
|
*
|
|
* @return string
|
|
*/
|
|
public static function get_more_info_text() {
|
|
return __( 'This tool goes through all your media and deletes files from the bucket. If the file doesn\'t exist on your server, it will download it before deleting.', 'amazon-s3-and-cloudfront' );
|
|
}
|
|
|
|
/**
|
|
* Get button text.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function get_button_text() {
|
|
return __( 'Remove Files', 'amazon-s3-and-cloudfront' );
|
|
}
|
|
|
|
/**
|
|
* Get queued status text.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function get_queued_status(): string {
|
|
return __( 'Removing media from bucket', 'amazon-s3-and-cloudfront' );
|
|
}
|
|
|
|
/**
|
|
* Get short queued status text.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function get_short_queued_status(): string {
|
|
return _x( 'Removing…', 'Short tool running message', 'amazon-s3-and-cloudfront' );
|
|
}
|
|
|
|
/**
|
|
* Get background process class.
|
|
*
|
|
* @return Background_Tool_Process|null
|
|
*/
|
|
protected function get_background_process_class() {
|
|
return new Download_And_Remover_Process( $this->as3cf, $this );
|
|
}
|
|
}
|