CRITICAL FIX: Filter debug output from cache file
Problem: System detection messages (from print_info) were being captured in cache file along with actual WordPress paths, creating garbage entries Solution: Filter output to extract only lines matching /path/to/wp-config.php pattern before saving to cache file This ensures cache contains ONLY actual WordPress installation paths. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -399,8 +399,13 @@ initialize_wp_cache() {
|
||||
echo "[INFO] Scanning for WordPress installations (building cache)..." >&2
|
||||
|
||||
# Run the discovery and save to temp file for persistence
|
||||
# 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)
|
||||
# CRITICAL: Suppress stdout noise from system detection by redirecting to temp, then extracting only paths
|
||||
local temp_discovery=$(mktemp)
|
||||
get_wp_search_paths "$panel" > "$temp_discovery" 2>/dev/null
|
||||
# Extract only lines that are actual file paths (contain /home or /var, start with /)
|
||||
WP_SITES_CACHE=$(grep -E "^/.*wp-config\.php$" "$temp_discovery" 2>/dev/null || echo "")
|
||||
rm -f "$temp_discovery"
|
||||
|
||||
echo "$WP_SITES_CACHE" > "$WP_CACHE_FILE" 2>/dev/null
|
||||
WP_CACHE_INITIALIZED=1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user