Files
Linux-Server-Management-Too…/modules
cschantz d387891ec4 Multi-panel support for website-error-analyzer.sh (Class C refactoring)
MAJOR REFACTORING:
This is one of the most complex Class C modules, requiring both system detection
and user/domain abstraction. The script is a critical diagnostic tool used to
identify real website errors affecting actual users.

KEY CHANGES:

1. Configuration (lines 17-26):
   - Changed DOMLOGS_DIR to use ${SYS_LOG_DIR} from system-detect.sh
   - Added CONTROL_PANEL="${SYS_CONTROL_PANEL}" for multi-panel logic
   - Removed hardcoded /var/log/apache2/domlogs fallback

2. PHP Error Log Discovery (lines 148-204):
   - Complete multi-panel rewrite using case statements
   - User filtering: Universal /home/$user search (works on all panels)
   - Domain filtering: Panel-specific domain→user lookup
     * cPanel: /etc/userdatadomains
     * InterWorx: vhost config + SuexecUserGroup
     * Plesk: plesk bin subscription --info
   - All users mode: Panel-specific document root patterns
     * cPanel: /home/*/public_html
     * InterWorx: /home/*/*/html
     * Plesk: /var/www/vhosts/*/httpdocs
     * Standalone: /var/www/html

3. Apache Access Log Discovery (lines 206-302):
   - Replaced cPanel-only /var/cpanel/users lookup with get_user_domains()
   - Complete multi-panel rewrite with case statements

   cPanel (lines 208-234):
   - Uses centralized $DOMLOGS_DIR
   - User filtering: get_user_domains() from user-manager.sh
   - Maintains existing domain/domain-* pattern matching

   InterWorx (lines 236-262):
   - Per-domain logs: /home/$user/var/$domain/logs/access_log
   - Domain→user: vhost config lookup
   - User→domains: get_user_domains()
   - All domains: find /home/*/var/*/logs -name access_log

   Plesk (lines 264-291):
   - System logs: /var/www/vhosts/system/$domain/logs/
   - Handles both access_log and access_ssl_log
   - User filtering: get_user_domains() + iterate domains

   Standalone (lines 293-301):
   - Tries /var/log/httpd/access_log
   - Tries /var/log/apache2/access.log

ABSTRACTION LIBRARIES USED:
- system-detect.sh: SYS_CONTROL_PANEL, SYS_LOG_DIR (already sourced)
- user-manager.sh: get_user_domains() (already sourced line 14)

IMPACT:
- Critical diagnostic tool now works on cPanel, InterWorx, Plesk, standalone
- Properly uses abstraction libraries for user/domain lookups
- No hardcoded paths remain
- Graceful handling of missing data

COMPLIANCE: Class C 
-  Uses system-detect.sh variables
-  Uses user-manager.sh abstraction functions
-  Multi-panel case statements for all discovery logic
-  No hardcoded panel-specific paths
-  Syntax verified with bash -n
2025-11-19 20:15:08 -05:00
..