=== Cloud S3 Storage === Contributors: matteoenna,vhosting Tags: media storage, S3, object storage, cloud storage, media management License URI: http://www.gnu.org/licenses/gpl.html Requires at least: 5.0 Requires PHP: 7.2.5 Tested up to: 7.1 Stable tag: 1.6.0 License: GPLv2 or later Manage your WordPress media files with ease using S3-compatible object storage services. == Description == The **Cloud S3 Storage** plugin enables seamless integration of your WordPress media library with S3-compatible cloud storage solutions. Free up server space, improve scalability, and optimize your site's performance by offloading media files to the cloud. This plugin uses the AWS SDK for PHP, which is bundled with the plugin, to interact with S3-compatible storage services, such as AWS S3, Wasabi, or DigitalOcean Spaces. ### Key Features - **S3-Compatible Integration:** Works with any S3-compatible object storage service, such as AWS S3, Wasabi, or DigitalOcean Spaces. - **Media Library Sync:** Automatically sync your WordPress media files to the configured S3 storage bucket. - **Custom Cron Jobs:** Schedule automated tasks for reindexing and clearing media files from your S3 storage. - **Hybrid Mode:** Optionally keep files stored locally and on the cloud for redundancy. - **Customizable Settings:** Easily configure bucket details, upload preferences, and cron job timings from the admin interface. - **Efficient File Management:** Automatically delete unused or orphaned media files from your storage. - **Fallback Mechanism:** Ensures smooth functioning even during connectivity issues with the S3 service. == Installation == 1. Upload the **Cloud S3 Storage** plugin to your WordPress site. 2. Activate the plugin through the 'Plugins' menu in WordPress. 3. Navigate to **Settings > Cloud S3 Storage** to configure your storage settings. 4. The AWS SDK for PHP is bundled with this plugin, so there is no need for separate installation or configuration of the SDK. == Usage == 1. Enter your S3-compatible service credentials, bucket name, and region. 2. Set the cron job timing to automate syncing and cleanup tasks. 3. Use the media library as usual—uploads will automatically sync with S3 storage. 4. Monitor synced files and manage unused media from the plugin dashboard. == FAQs == ### **Q: Which S3-compatible services does this plugin support?** A: Any service that supports the S3 API, including AWS S3, Wasabi, DigitalOcean Spaces, and others. ### **Q: Do I need to install the AWS SDK separately?** A: No, the AWS SDK for PHP is already bundled with this plugin. You don't need to install it separately. ### **Q: Can I revert my media library back to local storage?** A: Yes, you can disable the plugin and move the media files back to your server if needed. ### **Q: Does this plugin support large media files?** A: Yes, the plugin handles chunked uploads for larger files to ensure compatibility with cloud storage. == Changelog == = 1.6.0 = * Generate frontend media URLs from the saved transfer state without per-image S3 existence checks or a connection probe on every page. Already-remote and external URLs are preserved. Live connection checks remain in transfer/cleanup/rollback operations and admin diagnostics, with listing limited to one object. * Frontend delivery trusts the transfer index: deleting or moving objects directly in the bucket is not detected during page rendering. Use the plugin's transfer and rollback operations to keep file state synchronized. * Rewrite transferred media used in inline CSS backgrounds and style blocks to S3, preserving HTML/CSS quoting and leaving external or untransferred assets unchanged. * Settings can be saved when credentials come from wp-config.php constants; validation errors no longer copy those credentials into the database. * Reuse one S3 client and HTTP connection per request; rebuild the client when connection settings or credentials change. * Initialize the WordPress filesystem before uploading, and return a recoverable failure when initialization is unavailable. * Update upload status using the relative media path, including files stored directly in uploads without year/month directories. * Optional AWS configuration in wp-config.php: set `CLOUD_S3_STORAGE_REGION` to the bucket region (for example `eu-south-1`) and `CLOUD_S3_STORAGE_OBJECT_ACL` to `private` to omit the ACL header for buckets with ACLs disabled. Existing installations keep region `auto` and ACL `public-read` by default. Private objects are not anonymously readable: the plugin's direct media URLs still require a separate delivery configuration before use on a public website. * S3 upload/download errors now catch the SDK's correctly namespaced exception, avoiding uncaught exceptions on authentication or permission failures. * Fixed: activation and ordinary page requests no longer load the entire Media Library or its file lists into memory. Reported by the VHosting Solution team: thank you. * Media indexing now resumes from a saved attachment ID, processing up to 100 attachments per request. A separate metadata-only background job continues the initial scan independently of scheduled S3 transfers. Opening a plugin page also continues indexing and displays progress, including when WP-Cron is disabled. Manual REST/CLI commands advance the same scan. * Transfer, local cleanup and rollback read bounded batches directly from the plugin table. An empty transfer limit defaults to 100 files; each execution processes at most 500 files. Repeat the command or use scheduled transfers to continue. * Statistics use database counts, and Media Library highlighting requests only the visible attachment IDs. * Existing transferred-file states are preserved during indexing. Files with the same name in different upload folders are indexed separately. * Database migrations are verified before their version is saved, and failed migrations can retry. * Metadata edits that fail or overlap an indexing batch are kept in a persistent retry queue, including attachments behind the scan cursor. Retries share the same batch limit and preserve existing S3 states. * Index workers acquire their lock atomically in the database, including when the object cache contains an outdated lock value. * Scheduled jobs now return normally so other due WordPress jobs can run. Rolling back one file no longer changes the state of its other image sizes. * Removed repeated array copies when building the compatibility file list. * Fixed: on WordPress 6.7 and later the plugin triggered the "Translation loading was triggered too early" notice. The settings field definitions and monitor labels are now read when needed. = 1.5.0 = * The Access Key and the Secret Key can now be defined in `wp-config.php`, with `CLOUD_S3_STORAGE_ACCESS_KEY` and `CLOUD_S3_STORAGE_SECRET_KEY`. Defined that way they stay out of the database, so they no longer travel in database dumps and backups; the settings screen shows they come from wp-config and leaves them alone. * The two key fields no longer send the saved value back to the browser. Leave a field blank to keep the key you have, or type a new one to replace it. * Tested up to WordPress 7.1. ### 1.0 - Initial release: - Basic S3 integration for WordPress media library. - Support for automated sync and cleanup tasks via cron jobs. - Hybrid mode for local and cloud storage redundancy. Simplify your WordPress media management and harness the power of cloud storage today with **Cloud S3 Storage**!