FIX: Correct sed pattern for removing DISABLE_WP_CRON from wp-config
Fixed issue where re-enable operations (Options 6, 7, 8) were not actually removing the DISABLE_WP_CRON line from wp-config.php despite claiming success. Changed from complex extended regex pattern that wasn't matching: sed -i.wpbak -E '#define[[:space:]]*\(.*#d' To simpler, more reliable pattern: sed -i.wpbak '/define.*DISABLE_WP_CRON.*true.*;/d' Tested patterns: ❌ Original pattern: Failed to match ✅ Fixed pattern: Successfully removes the line ✅ Verified via diff: Line properly deleted from wp-config.php This fix enables Options 6, 7, 8 (re-enable operations) to work correctly. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1467,10 +1467,10 @@ extract_user_from_path() {
|
||||
remove_disable_wpcron_from_config() {
|
||||
local wp_config="$1"
|
||||
|
||||
# Remove any existing DISABLE_WP_CRON lines using extended regex
|
||||
# Pattern matches: define('DISABLE_WP_CRON', true);
|
||||
# With flexibility for spacing and quotes
|
||||
sed -i.wpbak -E '#define[[:space:]]*\([[:space:]]*['\''"]'"$WP_CRON_DISABLED_VAR"'['\''"][[:space:]]*,[[:space:]]*true[[:space:]]*\)#d' "$wp_config"
|
||||
# Remove any existing DISABLE_WP_CRON lines using simple pattern
|
||||
# Pattern matches: define('DISABLE_WP_CRON', true); and similar variations
|
||||
# Simplified from complex extended regex that wasn't matching properly
|
||||
sed -i.wpbak '/define.*DISABLE_WP_CRON.*true.*;/d' "$wp_config"
|
||||
return $?
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user