Skip to content

Improve Surge wp-config handling #1724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 21, 2025
Merged

Improve Surge wp-config handling #1724

merged 4 commits into from
May 21, 2025

Conversation

pfefferle
Copy link
Member

Also check for WP_CACHE_CONFIG constent before fall back to regex.

Fix #1720

Proposed changes:

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Go to '..'

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Improved automated setup process for the Surge caching plugin.

@pfefferle pfefferle requested review from obenland and Copilot May 21, 2025 08:42
@pfefferle pfefferle self-assigned this May 21, 2025
@github-actions github-actions bot added the [Focus] Compatibility Ensuring the plugin plays well with other plugins label May 21, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the handling of Surge wp-config by adding conditional checks for the WP_CACHE_CONFIG constant to avoid falling back to regex operations.

  • In add_cache_config: Returns early if WP_CACHE_CONFIG is already defined.
  • In remove_cache_config: Returns early if WP_CACHE_CONFIG is not defined.
  • In tests: The test setup now defines WP_CACHE_CONFIG with a dummy value for proper simulation.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/integration/class-test-surge.php Added a WP_CACHE_CONFIG definition for test consistency with a dummy value.
integration/class-surge.php Added conditional early returns in add_cache_config and remove_cache_config methods.

@pfefferle pfefferle merged commit 70d6f8f into trunk May 21, 2025
11 checks passed
@pfefferle pfefferle deleted the fix/1720 branch May 21, 2025 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Compatibility Ensuring the plugin plays well with other plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WP_CACHE_CONFIG regex doesn’t work with concatenation
3 participants