Files
peptiderepo-r2-manager/peptiderepo-r2-manager.php
peptiderepo 3cb8cd7c7d feat: initial release v1.1.0
Cloudflare R2 media offload manager for peptiderepo.com.
Built on WP Offload Media Lite. Supersedes the one-off migration script
and mu-plugin peptiderepo-r2-endpoint.php.

Features:
- Admin page under Peptide Repo > R2 Media Manager (shared umbrella menu)
- ensure_umbrella_menu() guard — safe for multi-plugin umbrella sharing
- Batch AJAX migration to R2 with pause/resume and progress bar
- Remove-local-copies batch with physical disk presence check
- Activity log table (wp_pr_r2_log) with self-healing on plugins_loaded
- Test R2 connection button
- R2 endpoint injection via as3cf_aws_s3_client_args filter
2026-04-25 08:48:01 +00:00

59 lines
2.4 KiB
PHP
Executable File

<?php
/**
* Plugin Name: Peptide Repo R2 Manager
* Plugin URI: https://peptiderepo.com
* Description: Cloudflare R2 media offload manager — admin dashboard for bulk
* migration, remove-local operations, connection testing, and error
* logging. Supersedes mu-plugin peptiderepo-r2-endpoint.php.
* Version: 1.1.0
* Author: peptiderepo
* License: GPL-2.0-or-later
* Text Domain: peptiderepo-r2
*
* What: Admin plugin for managing Cloudflare R2 media offloading on top of
* WP Offload Media Lite (amazon-s3-and-cloudfront). Provides the bulk
* migration UI, error log, test-connection, and R2 endpoint injection
* that the Lite tier omits.
* Who: Loaded by WordPress on every request (active plugin).
* Depends: WP Offload Media Lite active; AS3CF_SETTINGS defined in wp-config.php.
*
* @see wp-config.php (AS3CF_SETTINGS constant with R2 credentials)
* @see includes/class-r2-endpoint.php (R2 endpoint injection — replaces mu-plugin)
* @see includes/class-r2-log.php (DB log table management)
* @see includes/class-r2-admin-page.php (Settings > R2 Media Manager page)
* @see includes/class-r2-ajax.php (AJAX batch + test-connection handlers)
*
* CHANGELOG
* 1.0.0 — 2026-04-25 Initial release. Full CPO-spec implementation on top of WP
* Offload Media Lite. Supersedes one-off migration script and
* mu-plugin endpoint filter.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'PR_R2_VERSION', '1.1.0' );
define( 'PR_R2_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'PR_R2_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'PR_R2_PLUGIN_FILE', __FILE__ );
require_once PR_R2_PLUGIN_DIR . 'includes/class-r2-endpoint.php';
require_once PR_R2_PLUGIN_DIR . 'includes/class-r2-log.php';
require_once PR_R2_PLUGIN_DIR . 'includes/class-r2-admin-page.php';
require_once PR_R2_PLUGIN_DIR . 'includes/class-r2-ajax.php';
// Create log table on activation. Self-heals on every boot if table is missing.
register_activation_hook( PR_R2_PLUGIN_FILE, [ 'PR_R2_Log', 'create_table' ] );
add_action( 'plugins_loaded', function () {
global $wpdb;
$table = $wpdb->prefix . 'pr_r2_log';
if ( $wpdb->get_var( "SHOW TABLES LIKE '{$table}'" ) !== $table ) {
PR_R2_Log::create_table();
}
}, 1 );
PR_R2_Endpoint::init();
PR_R2_Admin_Page::init();
PR_R2_Ajax::init();