Add directory tree visualization to validation scripts
Added smart, targeted directory trees for critical paths only. NEW TESTS: Plesk validator - TEST 14: Directory Structure Visualization • Domain structure: /var/www/vhosts/DOMAIN/ (depth 3) • Log structure: /var/www/vhosts/system/DOMAIN/ (depth 2) • General vhosts overview with sample domain • Plesk system directories: /usr/local/psa/ • PHP directories: /opt/plesk/php/ InterWorx validator - TEST 12: Directory Structure Visualization • User structure: /home/USERNAME/ (depth 2) • Domain structure: /home/USERNAME/DOMAIN/ (depth 3) • Log structure: /home/USERNAME/var/DOMAIN/ (depth 2) • General /home overview • InterWorx system directories: /usr/local/interworx/ • Apache config directory: /etc/httpd/conf.d/ FEATURES: • Uses 'tree' command if available (pretty output) • Falls back to find-based tree if tree not installed • Limited depth (2-3 levels max) to avoid overwhelming output • Shows actual log files with sizes • Documents sample vhost config locations WHY THIS HELPS: • Visual understanding of how each panel organizes files • See EXACTLY where logs/domains/configs live • Understand directory naming conventions • Verify our assumptions about path structures • Creates reference documentation for future work EXAMPLE OUTPUT: ``` === DOMAIN DIRECTORY STRUCTURE: example.com === /home/testuser/example.com/ ├── html/ │ ├── wp-admin/ │ ├── wp-content/ │ └── wp-config.php ├── cgi-bin/ └── ssl/ === LOG DIRECTORY STRUCTURE === /home/testuser/var/example.com/logs/ ├── access_log (2.3M) ├── error_log (145K) └── transfer.log (890K) ``` This visual context will be invaluable for understanding each panel's layout! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -548,10 +548,119 @@ if [ -n "$FIRST_WP" ]; then
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# TEST 12: Comprehensive System Documentation
|
||||
# TEST 12: Directory Structure Visualization
|
||||
################################################################################
|
||||
|
||||
section_header "TEST 12: Comprehensive System Documentation"
|
||||
section_header "TEST 12: Directory Structure Visualization"
|
||||
|
||||
test_info "Documenting directory structure for critical paths..."
|
||||
|
||||
# Function to create a tree-like view (limited depth)
|
||||
create_tree() {
|
||||
local path="$1"
|
||||
local depth="${2:-2}"
|
||||
local prefix="${3:-}"
|
||||
|
||||
if [ ! -d "$path" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Use tree command if available, otherwise use find
|
||||
if command -v tree &> /dev/null; then
|
||||
tree -L "$depth" -F "$path" 2>/dev/null || find "$path" -maxdepth "$depth" -type d 2>/dev/null | head -50
|
||||
else
|
||||
find "$path" -maxdepth "$depth" 2>/dev/null | head -50 | sed 's|[^/]*/| |g'
|
||||
fi
|
||||
}
|
||||
|
||||
# Document user/domain directory structure
|
||||
if [ -n "$TEST_USER" ] && [ -n "$TEST_DOMAIN" ]; then
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "=== USER DIRECTORY STRUCTURE: $TEST_USER ===" >> "$RESULTS_FILE"
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
|
||||
test_info "Documenting user structure for $TEST_USER..."
|
||||
|
||||
USER_PATH="/home/$TEST_USER"
|
||||
if [ -d "$USER_PATH" ]; then
|
||||
echo "Full path: $USER_PATH" >> "$RESULTS_FILE"
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
|
||||
# Show top level
|
||||
echo "Top level:" >> "$RESULTS_FILE"
|
||||
ls -lh "$USER_PATH" 2>/dev/null | head -20 >> "$RESULTS_FILE"
|
||||
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "Tree view (depth 2):" >> "$RESULTS_FILE"
|
||||
create_tree "$USER_PATH" 2 >> "$RESULTS_FILE" 2>&1
|
||||
fi
|
||||
|
||||
# Document specific domain structure
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "=== DOMAIN DIRECTORY STRUCTURE: $TEST_DOMAIN ===" >> "$RESULTS_FILE"
|
||||
DOMAIN_PATH="/home/$TEST_USER/$TEST_DOMAIN"
|
||||
if [ -d "$DOMAIN_PATH" ]; then
|
||||
echo "Full path: $DOMAIN_PATH" >> "$RESULTS_FILE"
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
create_tree "$DOMAIN_PATH" 3 >> "$RESULTS_FILE" 2>&1
|
||||
fi
|
||||
|
||||
# Document var/logs structure
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "=== LOG DIRECTORY STRUCTURE: $TEST_DOMAIN ===" >> "$RESULTS_FILE"
|
||||
VAR_PATH="/home/$TEST_USER/var/$TEST_DOMAIN"
|
||||
if [ -d "$VAR_PATH" ]; then
|
||||
echo "Full path: $VAR_PATH" >> "$RESULTS_FILE"
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
create_tree "$VAR_PATH" 2 >> "$RESULTS_FILE" 2>&1
|
||||
|
||||
# List actual log files with sizes
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "Log files:" >> "$RESULTS_FILE"
|
||||
ls -lh "$VAR_PATH/logs/" 2>/dev/null >> "$RESULTS_FILE"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Document general /home structure (sample user)
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "=== GENERAL /home STRUCTURE ===" >> "$RESULTS_FILE"
|
||||
test_info "Documenting /home structure..."
|
||||
|
||||
if [ -d "/home" ]; then
|
||||
echo "Users in /home:" >> "$RESULTS_FILE"
|
||||
ls -lh /home/ 2>/dev/null | grep "^d" | head -10 >> "$RESULTS_FILE"
|
||||
|
||||
# Show one sample user structure
|
||||
if [ -n "$TEST_USER" ]; then
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "Sample user structure: $TEST_USER (depth 1)" >> "$RESULTS_FILE"
|
||||
ls -lh "/home/$TEST_USER/" 2>/dev/null >> "$RESULTS_FILE"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Document InterWorx directory structure
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "=== INTERWORX SYSTEM DIRECTORIES ===" >> "$RESULTS_FILE"
|
||||
test_info "Documenting InterWorx system directories..."
|
||||
|
||||
if [ -d "/usr/local/interworx" ]; then
|
||||
echo "/usr/local/interworx structure (depth 1):" >> "$RESULTS_FILE"
|
||||
ls -lh /usr/local/interworx/ 2>/dev/null >> "$RESULTS_FILE"
|
||||
fi
|
||||
|
||||
# Document Apache config directory
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "=== APACHE CONFIG DIRECTORY ===" >> "$RESULTS_FILE"
|
||||
if [ -d "/etc/httpd/conf.d" ]; then
|
||||
echo "/etc/httpd/conf.d vhost configs:" >> "$RESULTS_FILE"
|
||||
ls -lh /etc/httpd/conf.d/vhost_*.conf 2>/dev/null | head -10 >> "$RESULTS_FILE"
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# TEST 13: Comprehensive System Documentation
|
||||
################################################################################
|
||||
|
||||
section_header "TEST 13: Comprehensive System Documentation"
|
||||
|
||||
test_info "Gathering complete system information for future reference..."
|
||||
|
||||
|
||||
@@ -713,10 +713,103 @@ if [ -n "$FIRST_WP" ]; then
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# TEST 14: Comprehensive System Documentation
|
||||
# TEST 14: Directory Structure Visualization
|
||||
################################################################################
|
||||
|
||||
section_header "TEST 14: Comprehensive System Documentation"
|
||||
section_header "TEST 14: Directory Structure Visualization"
|
||||
|
||||
test_info "Documenting directory structure for critical paths..."
|
||||
|
||||
# Function to create a tree-like view (limited depth)
|
||||
create_tree() {
|
||||
local path="$1"
|
||||
local depth="${2:-2}"
|
||||
local prefix="${3:-}"
|
||||
|
||||
if [ ! -d "$path" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Use tree command if available, otherwise use find
|
||||
if command -v tree &> /dev/null; then
|
||||
tree -L "$depth" -F "$path" 2>/dev/null || find "$path" -maxdepth "$depth" -type d 2>/dev/null | head -50
|
||||
else
|
||||
find "$path" -maxdepth "$depth" 2>/dev/null | head -50 | sed 's|[^/]*/| |g'
|
||||
fi
|
||||
}
|
||||
|
||||
# Document domain directory structure
|
||||
if [ -n "$TEST_DOMAIN" ]; then
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "=== DOMAIN DIRECTORY STRUCTURE: $TEST_DOMAIN ===" >> "$RESULTS_FILE"
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
|
||||
test_info "Documenting domain structure for $TEST_DOMAIN..."
|
||||
|
||||
DOMAIN_PATH="/var/www/vhosts/$TEST_DOMAIN"
|
||||
if [ -d "$DOMAIN_PATH" ]; then
|
||||
echo "Full path: $DOMAIN_PATH" >> "$RESULTS_FILE"
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
create_tree "$DOMAIN_PATH" 3 >> "$RESULTS_FILE" 2>&1
|
||||
fi
|
||||
|
||||
# Document log directory structure
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "=== LOG DIRECTORY STRUCTURE: $TEST_DOMAIN ===" >> "$RESULTS_FILE"
|
||||
LOG_PATH="/var/www/vhosts/system/$TEST_DOMAIN"
|
||||
if [ -d "$LOG_PATH" ]; then
|
||||
echo "Full path: $LOG_PATH" >> "$RESULTS_FILE"
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
create_tree "$LOG_PATH" 2 >> "$RESULTS_FILE" 2>&1
|
||||
|
||||
# List actual log files with sizes
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "Log files:" >> "$RESULTS_FILE"
|
||||
ls -lh "$LOG_PATH/logs/" 2>/dev/null >> "$RESULTS_FILE"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Document general vhosts structure
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "=== GENERAL VHOSTS STRUCTURE ===" >> "$RESULTS_FILE"
|
||||
test_info "Documenting /var/www/vhosts structure..."
|
||||
|
||||
if [ -d "/var/www/vhosts" ]; then
|
||||
echo "Depth 1 view of /var/www/vhosts:" >> "$RESULTS_FILE"
|
||||
ls -lh /var/www/vhosts/ 2>/dev/null | head -20 >> "$RESULTS_FILE"
|
||||
|
||||
# Show one sample domain structure
|
||||
SAMPLE_DOMAIN=$(find /var/www/vhosts -maxdepth 1 -type d ! -name "vhosts" ! -name "system" ! -name "default" 2>/dev/null | head -1)
|
||||
if [ -n "$SAMPLE_DOMAIN" ]; then
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "Sample domain structure: $(basename "$SAMPLE_DOMAIN")" >> "$RESULTS_FILE"
|
||||
create_tree "$SAMPLE_DOMAIN" 2 >> "$RESULTS_FILE" 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Document Plesk directory structure
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "=== PLESK SYSTEM DIRECTORIES ===" >> "$RESULTS_FILE"
|
||||
test_info "Documenting Plesk system directories..."
|
||||
|
||||
if [ -d "/usr/local/psa" ]; then
|
||||
echo "/usr/local/psa structure (depth 1):" >> "$RESULTS_FILE"
|
||||
ls -lh /usr/local/psa/ 2>/dev/null >> "$RESULTS_FILE"
|
||||
fi
|
||||
|
||||
# Document PHP directory structure
|
||||
echo "" >> "$RESULTS_FILE"
|
||||
echo "=== PHP DIRECTORY STRUCTURE ===" >> "$RESULTS_FILE"
|
||||
if [ -d "/opt/plesk/php" ]; then
|
||||
echo "/opt/plesk/php structure:" >> "$RESULTS_FILE"
|
||||
create_tree "/opt/plesk/php" 2 >> "$RESULTS_FILE" 2>&1
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# TEST 15: Comprehensive System Documentation
|
||||
################################################################################
|
||||
|
||||
section_header "TEST 15: Comprehensive System Documentation"
|
||||
|
||||
test_info "Gathering complete system information for future reference..."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user