Fix final 2 hardcoded /var/cpanel paths in wordpress-cron-manager
FIXES:
wordpress-cron-manager.sh:
- Line 288-289: /var/cpanel/userdata → ${SYS_CPANEL_USERDATA_DIR:-/var/cpanel/userdata}
- Line 301-302: /var/cpanel/userdata → $userdata_base (uses same variable)
IMPACT:
- WordPress cron manager now uses configurable paths
- Better compatibility with customized cPanel installations
- Consistent with other toolkit modules
QA STATUS:
- MEDIUM issues: Should be 0 now (was 9)
- Remaining: 11 LOW issues only
This commit is contained in:
@@ -285,7 +285,8 @@ case "$choice" in
|
||||
case "$SYS_CONTROL_PANEL" in
|
||||
cpanel)
|
||||
# Method 1: Check main_domain in /var/cpanel/userdata/*/main files
|
||||
for userdata_file in /var/cpanel/userdata/*/main; do
|
||||
local userdata_base="${SYS_CPANEL_USERDATA_DIR:-/var/cpanel/userdata}"
|
||||
for userdata_file in "$userdata_base"/*/main; do
|
||||
if grep -q "^main_domain: $domain" "$userdata_file" 2>/dev/null; then
|
||||
user=$(basename "$(dirname "$userdata_file")")
|
||||
potential_config="/home/$user/public_html/wp-config.php"
|
||||
@@ -298,7 +299,7 @@ case "$choice" in
|
||||
|
||||
# Method 2: If not found, search all domain-specific files for servername
|
||||
if [ -z "$wp_config" ]; then
|
||||
for userdata_file in /var/cpanel/userdata/*/*; do
|
||||
for userdata_file in "$userdata_base"/*/*; do
|
||||
# Skip cache files and main files
|
||||
[[ "$userdata_file" == *.cache ]] && continue
|
||||
[[ "$userdata_file" == */main ]] && continue
|
||||
|
||||
Reference in New Issue
Block a user