From d24e4ffecf0013522d087b6906985217249966b7 Mon Sep 17 00:00:00 2001 From: cschantz Date: Mon, 2 Mar 2026 23:45:19 -0500 Subject: [PATCH] FIX: Correct maxdepth values for WordPress discovery across all panels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../wordpress/wordpress-cron-manager.sh | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/website/wordpress/wordpress-cron-manager.sh b/modules/website/wordpress/wordpress-cron-manager.sh index 6fc2214..549e2cb 100755 --- a/modules/website/wordpress/wordpress-cron-manager.sh +++ b/modules/website/wordpress/wordpress-cron-manager.sh @@ -293,31 +293,31 @@ get_wp_search_paths() { case "$panel" in cpanel) - # Search depth 2 (primary): /home/USER/public_html/wp-config.php - # Search depth 3 (addon): /home/USER/public_html/ADDON/wp-config.php - # Limited depth prevents recursion into wp-content, node_modules, etc. - { - find /home -maxdepth 2 -path "*/public_html/wp-config.php" -type f 2>/dev/null - find /home -maxdepth 3 -path "*/public_html/*/wp-config.php" -type f 2>/dev/null - } | head -$max_results + # Search with limited depth to find WordPress installations + # Depth structure: /home (0) -> USER (1) -> public_html (2) -> [ADDON] (3) -> wp-config.php + # 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 4 -name "wp-config.php" -type f 2>/dev/null | head -$max_results ;; interworx) - # Standard: /home/USER/DOMAIN/html/wp-config.php (depth 3) - # Chroot: /chroot/home/USER/var/DOMAIN/html/wp-config.php (depth 5) + # Standard: /home (0) -> USER (1) -> DOMAIN (2) -> html (3) -> wp-config.php (maxdepth 3) + # 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 /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 ;; plesk) - # All domains under /var/www/vhosts/DOMAIN/httpdocs/wp-config.php (depth 3) - find /var/www/vhosts -maxdepth 3 -name "wp-config.php" -type f 2>/dev/null | head -$max_results + # Structure: /var (0) -> www (1) -> vhosts (2) -> DOMAIN (2) -> httpdocs (2) -> wp-config.php (maxdepth 2) + 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 + # /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 /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 ;; esac