Docker-based self-hosted WordPress deployment system with: - Four-container stack (nginx, wordpress/php-fpm, mariadb, certbot) - Automatic SSL via Let's Encrypt with self-signed fallback - First-boot WordPress setup via WP-CLI (GeneratePress + child theme, plugins) - Interactive setup wizard and one-line install script - Backup, update, healthcheck, and SSL renewal scripts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
91 lines
2.9 KiB
PHP
91 lines
2.9 KiB
PHP
<?php
|
|
/**
|
|
* Plugin Name: WebsiteBox Setup Status
|
|
* Description: Displays setup status notices and dashboard widget. Disables XML-RPC.
|
|
* Version: 1.0.0
|
|
* Author: WebsiteBox
|
|
*/
|
|
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
// Disable XML-RPC
|
|
add_filter('xmlrpc_enabled', '__return_false');
|
|
|
|
// Admin notices based on setup status
|
|
add_action('admin_notices', function () {
|
|
$complete = ABSPATH . '.websitebox-setup-complete';
|
|
$partial = ABSPATH . '.websitebox-setup-partial';
|
|
|
|
if (file_exists($complete)) {
|
|
return; // Normal operation
|
|
}
|
|
|
|
if (file_exists($partial)) {
|
|
echo '<div class="notice notice-warning"><p>';
|
|
echo '<strong>WebsiteBox:</strong> Initial setup completed with errors. ';
|
|
echo 'Some plugins or themes may not have installed correctly. ';
|
|
echo 'To retry, run: <code>docker compose restart wordpress</code>';
|
|
echo '</p></div>';
|
|
return;
|
|
}
|
|
|
|
echo '<div class="notice notice-info"><p>';
|
|
echo '<strong>WebsiteBox:</strong> Initial setup is still in progress. ';
|
|
echo 'The container may still be installing themes and plugins. Please wait a moment and refresh this page.';
|
|
echo '</p></div>';
|
|
});
|
|
|
|
// Dashboard widget
|
|
add_action('wp_dashboard_setup', function () {
|
|
wp_add_dashboard_widget(
|
|
'websitebox_status',
|
|
'WebsiteBox Status',
|
|
'websitebox_dashboard_widget'
|
|
);
|
|
});
|
|
|
|
function websitebox_dashboard_widget() {
|
|
$complete = file_exists(ABSPATH . '.websitebox-setup-complete');
|
|
$partial = file_exists(ABSPATH . '.websitebox-setup-partial');
|
|
|
|
echo '<table class="widefat" style="border:0">';
|
|
|
|
// Setup status
|
|
echo '<tr><td><strong>Setup Status</strong></td><td>';
|
|
if ($complete) {
|
|
echo '<span style="color:green">✓ Complete</span>';
|
|
} elseif ($partial) {
|
|
echo '<span style="color:orange">⚠ Partial — retry with: <code>docker compose restart wordpress</code></span>';
|
|
} else {
|
|
echo '<span style="color:blue">⌛ In progress...</span>';
|
|
}
|
|
echo '</td></tr>';
|
|
|
|
// Age Gate status
|
|
if (is_plugin_active('age-gate/age-gate.php')) {
|
|
$min_age = get_option('age_gate_min_age', '18');
|
|
$restrict_all = get_option('age_gate_restrict_all', '0');
|
|
echo '<tr><td><strong>Age Gate</strong></td><td>';
|
|
echo $restrict_all ? "Enabled (minimum age: {$min_age})" : 'Installed but not restricting all content';
|
|
echo '</td></tr>';
|
|
} else {
|
|
echo '<tr><td><strong>Age Gate</strong></td><td>Not active</td></tr>';
|
|
}
|
|
|
|
// Backup status
|
|
if (is_plugin_active('updraftplus/updraftplus.php')) {
|
|
$last_backup = get_option('updraft_last_backup', []);
|
|
echo '<tr><td><strong>Backups</strong></td><td>';
|
|
if (!empty($last_backup['backup_time'])) {
|
|
echo 'Last backup: ' . date('Y-m-d H:i', $last_backup['backup_time']);
|
|
} else {
|
|
echo 'No backups yet';
|
|
}
|
|
echo '</td></tr>';
|
|
}
|
|
|
|
echo '</table>';
|
|
}
|