Add comprehensive Plesk control panel support
Core Infrastructure Added: - lib/plesk-helpers.sh: 30+ Plesk-specific helper functions - Domain discovery (list, docroot, logdir, access/error logs) - User/subscription management - Database discovery - PHP version detection (/opt/plesk/php/) - PHP-FPM pool discovery - Configuration file locations - Mail functions - Service management - Version detection with log structure handling - lib/domain-discovery.sh: Unified control panel abstraction - Consistent API across cPanel, Plesk, InterWorx, standalone - list_all_domains() - works on any panel - get_domain_docroot() - panel-agnostic document root - get_domain_logdir() - panel-agnostic log discovery - get_domain_access_log() - access log paths - get_domain_error_log() - error log paths - get_all_log_files() - all logs across all domains - get_domain_owner() - domain owner/user - list_all_users() - user enumeration - get_domain_fpm_socket() - PHP-FPM pool sockets - get_domain_databases() - database discovery - domain_exists() - existence checks Documentation: - PLESK_REFERENCE.md: Complete Plesk architecture reference - Directory structure mapping - Log file locations (current & future versions) - PHP-FPM pool locations - Configuration file paths - Plesk CLI command reference - Key differences from cPanel - Subdomain handling differences - PLESK_SUPPORT_SUMMARY.md: Implementation summary - All functions documented - Usage examples - Migration guide for existing modules - Version compatibility notes - Testing checklist System Detection Enhanced: - lib/system-detect.sh: - Improved Plesk detection with version-aware log paths - Auto-sources plesk-helpers.sh when Plesk detected - Added /opt/plesk/php/ scanning for PHP versions - Sets SYS_USER_HOME_BASE=/var/www/vhosts for Plesk Email Menu Added: - launcher.sh: New Email Troubleshooting menu category - 9 email diagnostic/maintenance tools (placeholders) - Deliverability test, queue inspector, SMTP test - SPF/DKIM/DMARC check, blacklist check - Mail log analyzer, queue flush - Mailbox cleanup, size reports Plesk Architecture Support: - /var/www/vhosts/ base directory structure - system/DOMAIN/logs/ for Plesk <18.0.50 - DOMAIN/logs/ for Plesk 18.0.50+ - Automatic version detection - Subdomain separate directory handling - /opt/plesk/php/X.Y/ PHP version detection - /var/www/vhosts/system/DOMAIN/php-fpm.sock pools - /var/www/vhosts/system/DOMAIN/conf/ configs Fallback Mechanisms: - All functions work with or without Plesk CLI - Directory scanning fallbacks - MySQL direct query fallbacks - Path inference from standard locations Status: Core infrastructure complete, ready for module integration Next: Test on actual Plesk server, update existing modules Ref: system_map.tsv analysis from Plesk production system
This commit is contained in:
+25
-3
@@ -57,9 +57,21 @@ detect_control_panel() {
|
||||
if [ -f "/usr/local/psa/version" ]; then
|
||||
SYS_CONTROL_PANEL="plesk"
|
||||
SYS_CONTROL_PANEL_VERSION=$(cat /usr/local/psa/version | head -1)
|
||||
SYS_LOG_DIR="/var/www/vhosts/system"
|
||||
|
||||
# Plesk uses /var/www/vhosts as base
|
||||
SYS_USER_HOME_BASE="/var/www/vhosts"
|
||||
|
||||
# Log directory depends on Plesk version
|
||||
# Plesk 18.0.50+ uses /var/www/vhosts/DOMAIN/logs
|
||||
# Plesk <18.0.50 uses /var/www/vhosts/system/DOMAIN/logs
|
||||
# Set marker path - tools will use plesk_get_logdir() for actual path
|
||||
SYS_LOG_DIR="/var/www/vhosts/system"
|
||||
|
||||
# Source Plesk helpers for advanced functionality
|
||||
if [ -f "$LIB_DIR/plesk-helpers.sh" ]; then
|
||||
source "$LIB_DIR/plesk-helpers.sh"
|
||||
fi
|
||||
|
||||
print_success "Detected Plesk v${SYS_CONTROL_PANEL_VERSION}"
|
||||
return 0
|
||||
fi
|
||||
@@ -238,6 +250,16 @@ detect_php_versions() {
|
||||
done
|
||||
fi
|
||||
|
||||
# Check Plesk PHP versions (/opt/plesk/php/)
|
||||
if [ "$SYS_CONTROL_PANEL" = "plesk" ]; then
|
||||
for php_path in /opt/plesk/php/*/bin/php; do
|
||||
if [ -x "$php_path" ]; then
|
||||
local full_version=$($php_path -v 2>/dev/null | grep -oP '^PHP \K[\d.]+' | head -1)
|
||||
[ -n "$full_version" ] && SYS_PHP_VERSIONS+=("$full_version")
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Check alt-php versions (CloudLinux) - fast path parsing
|
||||
for php_path in /opt/alt/php*/usr/bin/php; do
|
||||
if [ -x "$php_path" ]; then
|
||||
@@ -250,8 +272,8 @@ detect_php_versions() {
|
||||
fi
|
||||
done
|
||||
|
||||
# Remove duplicates
|
||||
SYS_PHP_VERSIONS=($(echo "${SYS_PHP_VERSIONS[@]}" | tr ' ' '\n' | sort -u))
|
||||
# Remove duplicates and sort by version
|
||||
SYS_PHP_VERSIONS=($(echo "${SYS_PHP_VERSIONS[@]}" | tr ' ' '\n' | sort -u -V))
|
||||
|
||||
if [ ${#SYS_PHP_VERSIONS[@]} -gt 0 ]; then
|
||||
print_success "Detected PHP versions: ${SYS_PHP_VERSIONS[*]}"
|
||||
|
||||
Reference in New Issue
Block a user