Compare commits
3 Commits
1b926be3ff
...
db093d7b9b
| Author | SHA1 | Date | |
|---|---|---|---|
| db093d7b9b | |||
| 79978c7d43 | |||
| 172a115175 |
+23
-2
@@ -325,11 +325,19 @@ staggered_timing:
|
|||||||
|
|
||||||
wp-config_modification:
|
wp-config_modification:
|
||||||
function: disable_wpcron_in_config()
|
function: disable_wpcron_in_config()
|
||||||
location: Line 2 after <?php tag
|
location: Before "/* That's all, stop editing! */" comment (proper WordPress convention)
|
||||||
|
fallback: After <?php tag if "stop editing" not found
|
||||||
adds: define('DISABLE_WP_CRON', true);
|
adds: define('DISABLE_WP_CRON', true);
|
||||||
safety: Backup created, verification, rollback on failure
|
safety: Removes existing entries first, backup created, verification, rollback on failure
|
||||||
format: User crontabs (crontab -u $user) not system crontab
|
format: User crontabs (crontab -u $user) not system crontab
|
||||||
|
|
||||||
|
domain_lookup_method:
|
||||||
|
# Fixed 2025-11-10 - Two-step lookup process
|
||||||
|
method_1: Check main_domain in /var/cpanel/userdata/*/main files (YAML: main_domain:)
|
||||||
|
method_2: Fallback to search domain-specific files for servername (YAML: servername:)
|
||||||
|
skip_files: "*.cache, */main, */cache, */cache.json"
|
||||||
|
rationale: cPanel stores main_domain in main files, servername in domain-specific files
|
||||||
|
|
||||||
cron_job_format: |
|
cron_job_format: |
|
||||||
0,15,30,45 * * * * cd /home/user/public_html && /usr/bin/php -q wp-cron.php >/dev/null 2>&1
|
0,15,30,45 * * * * cd /home/user/public_html && /usr/bin/php -q wp-cron.php >/dev/null 2>&1
|
||||||
|
|
||||||
@@ -345,6 +353,19 @@ options:
|
|||||||
0: Return to menu (cancel)
|
0: Return to menu (cancel)
|
||||||
|
|
||||||
[RECENT_COMMITS]
|
[RECENT_COMMITS]
|
||||||
|
# Latest changes (2025-11-10)
|
||||||
|
|
||||||
|
commit: 172a115
|
||||||
|
date: 2025-11-10
|
||||||
|
title: Fix domain lookup in WordPress Cron Manager
|
||||||
|
files: modules/website/wordpress/wordpress-cron-manager.sh
|
||||||
|
changes:
|
||||||
|
- Fixed broken domain lookup (was only searching /var/cpanel/userdata/*/main for servername:)
|
||||||
|
- Added two-step lookup: main_domain in main files, then servername in domain files
|
||||||
|
- Applied fix to options 2, 5, 6 (all domain lookup locations)
|
||||||
|
- Skip cache files during search
|
||||||
|
testing: Verified with pickledperil.com - lookup now works correctly
|
||||||
|
|
||||||
# Latest changes (2025-11-07)
|
# Latest changes (2025-11-07)
|
||||||
|
|
||||||
commit: 56776a1
|
commit: 56776a1
|
||||||
|
|||||||
@@ -352,6 +352,9 @@ parse_logs() {
|
|||||||
|
|
||||||
# Parse all domain logs (excluding -bytes_log, .offset, and error_log files)
|
# Parse all domain logs (excluding -bytes_log, .offset, and error_log files)
|
||||||
# cPanel creates files like: domain.com, domain.com-ssl_log
|
# cPanel creates files like: domain.com, domain.com-ssl_log
|
||||||
|
local file_count=0
|
||||||
|
local progress_interval=50
|
||||||
|
echo ""
|
||||||
find "$LOG_DIR" -type f ! -name "*-bytes_log" ! -name "*.offset" ! -name "*error_log" "${find_opts[@]}" 2>/dev/null | while read -r logfile; do
|
find "$LOG_DIR" -type f ! -name "*-bytes_log" ! -name "*.offset" ! -name "*error_log" "${find_opts[@]}" 2>/dev/null | while read -r logfile; do
|
||||||
# Skip empty files
|
# Skip empty files
|
||||||
[ -s "$logfile" ] || continue
|
[ -s "$logfile" ] || continue
|
||||||
@@ -365,6 +368,12 @@ parse_logs() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Show progress every N files
|
||||||
|
file_count=$((file_count + 1))
|
||||||
|
if [ $((file_count % progress_interval)) -eq 0 ]; then
|
||||||
|
echo -ne "\r Parsed $file_count log files... (current: $domain)"
|
||||||
|
fi
|
||||||
|
|
||||||
# Parse Apache Combined Log Format with error handling
|
# Parse Apache Combined Log Format with error handling
|
||||||
# Format: IP - - [timestamp] "METHOD URL PROTOCOL" STATUS SIZE "REFERRER" "USER-AGENT"
|
# Format: IP - - [timestamp] "METHOD URL PROTOCOL" STATUS SIZE "REFERRER" "USER-AGENT"
|
||||||
awk -v domain="$domain" '
|
awk -v domain="$domain" '
|
||||||
@@ -411,6 +420,9 @@ parse_logs() {
|
|||||||
}' "$logfile" >> "$TEMP_DIR/parsed_logs.txt" 2>/dev/null
|
}' "$logfile" >> "$TEMP_DIR/parsed_logs.txt" 2>/dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Clear the progress line
|
||||||
|
echo -ne "\r\033[K"
|
||||||
|
|
||||||
if [ ! -s "$TEMP_DIR/parsed_logs.txt" ]; then
|
if [ ! -s "$TEMP_DIR/parsed_logs.txt" ]; then
|
||||||
print_alert "No log entries were parsed. Check log format or permissions."
|
print_alert "No log entries were parsed. Check log format or permissions."
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -221,9 +221,12 @@ case "$choice" in
|
|||||||
echo "Searching for WordPress installation for $domain..."
|
echo "Searching for WordPress installation for $domain..."
|
||||||
|
|
||||||
# Try to find via cPanel user data
|
# Try to find via cPanel user data
|
||||||
|
# Search both main_domain (in main files) and servername (in domain files)
|
||||||
wp_config=""
|
wp_config=""
|
||||||
|
|
||||||
|
# Method 1: Check main_domain in /var/cpanel/userdata/*/main files
|
||||||
for userdata_file in /var/cpanel/userdata/*/main; do
|
for userdata_file in /var/cpanel/userdata/*/main; do
|
||||||
if grep -q "^servername: $domain" "$userdata_file" 2>/dev/null; then
|
if grep -q "^main_domain: $domain" "$userdata_file" 2>/dev/null; then
|
||||||
user=$(basename "$(dirname "$userdata_file")")
|
user=$(basename "$(dirname "$userdata_file")")
|
||||||
potential_config="/home/$user/public_html/wp-config.php"
|
potential_config="/home/$user/public_html/wp-config.php"
|
||||||
if [ -f "$potential_config" ]; then
|
if [ -f "$potential_config" ]; then
|
||||||
@@ -233,6 +236,26 @@ case "$choice" in
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# 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
|
||||||
|
# Skip cache files and main files
|
||||||
|
[[ "$userdata_file" == *.cache ]] && continue
|
||||||
|
[[ "$userdata_file" == */main ]] && continue
|
||||||
|
[[ "$userdata_file" == */cache ]] && continue
|
||||||
|
[[ "$userdata_file" == */cache.json ]] && continue
|
||||||
|
|
||||||
|
if grep -q "^servername: $domain" "$userdata_file" 2>/dev/null; then
|
||||||
|
user=$(basename "$(dirname "$userdata_file")")
|
||||||
|
potential_config="/home/$user/public_html/wp-config.php"
|
||||||
|
if [ -f "$potential_config" ]; then
|
||||||
|
wp_config="$potential_config"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$wp_config" ]; then
|
if [ -z "$wp_config" ]; then
|
||||||
print_error "WordPress installation not found for $domain"
|
print_error "WordPress installation not found for $domain"
|
||||||
press_enter
|
press_enter
|
||||||
@@ -463,8 +486,10 @@ case "$choice" in
|
|||||||
|
|
||||||
# Find WordPress for domain
|
# Find WordPress for domain
|
||||||
wp_config=""
|
wp_config=""
|
||||||
|
|
||||||
|
# Method 1: Check main_domain in main files
|
||||||
for userdata_file in /var/cpanel/userdata/*/main; do
|
for userdata_file in /var/cpanel/userdata/*/main; do
|
||||||
if grep -q "^servername: $domain" "$userdata_file" 2>/dev/null; then
|
if grep -q "^main_domain: $domain" "$userdata_file" 2>/dev/null; then
|
||||||
user=$(basename "$(dirname "$userdata_file")")
|
user=$(basename "$(dirname "$userdata_file")")
|
||||||
potential_config="/home/$user/public_html/wp-config.php"
|
potential_config="/home/$user/public_html/wp-config.php"
|
||||||
if [ -f "$potential_config" ]; then
|
if [ -f "$potential_config" ]; then
|
||||||
@@ -474,6 +499,25 @@ case "$choice" in
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Method 2: Search domain-specific files for servername
|
||||||
|
if [ -z "$wp_config" ]; then
|
||||||
|
for userdata_file in /var/cpanel/userdata/*/*; do
|
||||||
|
[[ "$userdata_file" == *.cache ]] && continue
|
||||||
|
[[ "$userdata_file" == */main ]] && continue
|
||||||
|
[[ "$userdata_file" == */cache ]] && continue
|
||||||
|
[[ "$userdata_file" == */cache.json ]] && continue
|
||||||
|
|
||||||
|
if grep -q "^servername: $domain" "$userdata_file" 2>/dev/null; then
|
||||||
|
user=$(basename "$(dirname "$userdata_file")")
|
||||||
|
potential_config="/home/$user/public_html/wp-config.php"
|
||||||
|
if [ -f "$potential_config" ]; then
|
||||||
|
wp_config="$potential_config"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$wp_config" ]; then
|
if [ -z "$wp_config" ]; then
|
||||||
print_error "WordPress not found for $domain"
|
print_error "WordPress not found for $domain"
|
||||||
press_enter
|
press_enter
|
||||||
@@ -573,8 +617,10 @@ case "$choice" in
|
|||||||
|
|
||||||
# Find WordPress installation
|
# Find WordPress installation
|
||||||
wp_config=""
|
wp_config=""
|
||||||
|
|
||||||
|
# Method 1: Check main_domain in main files
|
||||||
for userdata_file in /var/cpanel/userdata/*/main; do
|
for userdata_file in /var/cpanel/userdata/*/main; do
|
||||||
if grep -q "^servername: $domain" "$userdata_file" 2>/dev/null; then
|
if grep -q "^main_domain: $domain" "$userdata_file" 2>/dev/null; then
|
||||||
user=$(basename "$(dirname "$userdata_file")")
|
user=$(basename "$(dirname "$userdata_file")")
|
||||||
potential_config="/home/$user/public_html/wp-config.php"
|
potential_config="/home/$user/public_html/wp-config.php"
|
||||||
if [ -f "$potential_config" ]; then
|
if [ -f "$potential_config" ]; then
|
||||||
@@ -584,6 +630,25 @@ case "$choice" in
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Method 2: Search domain-specific files for servername
|
||||||
|
if [ -z "$wp_config" ]; then
|
||||||
|
for userdata_file in /var/cpanel/userdata/*/*; do
|
||||||
|
[[ "$userdata_file" == *.cache ]] && continue
|
||||||
|
[[ "$userdata_file" == */main ]] && continue
|
||||||
|
[[ "$userdata_file" == */cache ]] && continue
|
||||||
|
[[ "$userdata_file" == */cache.json ]] && continue
|
||||||
|
|
||||||
|
if grep -q "^servername: $domain" "$userdata_file" 2>/dev/null; then
|
||||||
|
user=$(basename "$(dirname "$userdata_file")")
|
||||||
|
potential_config="/home/$user/public_html/wp-config.php"
|
||||||
|
if [ -f "$potential_config" ]; then
|
||||||
|
wp_config="$potential_config"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$wp_config" ]; then
|
if [ -z "$wp_config" ]; then
|
||||||
print_error "WordPress installation not found for $domain"
|
print_error "WordPress installation not found for $domain"
|
||||||
press_enter
|
press_enter
|
||||||
|
|||||||
Reference in New Issue
Block a user