-
Notifications
You must be signed in to change notification settings - Fork 10
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
1 parent
8bd2a3c
commit d747f63
Showing
28 changed files
with
6,416 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
## Description: Set up the development environment | ||
## Usage: orchestrate | ||
## Example: "ddev orchestrate" | ||
|
||
mkdir -p "${DDEV_DOCROOT}" | ||
pushd "${DDEV_DOCROOT}" | ||
PLUGIN_FOLDER="${DDEV_DOCROOT}/wp-content/plugins/assets-plugin" | ||
VALID_ARGS=$(getopt -o fp: --long force,plugin: -- "$@") | ||
if [[ $? -ne 0 ]]; then | ||
exit 1; | ||
fi | ||
|
||
eval set -- "$VALID_ARGS" | ||
while [ : ]; do | ||
case "$1" in | ||
-f | --force) | ||
echo "Removing WordPress installation" | ||
shift | ||
export RECREATE_ENV=1; | ||
popd | ||
find "${DDEV_DOCROOT}" -mindepth 1 ! -regex "^${PLUGIN_FOLDER}\(/.*\)?" -delete | ||
pushd "${DDEV_DOCROOT}" | ||
;; | ||
-p | --plugin) | ||
echo "Processing 'delta' option. Input argument is '$2'" | ||
shift 2 | ||
;; | ||
--) shift; | ||
break | ||
;; | ||
esac | ||
done | ||
|
||
# Execute all fragments from orchestrate.d | ||
if [ -d "${0}.d" ]; then | ||
for FN in ${0}.d/*.sh ; do | ||
echo $FN | ||
source "${FN}" | ||
done | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
if ! wp core download --version="${WP_VERSION:-latest}"; then | ||
echo 'WordPress is already installed.' | ||
exit | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
cat << 'EOF' > ".gitignore" | ||
# ignores everything in the docroot (docroot in config.yaml), this path may not be included in the standard .ddev/.gitignore. | ||
* | ||
EOF |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
ssh#!/bin/bash | ||
|
||
# Create wp-config.php | ||
# the PHP snippet avoids some notices during CLI calls | ||
# https://make.wordpress.org/cli/handbook/guides/common-issues/#php-notice-undefined-index-on-_server-superglobal | ||
printf ' | ||
if ( defined( "WP_CLI" ) && WP_CLI && ! isset( $_SERVER["HTTP_HOST"] ) ) { | ||
$_SERVER["HTTP_HOST"] = "%s"; | ||
} | ||
' "${DDEV_HOSTNAME}" | wp config create \ | ||
--dbname=db \ | ||
--dbuser=db \ | ||
--dbpass=db \ | ||
--dbhost=db \ | ||
--force \ | ||
--extra-php | ||
|
||
wp config set WP_DEBUG true --raw | ||
wp config set WP_DEBUG_DISPLAY true --raw | ||
wp config set WP_DEBUG_LOG true --raw | ||
wp config set WP_SITEURL '(isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] ? "https://" : "http://") . $_SERVER["HTTP_HOST"]' --raw | ||
wp config set WP_HOME '(isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] ? "https://" : "http://") . $_SERVER["HTTP_HOST"]' --raw |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
if [ ! -z "${RECREATE_ENV}" ]; then | ||
echo "Deleting database before creating a new one" | ||
wp db clean --yes | ||
fi | ||
|
||
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 | ||
|
||
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 |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
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 |
4 changes: 4 additions & 0 deletions
4
.ddev/commands/web/orchestrate.d/20_cleanup_default_plugins.sh
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
wp plugin is-installed akismet && wp plugin uninstall akismet | ||
wp plugin is-installed hello && wp plugin uninstall hello |
7 changes: 7 additions & 0 deletions
7
.ddev/commands/web/orchestrate.d/30_install_plugin_packages.sh
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
pushd wp-content/plugins/assets-plugin | ||
composer install | ||
npm install | ||
popd | ||
popd |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
pushd "${DDEV_DOCROOT}" | ||
|
||
flags="" | ||
if [ "${WP_MULTISITE}" = "true" ]; then | ||
flags+=" --network" | ||
fi | ||
|
||
wp plugin activate assets-plugin $flags |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
wp rewrite structure '/%postname%' | ||
wp rewrite flush |
Oops, something went wrong.