Skip to content
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

Clarify error message for incorrect 'DOMAIN_CURRENT_SITE' #4022

Closed

Conversation

BhargavBhandari90
Copy link

My output will be something like this.
Site example.com/ not found. Check value of 'DOMAIN_CURRENT_SITE' into wp-config.php. It should be: Corrct Domain

@danielbachhuber
Copy link
Member

How can I get the domain from database?

Taking a step back, if a WordPress multisite instance contains dozens of domains, how would you determine the correct one?

Also, can you include a functional test that describes the behavior you'd like to see?

@danielbachhuber
Copy link
Member

@BhargavBhandari90 When do you think you'll be able to finish this up?

@BhargavBhandari90
Copy link
Author

Hi @danielbachhuber,
Sorry for the delay. Actually I didn't get any success about this. For now. I have just added a detailed notice.

And I am not aware of the functional test.

@danielbachhuber
Copy link
Member

@BhargavBhandari90 Are you planning to fix your functional test?

@BhargavBhandari90
Copy link
Author

@danielbachhuber I just updated a functional test, but it is failing in travis. I don't understand why?

Given a WP install

When I run `wp option get home`
Then STDOUT should contain:
Copy link
Member

Choose a reason for hiding this comment

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

There's a semantic difference you need to apply.

When the test is expected to fail, you'll need to use When I try instead of When I run, and Then STDERR instead of Then STDOUT because error messages are written to STDERR

@@ -1163,7 +1163,7 @@ private function setup_bootstrap_hooks() {
// In a multisite install, die if unable to find site given in --url parameter
if ( $this->is_multisite() ) {
WP_CLI::add_wp_hook( 'ms_site_not_found', function( $current_site, $domain, $path ) {
WP_CLI::error( "Site {$domain}{$path} not found." );
WP_CLI::error( "Site {$domain}{$path} not found. Check value of 'DOMAIN_CURRENT_SITE' into wp-config.php." );
Copy link
Member

Choose a reason for hiding this comment

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

I wonder how accurate of a statement "Check value of 'DOMAIN_CURRENT_SITE' into wp-config.php." is.

Is an incorrect DOMAIN_CURRENT_SITE the only reason ms_site_not_found can be triggered, or are there others too?

Copy link
Member

Choose a reason for hiding this comment

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

@jeremyfelt @felixarntz I'd love your thoughts on ^ if you have a moment.

Copy link
Author

Choose a reason for hiding this comment

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

Currently I found the only scenario for this.

Copy link
Member

Choose a reason for hiding this comment

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

This can also be triggered if DOMAIN_CURRENT_SITE is set, but the database did not contain the specific site that has been targeted (not set up yet, error in database, ...)

Choose a reason for hiding this comment

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

What @schlessera said. And it's probably also possible a couple other ways through some crazy configs. The most specific way of saying this is probably something like Site {$domain}{$path} not found on network {$domain}{$path}.

Copy link
Member

Choose a reason for hiding this comment

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

@jeremyfelt Do you think the current error logic is correct, or is there different logic / error messages that you'd use?

@@ -534,3 +534,14 @@ require_once(ABSPATH . 'wp-settings.php');
"""
http://example.com
"""

Scenario: If there is a wrong value defined for `DOMAIN_CURRENT_SITE` constant
Copy link
Member

Choose a reason for hiding this comment

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

This scenario will need to define an invalid value for DOMAIN_CURRENT_SITE in order for the error to occur...

Copy link
Author

Choose a reason for hiding this comment

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

How can I define an invalid value for that?

@danielbachhuber
Copy link
Member

Thanks for your work on this, @BhargavBhandari90.

I'm continuing this on in #4212

@BhargavBhandari90 BhargavBhandari90 deleted the issue/GH-4015 branch July 12, 2017 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants