FIX: Correct maxdepth values for WordPress discovery across all panels

Corrected find -maxdepth values that were too shallow/deep:

cPanel:      maxdepth 4 (was split 2/3, now unified at 4)
             - Finds main domain + addon domains, stops before wp-content

InterWorx:   maxdepth 3 (standard, correct)
             maxdepth 4 (chroot, was 5, now 4)

Plesk:       maxdepth 2 (was 3, now 2)
             - /var/www/vhosts/DOMAIN/httpdocs/wp-config.php

Standalone:  /var/www/html maxdepth 2 (correct)
             /home maxdepth 4 (was 3, now 4 to match cPanel)

All maxdepth values now verified to:
 Find WordPress main domains
 Find WordPress addon domains
 Stop before wp-content, plugins, uploads
 Not recurse unnecessarily

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
cschantz
2026-03-02 23:45:19 -05:00
parent a492d0cdcd
commit d24e4ffecf
@@ -293,31 +293,31 @@ get_wp_search_paths() {
case "$panel" in case "$panel" in
cpanel) cpanel)
# Search depth 2 (primary): /home/USER/public_html/wp-config.php # Search with limited depth to find WordPress installations
# Search depth 3 (addon): /home/USER/public_html/ADDON/wp-config.php # Depth structure: /home (0) -> USER (1) -> public_html (2) -> [ADDON] (3) -> wp-config.php
# Limited depth prevents recursion into wp-content, node_modules, etc. # maxdepth 4 finds: main domains at depth 2, addon domains at depth 3
{ # Prevents recursion into wp-content (depth 3+), plugins, uploads, etc.
find /home -maxdepth 2 -path "*/public_html/wp-config.php" -type f 2>/dev/null find /home -maxdepth 4 -name "wp-config.php" -type f 2>/dev/null | head -$max_results
find /home -maxdepth 3 -path "*/public_html/*/wp-config.php" -type f 2>/dev/null
} | head -$max_results
;; ;;
interworx) interworx)
# Standard: /home/USER/DOMAIN/html/wp-config.php (depth 3) # Standard: /home (0) -> USER (1) -> DOMAIN (2) -> html (3) -> wp-config.php (maxdepth 3)
# Chroot: /chroot/home/USER/var/DOMAIN/html/wp-config.php (depth 5) # Chroot: /chroot (0) -> home (1) -> USER (2) -> var (3) -> DOMAIN (4) -> html (4) -> wp-config.php (maxdepth 4)
{ {
find /home -maxdepth 3 -name "wp-config.php" -type f 2>/dev/null find /home -maxdepth 3 -name "wp-config.php" -type f 2>/dev/null
find /chroot/home -maxdepth 5 -name "wp-config.php" -type f 2>/dev/null find /chroot/home -maxdepth 4 -name "wp-config.php" -type f 2>/dev/null
} | head -$max_results } | head -$max_results
;; ;;
plesk) plesk)
# All domains under /var/www/vhosts/DOMAIN/httpdocs/wp-config.php (depth 3) # Structure: /var (0) -> www (1) -> vhosts (2) -> DOMAIN (2) -> httpdocs (2) -> wp-config.php (maxdepth 2)
find /var/www/vhosts -maxdepth 3 -name "wp-config.php" -type f 2>/dev/null | head -$max_results find /var/www/vhosts -maxdepth 2 -name "wp-config.php" -type f 2>/dev/null | head -$max_results
;; ;;
*) *)
# Standalone: multiple possible locations, all with limited depth # Standalone: multiple possible locations, all with limited depth
# /var/www/html (0) -> wp-config.php or SUBDIR (1) -> wp-config.php (maxdepth 2)
# /home (0) -> USER (1) -> public_html (2) -> wp-config.php or ADDON (3) -> wp-config.php (maxdepth 4)
{ {
find /var/www/html -maxdepth 2 -name "wp-config.php" -type f 2>/dev/null find /var/www/html -maxdepth 2 -name "wp-config.php" -type f 2>/dev/null
find /home -maxdepth 3 -name "wp-config.php" -type f 2>/dev/null find /home -maxdepth 4 -name "wp-config.php" -type f 2>/dev/null
} | head -$max_results } | head -$max_results
;; ;;
esac esac