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