Skip to content

Conversation

danielbachhuber
Copy link
Member

@danielbachhuber danielbachhuber commented Aug 18, 2022

  • Moves config-spec.php loading to a standalone method.
  • Calls WP_CLI_CONFIG_SPEC_FILTER_CALLBACK against $config_spec if callback is defined.
  • Introduces WP_CLI_EARLY_REQUIRE environment variable for early loading of a PHP file.

Fixes #5649

@danielbachhuber danielbachhuber added this to the 2.7.0 milestone Aug 18, 2022
@danielbachhuber danielbachhuber requested a review from a team as a code owner August 18, 2022 20:19
@danielbachhuber danielbachhuber self-assigned this Aug 18, 2022
Copy link
Member

@schlessera schlessera left a comment

Choose a reason for hiding this comment

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

Here's my suggestion. Adding a definable INCLUDE seems overly permissive. A simple filter callback will be enough, and it cannot be completely abused.

danielbachhuber and others added 3 commits August 22, 2022 12:12
Co-authored-by: Alain Schlesser <alain.schlesser@gmail.com>
Co-authored-by: Alain Schlesser <alain.schlesser@gmail.com>
Copy link
Member

@schlessera schlessera left a comment

Choose a reason for hiding this comment

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

This latest approach looks fine to me. I'm not super happy about a general require, but I understand its value and I cannot think of an immediate attack vector right now that wouldn't be doable in some other already existing entrypoint anyways.

Now, how about adding tests for this?

@danielbachhuber
Copy link
Member Author

Now, how about adding tests for this?

@schlessera Added with 4073a34

@danielbachhuber
Copy link
Member Author

🎉

Thanks for your help with this, @schlessera ! Appreciate it 😊

@danielbachhuber danielbachhuber merged commit a533612 into master Aug 25, 2022
@danielbachhuber danielbachhuber deleted the load-config-spec-filterable branch August 25, 2022 20:58
@schlessera
Copy link
Member

@danielbachhuber I now noticed that the test seems to be in the wrong file. It is in the config.feature file (which deals with the wp-cli.yml et al.), but it should probably rather be in the flags.feature file.

@danielbachhuber
Copy link
Member Author

@schlessera Sorry about that! PR to fix with #5687

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow registration of custom global arguments
2 participants