-
Notifications
You must be signed in to change notification settings - Fork 268
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
Blueprints: Add enableMultisite step #888
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This step enables multisite support in the WordPress installation. It does not create any sites, but it does create the necessary tables in the database. Example Blueprint: ```json { "landingPage":"/wp-admin/network.php", "steps": [ { "step": "enableMultisite" } ] } ``` ## URL rewriting This PR also ships a URL rewriting logic in the service worker. This is to ensure that requests to URLs like `/mysite/wp-admin/` are still resolved to the `/wp-admin/index.php` file. Internally, this is done by adding a `x-rewrite-url` header to the request whenever the URL matches a rewrite rule after an initial 404. CC @dmsnell
adamziel
force-pushed
the
experiment/multisite-support
branch
from
January 23, 2024 13:29
e4e247c
to
d5c2b19
Compare
adamziel
added
[Type] Enhancement
New feature or request
[Package][@wp-playground] Blueprints
labels
Jan 23, 2024
adamziel
changed the title
Noodling on multisites
@adamziel Blueprints: Add enableMultisite step
Jan 23, 2024
adamziel
commented
Jan 23, 2024
adamziel
commented
Jan 23, 2024
adamziel
commented
Jan 23, 2024
Closed
This could be related to URL rewriting – multisites send these requests to |
…te-database-integration
Otherwise WordPress doesn't know which site to load when it's booting up with a CLI script that simply requires `wp-load.php`.
adamziel
changed the title
@adamziel Blueprints: Add enableMultisite step
Blueprints: Add enableMultisite step
Jan 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds a
enableMultisite
step that turns Playground into a Multisite WordPress installation. The step does not create any sites, but it does create all the necessary tables in the database. In particular, it:admin
/password
. Ideally it would just run a script, but I didn't find a working way to do it.sunrise.php
file to tell WordPress which site is the default one by populating the$_SERVER
array.Example Blueprint:
Other changes
URL rewriting
This PR also ships a URL rewriting logic in the service worker. This
is to ensure that requests to URLs like
/mysite/wp-admin/
are stillresolved to the
/wp-admin/index.php
file.Internally, this is done by adding a
x-rewrite-url
header to therequest whenever the URL matches a rewrite rule after an initial 404.
Move the sqlite-database-integration plugin to mu-plugins
Activating a multisite requires disabling all the plugins. However, we cannot disable the SQLite integration plugin as the database connection relies on it. Therefore, this PR makes the SQLite integration an mu-plugin instead to ensure it is always on and unaffected by the multisite activation.
E2E tests in CI now run with
sudo
Multisites don't work with custom port numbers like the
http://localhost:5400
used by Playground's CI. Therefore, this PR rewires the CI E2E setup to use justhttp://localhost
and starts the tests withsudo
to enable binding to port80
.Testing instructions
Multisites don't work with non-standard ports, like
localhost:5400
used by Playground dev server. To test this PR, you'll need a local test domain running via HTTPS.One way to get it set up is with Laravel Valet. Once your Valet is installed, run:
Your dev server is now available via https://playground.test.
Follow-up work
/wp-admin
. This will allow this step to work even when the admin username and password are customized.