-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
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 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,11 +86,40 @@ async function configureWordPress( environment, config, spinner ) { | |
// Ignore error. | ||
} | ||
|
||
const installCommand = `wp core install --url="${ config.env[ environment ].config.WP_SITEURL }" --title="${ config.name }" --admin_user=admin --admin_password=password [email protected] --skip-email`; | ||
const isMultisite = config.env[ environment ].multisite; | ||
|
||
const installMethod = isMultisite ? 'multisite-install' : 'install'; | ||
const installCommand = `wp core ${ installMethod } --url="${ config.env[ environment ].config.WP_SITEURL }" --title="${ config.name }" --admin_user=admin --admin_password=password [email protected] --skip-email`; | ||
|
||
// -eo pipefail exits the command as soon as anything fails in bash. | ||
const setupCommands = [ 'set -eo pipefail', installCommand ]; | ||
|
||
// Bootstrap .htaccess for multisite | ||
if ( isMultisite ) { | ||
// Using a subshell with `exec` was the best tradeoff I could come up | ||
// with between readability of this source and compatibility with the | ||
// way that all strings in `setupCommands` are later joined with '&&'. | ||
setupCommands.push( | ||
`( | ||
exec > /var/www/html/.htaccess | ||
echo 'RewriteEngine On' | ||
echo 'RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]' | ||
echo 'RewriteBase /' | ||
echo 'RewriteRule ^index\.php$ - [L]' | ||
echo '' | ||
echo '# add a trailing slash to /wp-admin' | ||
echo 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]' | ||
echo '' | ||
echo 'RewriteCond %{REQUEST_FILENAME} -f [OR]' | ||
echo 'RewriteCond %{REQUEST_FILENAME} -d' | ||
echo 'RewriteRule ^ - [L]' | ||
echo 'RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]' | ||
echo 'RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]' | ||
echo 'RewriteRule . index.php [L]' | ||
)` | ||
); | ||
} | ||
|
||
// WordPress versions below 5.1 didn't use proper spacing in wp-config. | ||
const configAnchor = | ||
wpVersion && isWPMajorMinorVersionLower( wpVersion, '5.1' ) | ||
|
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