CRITICAL FIX: Suppress debug output when capturing cache
Problem: initialize_wp_cache() was capturing debug output from system detection, filling cache file with [INFO]/[OK] messages instead of just WordPress paths Solution: Redirect stderr when calling get_wp_search_paths to suppress debug output This caused 12 extra lines of garbage in the cache, appearing as '.' entries when the script tried to process them as file paths. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -399,13 +399,14 @@ initialize_wp_cache() {
|
|||||||
echo "[INFO] Scanning for WordPress installations (building cache)..." >&2
|
echo "[INFO] Scanning for WordPress installations (building cache)..." >&2
|
||||||
|
|
||||||
# Run the discovery and save to temp file for persistence
|
# Run the discovery and save to temp file for persistence
|
||||||
WP_SITES_CACHE=$(get_wp_search_paths "$panel")
|
# CRITICAL: Suppress all output from get_wp_search_paths to avoid capturing debug messages
|
||||||
|
WP_SITES_CACHE=$(get_wp_search_paths "$panel" 2>/dev/null)
|
||||||
echo "$WP_SITES_CACHE" > "$WP_CACHE_FILE" 2>/dev/null
|
echo "$WP_SITES_CACHE" > "$WP_CACHE_FILE" 2>/dev/null
|
||||||
WP_CACHE_INITIALIZED=1
|
WP_CACHE_INITIALIZED=1
|
||||||
|
|
||||||
# Report count to help diagnose missed installs
|
# Report count to help diagnose missed installs
|
||||||
local site_count
|
local site_count
|
||||||
site_count=$(echo "$WP_SITES_CACHE" | grep -c "wp-config" 2>/dev/null || echo 0)
|
site_count=$(echo "$WP_SITES_CACHE" | wc -l 2>/dev/null)
|
||||||
echo "[INFO] Found $site_count WordPress installation(s). Cache saved (valid 1 hour)." >&2
|
echo "[INFO] Found $site_count WordPress installation(s). Cache saved (valid 1 hour)." >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user