From 7556342a584c0d2b04fcdceec6c6cc5fc03cb363 Mon Sep 17 00:00:00 2001 From: cschantz Date: Wed, 19 Nov 2025 23:43:32 -0500 Subject: [PATCH] Update REFDB_FORMAT.txt with complete multi-panel architecture documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added comprehensive [MULTI_PANEL_ARCHITECTURE] section to REFDB_FORMAT.txt: - Control panel support status (cPanel/InterWorx/Plesk/standalone) - Critical path differences (docroot, logs, configs, DB prefixes) - Module classification system (Class A/B/C/D) - Refactoring progress tracker (33/38 = 87% complete) - Mandatory abstraction libraries (system-detect.sh, user-manager.sh) - Standard code patterns (log discovery, domain→user, API calls) - Common mistakes to avoid - Complete commit history for multi-panel work REFDB_FORMAT.txt is THE comprehensive developer documentation file (now 764 lines). This is the ONLY file Claude uses for development context across sessions. --- REFDB_FORMAT.txt | 140 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 139 insertions(+), 1 deletion(-) diff --git a/REFDB_FORMAT.txt b/REFDB_FORMAT.txt index fd28163..69bcbd1 100644 --- a/REFDB_FORMAT.txt +++ b/REFDB_FORMAT.txt @@ -618,9 +618,147 @@ common_functions: functions: print_banner(), print_success(), print_error(), print_warning(), print_info(), press_enter() colors: GREEN, RED, YELLOW, CYAN, BOLD, NC (auto-disabled if not TTY) +[MULTI_PANEL_ARCHITECTURE] +# MAJOR REFACTORING: 2025-11-19 +# Supporting cPanel, Plesk, InterWorx, and standalone Apache + +status: 33/38 modules complete (87%) +updated: 2025-11-19 + +# Control Panel Support Levels +panels: + cpanel: Full support (primary platform) + interworx: In progress (phases 1-3 complete) + plesk: Partial support (needs expansion) + standalone: Basic support (no control panel) + +# CRITICAL PATH DIFFERENCES (MUST MEMORIZE) +paths: + docroot: + cpanel: /home/USER/public_html + interworx: /home/USER/DOMAIN/html + plesk: /var/www/vhosts/DOMAIN/httpdocs + + access_logs: + cpanel: /var/log/apache2/domlogs/DOMAIN + interworx: /home/USER/var/DOMAIN/logs/access_log + plesk: /var/www/vhosts/system/DOMAIN/logs/access_log + + error_logs: + cpanel: /var/log/apache2/domlogs/DOMAIN-error_log + interworx: /home/USER/var/DOMAIN/logs/error_log + plesk: /var/www/vhosts/system/DOMAIN/logs/error_log + + user_config: + cpanel: /var/cpanel/users/USER + interworx: /etc/httpd/conf.d/vhost_*.conf + plesk: plesk bin commands + + domain_map: + cpanel: /etc/userdatadomains + interworx: vhost configs + SuexecUserGroup + plesk: plesk bin subscription --info + +# CRITICAL DATABASE PREFIX PATTERN (MOST IMPORTANT!) +database_prefixes: + cpanel: username_dbname + interworx: first8charsOfDomain_dbname # NOT username! + plesk: no prefix + +# Module Classification System +classes: + A: Panel-agnostic (7 modules) - No changes needed + B: System detection only (6 modules) - Use SYS_LOG_DIR + C: User/domain management (6 modules) - Complex refactoring + D: Panel-specific features (2 modules) - Conditional execution + Acronis: Backup suite (13 modules) - No changes needed + +# Class C Refactoring Progress (4/6 complete) +class_c_complete: + - website-error-analyzer.sh (commit d657c8a) + - 500-error-tracker.sh (commit 93d4cf9) + - malware-scanner.sh (previous commit) + - optimize-ct-limit.sh (previous commit) + +class_c_pending: + - wordpress-cron-manager.sh (33 /var/cpanel/userdata refs, 9 public_html refs) + - wordpress-menu.sh (needs audit) + +# MANDATORY ABSTRACTION LIBRARIES +required_libraries: + system-detect.sh: + exports: SYS_CONTROL_PANEL, SYS_LOG_DIR, SYS_CONTROL_PANEL_VERSION + values: cpanel|interworx|plesk|standalone + usage: source at top of script, use in case statements + + user-manager.sh: + get_user_info: Returns USER_EXISTS, PRIMARY_DOMAIN, ALL_DOMAINS, HOME_DIR + get_user_domains: Returns newline-separated domain list + get_user_databases: Returns database list for user + usage: NEVER grep /var/cpanel/users directly + +# STANDARD CODE PATTERNS (COPY THESE) +patterns: + log_discovery: | + case "$SYS_CONTROL_PANEL" in + cpanel) + find "$SYS_LOG_DIR" -type f -name "*.com" 2>/dev/null + ;; + interworx) + find /home/*/var/*/logs -type f -name "access_log" 2>/dev/null + ;; + plesk) + find /var/www/vhosts/system/*/logs -type f -name "access_log" 2>/dev/null + ;; + *) + [ -f "/var/log/httpd/access_log" ] && echo "/var/log/httpd/access_log" + ;; + esac + + domain_to_user: | + case "$SYS_CONTROL_PANEL" in + cpanel) + user=$(grep "^${domain}:" /etc/userdatadomains | cut -d: -f2 | awk -F'==' '{print $1}') + ;; + interworx) + user=$(grep -l "ServerName ${domain}" /etc/httpd/conf.d/vhost_*.conf | \ + xargs grep "SuexecUserGroup" | awk '{print $2}') + ;; + plesk) + user=$(plesk bin subscription --info "$domain" | grep "Owner" | awk '{print $2}') + ;; + esac + + api_calls: | + if [ "$SYS_CONTROL_PANEL" = "cpanel" ]; then + whmapi1 some_command + else + print_warning "Feature requires cPanel" + return 1 + fi + +# COMMON MISTAKES TO AVOID +mistakes: + hardcoded_paths: NEVER use /var/log/apache2/domlogs or /home/user/public_html + cpanel_only_apis: NEVER use whmapi1/uapi without panel check + missing_source: Class B/C modules MUST source system-detect.sh AND user-manager.sh + fallback_paths: NO fallbacks - fail explicitly with clear message + userdata_grep: NEVER grep /var/cpanel/userdata or /var/cpanel/users + +# Refactoring Commits +commits: + - Phase 1: user-manager.sh InterWorx support (819865b) + - Phase 2: bot-analyzer.sh + firewall detection (b86aa14) + - Phase 3: Security modules (0988224) + - Class B: Log directory refactoring (b770487) + - Class D: Panel version detection (8a2d9f5) + - website-error-analyzer.sh: Multi-panel (d657c8a) + - 500-error-tracker.sh: Multi-panel (93d4cf9) + - Documentation consolidation (fbce072) + [END] # This file is the ONLY developer reference document. # README.md is for users, this file is for developers (Claude). # Keep this updated after every significant change. -# Last updated: 2025-11-07 +# Last updated: 2025-11-19 ################################################################################