Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement network-specific metadata handling in commands. #518

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

Open
spacedmonkey wants to merge 1 commit into wp-cli:main
base: main
Choose a base branch
Loading
from spacedmonkey:fix/network-meta

Conversation

@spacedmonkey
Copy link

@spacedmonkey spacedmonkey commented Jan 22, 2025

Added overrides for add, update, get, and delete metadata methods to utilize network-specific options when available. This ensures compatibility and functionality for multisite network scenarios. Fallbacks to standard metadata functions are maintained for non-network environments.

Add function exists, to ensure compatablity with 4.2 below.

Fixes #504

Added overrides for add, update, get, and delete metadata methods to utilize network-specific options when available. This ensures compatibility and functionality for multisite network scenarios. Fallbacks to standard metadata functions are maintained for non-network environments.
@spacedmonkey spacedmonkey requested a review from a team as a code owner January 22, 2025 01:14
Copy link
Author

Pinging maintainers to get eyes on this @swissspidy @danielbachhuber @schlessera

Copy link
Member

Note that we get pinged automatically with the review request :)

Copy link
Member

Two thoughts:

  1. Network meta command accessing the incorrect caches #504 mentions steps to reproduce the issue — this could be added as a Behat test.
  2. Looking at https://core.trac.wordpress.org/ticket/61467, it sounds like this could just as well be fixed only in core — so why this change here? Could we just wait for the core fix?

Copy link

Note that we get pinged automatically with the review request :)

No one was assigned for a code reviewers. Maybe this repo needs a codeowner file 🤔

#504 mentions steps to reproduce the issue — this could be added as a Behat test.

Before spending any time on getting tests to work, I wanted to make sure everyone was happy with the approach.

Looking at https://core.trac.wordpress.org/ticket/61467, it sounds like this could just as well be fixed only in core — so why this change here? Could we just wait for the core fix?

The core patch is not confirmed yet and not work. Also that will only fix the issue with 6.8+. WP CLI support down to 3.7. Fixing this here is to ensure BC.

swissspidy reacted with thumbs up emoji

Copy link
Member

No one was assigned for a code reviewers.

Screenshot 2025年01月22日 at 14 51 12
Screenshot 2025年01月22日 at 14 51 05

Before spending any time on getting tests to work, I wanted to make sure everyone was happy with the approach.

It looks reasonable to me in theory, yes.

Copy link

No one was assigned for a code reviewers.

This is what I see

Screenshot 2025年01月22日 at 09 06 11
swissspidy reacted with eyes emoji

Copy link
Member

Yes, approach looks good, @jonnynews. If we add the tests from #504 , this will be good to go.

Copy link
Member

According to the issue description, the following test should reproduce the situation:

 Scenario: Network meta is actually network options
 Given a WP multisite install
 When I run `wp eval 'update_network_option( 1, "mykey", "123" );'`
 And I run `wp eval 'echo get_network_option( 1, "mykey" );'`
 Then STDOUT should be:
 """
 123
 """
 When I run `wp network meta update 1 mykey 456`
 Then STDOUT should be:
 """
 Success: Updated custom field 'mykey'.
 """
 When I run `wp network meta get 1 mykey`
 Then STDOUT should be:
 """
 456
 """
 When I run `wp eval 'echo get_network_option( 1, "mykey" );'`
 Then STDOUT should be:
 """
 456
 """

Is that accurate?

Because this currently passes for me on main... 🤔

@github-actions github-actions bot added command:network-meta Related to 'network meta' command command:network-meta-add Related to 'network meta add' command command:network-meta-delete Related to 'network meta delete' command command:network-meta-get Related to 'network meta get' command command:network-meta-update Related to 'network meta update' command labels Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

command:network-meta Related to 'network meta' command command:network-meta-add Related to 'network meta add' command command:network-meta-delete Related to 'network meta delete' command command:network-meta-get Related to 'network meta get' command command:network-meta-update Related to 'network meta update' command

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Network meta command accessing the incorrect caches

AltStyle によって変換されたページ (->オリジナル) /