Skip to content

Improve eval_which_host() #70

@mdrovdahl

Description

@mdrovdahl

protected function eval_which_host( \stdClass $site ): string {

The current approach in this function:

  1. uses the is_wpcom_atomic field returned by the wpcom /me/sites API endpoint. Note, that field is actually returned twice when calling "https://opsoasis.wpspecialprojects.com/wp-json/wpcomsp/wpcom/v1/sites/team51.blog/", once at the root and once in the options element.
  2. If the site is Jetpack, using the jetpack element from the wpcom /me/sites API endpoint...
    a. checks if the site url is in the list of pressable sites which comes from get_pressable_sites()
    b. Makes a remote request to check the /.well-known/hosting-provider and looks for "Pressable", otherwise defaults Jetpack sites to "Other"
  3. Otherwise assumes WP.com Simple

Suggest improvements:

  • finish the TODO to check for "wpvip.com" in the well known hosting provider section
  • I think we can identify WP.com Simple sites by looking for "wordpress.com" in the value of options.unmapped_url in the response from wpcom /me/sites API endpoint

cc: @cagrimmett if we get these done, I think we can use the results of this command as the starting point for our "who pays for what" work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions