Skip to content

Add wp cache supports <feature> command #84

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 6 commits into from
Apr 6, 2023
Merged

Add wp cache supports <feature> command #84

merged 6 commits into from
Apr 6, 2023

Conversation

janw-me
Copy link
Member

@janw-me janw-me commented Apr 5, 2023

Fixes #79

@janw-me janw-me requested a review from a team as a code owner April 5, 2023 12:46
Copy link
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

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

Can we WP_CLI::error( 'Checking cache features is only available in WordPress 6.1 and higher' ); if the function doesn't exist?

@danielbachhuber danielbachhuber changed the title Added command: wp cache supports <feature> Add wp cache supports <feature> command Apr 6, 2023
@danielbachhuber danielbachhuber added this to the 2.0.12 milestone Apr 6, 2023
Copy link
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

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

Thanks @janw-me ! I made a few changes you might enjoy reading through.

@danielbachhuber danielbachhuber merged commit cdc371f into wp-cli:main Apr 6, 2023
@@ -41,6 +41,7 @@
"cache incr",
"cache replace",
"cache set",
"cache supports",
Copy link
Member Author

Choose a reason for hiding this comment

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

@danielbachhuber I'm guessing that you add this line, run some command and it updates the README.
Can you show me how to do this?
Might come in handy next time.

Copy link
Contributor

Choose a reason for hiding this comment

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

After adding that line README.md regeneration can be even skipped and Github Actions will create a separate PR after the main PR is merged - see https://github.com/wp-cli/.github/blob/main/.github/workflows/reusable-regenerate-readme.yml

Copy link
Member

Choose a reason for hiding this comment

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

After adding that line README.md regeneration can be even skipped and Github Actions will create a separate PR after the main PR is merged - see https://github.com/wp-cli/.github/blob/main/.github/workflows/reusable-regenerate-readme.yml

Correct. However, to avoid the separate PR (which was unnecessary because I was already in the code), I simply ran wp scaffold package-readme ./ in the repository directory.

@require-wp-6.1
Scenario: Checking if the cache supports a feature
Given a WP install

Copy link
Member Author

Choose a reason for hiding this comment

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

@danielbachhuber I don't understand what use this has.
non_existing doesn't exist by default.
Wouldn't it be better to run a test on 6.1 for a feature that is defined (in 6.2)

Copy link
Member

Choose a reason for hiding this comment

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

I don't understand what use this has.

@janw-me @require-wp-6.1 means the test will only run on WordPress 6.1 and higher. WordPress 3.7 is a part of the testing matrix, so an earlier test on this branch failed: https://github.com/wp-cli/cache-command/actions/runs/4620028330/jobs/8169572449

non_existing doesn't exist by default.
Wouldn't it be better to run a test on 6.1 for a feature that is defined (in 6.2)

I think the test is fine as it is. It doesn't need to be overly complex.

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.

Add support for wp_cache_supports
3 participants