-
Notifications
You must be signed in to change notification settings - Fork 1k
Validate --url parameter, warn on malformed values, and verify multisite site existence #6154
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
|
@copilot Scheme validation is nice, but most importantly we'll want to check whether a site with the current URL actually exists in the multisite. We can do that in |
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Added proactive multisite URL validation in |
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Description
Malformed
--urlvalues likehttp:/example.com(missing slash) are silently ignored. PHP'sparse_url()interprets this asscheme='http', path='/example.com'with no host, causing$_SERVER['HTTP_HOST']to remain unset. In multisite, this defaults to the primary site.This PR implements two-layered validation to address the issue:
Changes
php/class-wp-cli.php
WP_CLI::set_url()to check for missing host and invalid schemesphp/WP_CLI/Runner.php
validate_multisite_url()method to check if site exists in multisiteload_wordpress()after WordPress is fully loadedget_sites()WordPress API for clean, reliable site lookupfeatures/flags.feature
Example
Validation catches:
http:/example.com(warning)htp://example.com(warning)invalid.example.com(error after WordPress loads)example.com→http://example.comFixes #5716
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.