90713e5fb7
Consolidates repeated grep patterns and file checks into reusable helper functions. Provides consistent pattern matching across the script and reduces duplication. OPT-12: Regex Pattern Library (25 min effort) - grep_wp_config_define() checks if wp-config has a specific define - grep_disabled_wp_cron() checks if WP-Cron is disabled (true value) - grep_enabled_wp_cron() checks if WP-Cron is enabled or commented out - grep_in_crontab() safely searches crontab for a command string - grep_wordpress_path() validates WordPress installation directory - Impact: 3+ repeated grep patterns consolidated, consistent matching Benefits: - DRY principle enforcement - Pattern updates in one place - Consistent error handling - Easier to test and maintain Code Metrics: - Lines added: +30 (5 pattern functions) - Pattern duplication: Eliminated - Code clarity: Improved (grep_* prefix makes purpose clear) - Test: bash -n validation passed Total optimizations implemented: 14 of 20