Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#33620 closed defect (bug) (fixed)

When creating a new subdirectory site, scheme is always set to http

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords: has-patch has-unit-tests commit
Focuses: multisite Cc:

Description

As reported by @thomaswm: 14172#comment:16

When adding a new site to a multisite that uses https only and uses subdirectories, the scheme for the new site is set to http instead of https.

The same issue affects subdomain installations too, but as per #27499 this is a wontfix due to potential issues with SSL/TLS configuration. It should be fixed for subdirectory installations though. A patch similar to the one on #27499 could be used, with a condition that it only operates on subdirectory installations.

Attachments (3)

33620.diff (566 bytes) - added by tryon 9 years ago.
Until #14867 is resolved, this sets the schema to https if the site being created is part of a sub directory install and the site home is also https. based on https://core.trac.wordpress.org/attachment/ticket/27499/27499.diff
33620.test.diff (1.1 KB) - added by tryon 9 years ago.
A unit test for 33620.diff
33620.2.diff (3.0 KB) - added by johnbillion 9 years ago.

Download all attachments as: .zip

Change History (11)

#1 follow-up: @johnbillion
9 years ago

This is blocked by #33041

#2 in reply to: ↑ 1 @thomaswm
9 years ago

Replying to johnbillion:

This is blocked by #33041

I wonder why install_blog() calls get_blogaddress_by_id() to retrieve the URL from the database when it could have just as easily been passed to install_blog() as a function parameter. The path and domain are stored as variables in wpmu_create_blog() but they aren't passed on to install_blog().

Line 1161 in wp-includes/ms-functions.php would have to be changed to

install_blog($blog_id, $title, $url);

and then the call to get_blogaddress_by_id() would be obsolete.

Last edited 9 years ago by thomaswm (previous) (diff)

@tryon
9 years ago

Until #14867 is resolved, this sets the schema to https if the site being created is part of a sub directory install and the site home is also https. based on https://core.trac.wordpress.org/attachment/ticket/27499/27499.diff

#3 follow-up: @tryon
9 years ago

While 33620.diff does automatically pick the schema, is that the best experience for the user when creating a site? Should we add an option to /wp-admin/network/site-new.php that allows them to chose if the new site should be http or https?

#4 in reply to: ↑ 3 @thomaswm
9 years ago

Replying to tryon:

While 33620.diff does automatically pick the schema, is that the best experience for the user when creating a site? Should we add an option to /wp-admin/network/site-new.php that allows them to chose if the new site should be http or https?

It would definitely be nice if the scheme could be chosen in site-new.php. There's already a ticket for the modification of this admin page: #31240

#5 @johnbillion
9 years ago

  • Milestone changed from Awaiting Review to 4.4
  • Owner set to johnbillion
  • Status changed from new to reviewing

@tryon
9 years ago

A unit test for 33620.diff

@johnbillion
9 years ago

#6 @johnbillion
9 years ago

  • Keywords has-patch has-unit-tests added; needs-patch removed

33620.2.diff expands on @tryon's patch to correctly handle sites which use mixed HTTP/HTTPS schemes, and adds tests for the various incarnations.

#7 @johnbillion
9 years ago

  • Keywords commit added

#8 @johnbillion
9 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 34916:

Correctly set the scheme of the home and siteurl options when creating a new site on multisite that uses some combination of HTTPS in the admin area or on the front end.

Fixes #33620
Props tryon, johnbillion

Note: See TracTickets for help on using tickets.