mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Support multisite in ddev
This commit is contained in:
parent
6dc0a995f6
commit
074f1f68f7
4 changed files with 54 additions and 9 deletions
|
@ -5,11 +5,43 @@ if [ ! -z "${RECREATE_ENV}" ]; then
|
|||
wp db clean --yes
|
||||
fi
|
||||
|
||||
wp core install \
|
||||
--title="${WP_TITLE}" \
|
||||
--admin_user="${ADMIN_USER}" \
|
||||
--admin_password="${ADMIN_PASS}" \
|
||||
--url="${DDEV_PRIMARY_URL}" \
|
||||
--admin_email="${ADMIN_EMAIL}" \
|
||||
--skip-email
|
||||
if [ "${WP_MULTISITE}" = "true" ]; then
|
||||
wp core multisite-install \
|
||||
--title="${WP_TITLE}" \
|
||||
--admin_user="${ADMIN_USER}" \
|
||||
--admin_password="${ADMIN_PASS}" \
|
||||
--url="${DDEV_PRIMARY_URL}" \
|
||||
--admin_email="${ADMIN_EMAIL}" \
|
||||
--skip-email
|
||||
|
||||
cat << 'EOF' >> ".htaccess"
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteRule ^index\.php$ - [L]
|
||||
|
||||
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} -f [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
RewriteRule ^ - [L]
|
||||
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
|
||||
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
|
||||
RewriteRule . index.php [L]
|
||||
EOF
|
||||
|
||||
readarray -d , -t slugs <<< "${WP_MULTISITE_SLUGS},"; unset "slugs[-1]";
|
||||
for slug in "${slugs[@]}"; do
|
||||
if [ ! -z "${slug}" ]; then
|
||||
wp site create --slug="${slug}"
|
||||
fi
|
||||
done
|
||||
|
||||
else
|
||||
wp core install \
|
||||
--title="${WP_TITLE}" \
|
||||
--admin_user="${ADMIN_USER}" \
|
||||
--admin_password="${ADMIN_PASS}" \
|
||||
--url="${DDEV_PRIMARY_URL}" \
|
||||
--admin_email="${ADMIN_EMAIL}" \
|
||||
--skip-email
|
||||
fi
|
||||
|
|
|
@ -2,4 +2,9 @@
|
|||
|
||||
pushd "${DDEV_DOCROOT}"
|
||||
|
||||
wp plugin activate "${PLUGIN_NAME:-$DDEV_PROJECT}"
|
||||
flags=""
|
||||
if [ "${WP_MULTISITE}" = "true" ]; then
|
||||
flags+=" --network"
|
||||
fi
|
||||
|
||||
wp plugin activate "${PLUGIN_NAME:-$DDEV_PROJECT}" $flags
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
wp plugin install woocommerce --version="${WC_VERSION}" --activate
|
||||
flags=""
|
||||
if [ "${WP_MULTISITE}" = "true" ]; then
|
||||
flags+=" --network"
|
||||
fi
|
||||
|
||||
wp plugin install woocommerce --version="${WC_VERSION}"
|
||||
wp plugin activate woocommerce $flags
|
||||
|
|
|
@ -18,6 +18,8 @@ web_environment:
|
|||
- WP_VERSION=5.9.3
|
||||
- WP_LOCALE=en_US
|
||||
- WP_TITLE=WooCommerce PayPal Payments
|
||||
- WP_MULTISITE=true
|
||||
- WP_MULTISITE_SLUGS=de,es
|
||||
- ADMIN_USER=admin
|
||||
- ADMIN_PASS=admin
|
||||
- ADMIN_EMAIL=admin@example.com
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue