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

Improve multi-network support in WP-CLI multisite commands #3687

Closed
jeremyfelt opened this Issue Dec 23, 2016 · 6 comments

Comments

2 participants
@jeremyfelt

jeremyfelt commented Dec 23, 2016

This is written using wp super-admin as the main example, though there are probably a handful of things that could be affected depending on the path of action.

Retrieving a list of super admins for the non-primary network is possible with wp super-admin list --url=network2.site.url, but it's not so easy to generate a list of network site URLs. Even though siteurl is network meta, actual network lookup is done based on the domain and path from the wp_site table. It would be more accurate to have something like wp network list --fields=domain,path or something.

It is slightly easier to generate a list of network IDs with something like wp site list --field=site_id | sort -n | uniq. It's kind of hacky, but could be piped to wp super-admin remove user --network_id=%.

It looks like network was initially planned as an option for wp super-admin in #819, but wasn't implemented due to how uncommon multi-network installations are.

All of that leads me to wonder whether it makes sense to:

  • Create a PR to add support for network_id to wp super-admin.
  • Create a PR to start adding support for wp network and subcommands.
  • Create a package (maybe with parts of wp-multi-network) for those unlikely multi-networkers.

One caveat to any of these approaches is that the nicer multi-network stuff in WordPress core has only been available in the last few releases. I guess that could be one argument toward making a package and declaring support for WP 4.6+.

Thoughts?

@danielbachhuber

This comment has been minimized.

Show comment
Hide comment
@danielbachhuber

danielbachhuber Dec 23, 2016

Member

Thoughts?

There's a lot going on here :)

I don't think adding a --network_id=<id> argument to wp super-admin makes sense. The established paradigm for running a command against a given site (including the primary site for a network) is the --url=<url> global parameter.

I do see an argument for making it easier to filter wp site list to only display the primary site for each network. You could then do something like wp site list --network-primary --field=url and pass to xargs.

One caveat to any of these approaches is that the nicer multi-network stuff in WordPress core has only been available in the last few releases. I guess that could be one argument toward making a package and declaring support for WP 4.6+.

What network features aren't covered in existing WP-CLI commands?

Member

danielbachhuber commented Dec 23, 2016

Thoughts?

There's a lot going on here :)

I don't think adding a --network_id=<id> argument to wp super-admin makes sense. The established paradigm for running a command against a given site (including the primary site for a network) is the --url=<url> global parameter.

I do see an argument for making it easier to filter wp site list to only display the primary site for each network. You could then do something like wp site list --network-primary --field=url and pass to xargs.

One caveat to any of these approaches is that the nicer multi-network stuff in WordPress core has only been available in the last few releases. I guess that could be one argument toward making a package and declaring support for WP 4.6+.

What network features aren't covered in existing WP-CLI commands?

@danielbachhuber

This comment has been minimized.

Show comment
Hide comment
@danielbachhuber

danielbachhuber Jan 10, 2017

Member

@jeremyfelt Anything further you want to discuss here?

Member

danielbachhuber commented Jan 10, 2017

@jeremyfelt Anything further you want to discuss here?

@jeremyfelt

This comment has been minimized.

Show comment
Hide comment
@jeremyfelt

jeremyfelt Jan 11, 2017

Ooph, reading back... that was a dump of a request. Thanks for parsing it. :)

I do see an argument for making it easier to filter wp site list to only display the primary site for each network. You could then do something like wp site list --network-primary --field=url and pass to xargs.

I think this is probably the right idea.

WordPress doesn't really track the relationship between a network and its primary site. The best way to do it now is to compare the domain and path of each row from wp_site with the matching record in wp_blogs. Right now this would mean an additional query per network to generate that list.

Is that too hacky for something to build into WP-CLI?

jeremyfelt commented Jan 11, 2017

Ooph, reading back... that was a dump of a request. Thanks for parsing it. :)

I do see an argument for making it easier to filter wp site list to only display the primary site for each network. You could then do something like wp site list --network-primary --field=url and pass to xargs.

I think this is probably the right idea.

WordPress doesn't really track the relationship between a network and its primary site. The best way to do it now is to compare the domain and path of each row from wp_site with the matching record in wp_blogs. Right now this would mean an additional query per network to generate that list.

Is that too hacky for something to build into WP-CLI?

@danielbachhuber

This comment has been minimized.

Show comment
Hide comment
@danielbachhuber

danielbachhuber Jan 11, 2017

Member

No, I think this would be fine.

Member

danielbachhuber commented Jan 11, 2017

No, I think this would be fine.

@danielbachhuber

This comment has been minimized.

Show comment
Hide comment
@danielbachhuber

danielbachhuber Jan 25, 2017

Member

WordPress doesn't really track the relationship between a network and its primary site. The best way to do it now is to compare the domain and path of each row from wp_site with the matching record in wp_blogs. Right now this would mean an additional query per network to generate that list.

Could you describe in greater detail what this logic should be? I'd like to get this flag either implemented or punted.

Member

danielbachhuber commented Jan 25, 2017

WordPress doesn't really track the relationship between a network and its primary site. The best way to do it now is to compare the domain and path of each row from wp_site with the matching record in wp_blogs. Right now this would mean an additional query per network to generate that list.

Could you describe in greater detail what this logic should be? I'd like to get this flag either implemented or punted.

@danielbachhuber

This comment has been minimized.

Show comment
Hide comment
@danielbachhuber

danielbachhuber Feb 7, 2017

Member

We can revisit this when there's some momentum around the issue.

Member

danielbachhuber commented Feb 7, 2017

We can revisit this when there's some momentum around the issue.

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