Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
REST API: Rename check_domain_is_available() to check_url_is_availabl…
…e().

The method checks both the `domain` and `path` of a prepared site, not
just the domain, so `check_domain_is_available()` was a misleading name.
Renamed to check_url_is_available() (domain + path together form the
site's URL) and updated its one call site accordingly. Docblock already
described the domain+path behavior correctly and needed no changes; no
tests reference the method by name, and the existing domain/path-taken
conflict tests (test_create_item_domain_validation, test_update_item_*)
continue to pass unchanged since this is a pure rename with no behavior
change.

See #40365.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
  • Loading branch information
spacedmonkey and claude committed Sep 28, 2026
commit 4ef13589720a6956e4ded2264e0d31be3717735e
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,9 @@ protected function prepare_item_for_database( $request ) {
$prepared_site['domain'] = $request['domain'];
}

$domain_check = $this->check_domain_is_available( $prepared_site, $request );
if ( is_wp_error( $domain_check ) ) {
return $domain_check;
$url_check = $this->check_url_is_available( $prepared_site, $request );
if ( is_wp_error( $url_check ) ) {
return $url_check;
}

/**
Expand Down Expand Up @@ -1173,7 +1173,7 @@ private function is_valid_path( $path ) {
* @param WP_REST_Request $request The current request.
* @return true|WP_Error True if the domain and path are available, WP_Error otherwise.
*/
protected function check_domain_is_available( $prepared_site, $request ) {
protected function check_url_is_available( $prepared_site, $request ) {
$id = (int) $request['id'];
$domain = isset( $prepared_site['domain'] ) ? $prepared_site['domain'] : '';
$path = isset( $prepared_site['path'] ) ? $prepared_site['path'] : '/';
Expand Down