Skip to content

Commit

Permalink
feat(wordpress): detect prebuilds
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Aug 3, 2023
1 parent 90a52dc commit 3ca6095
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion features/src/wordpress/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
"id": "wordpress",
"name": "WordPress",
"description": "Sets up WordPress into the Dev Environment",
"version": "2.1.7",
"version": "2.1.8",
"containerEnv": {
"WP_CLI_CONFIG_PATH": "/etc/wp-cli/wp-cli.yaml"
},
"postCreateCommand": "/usr/local/bin/wordpress-post-create.sh",
"options": {
"version": {
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions features/src/wordpress/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ else
fi

install -m 0755 -o root -g root setup-wordpress.sh /usr/local/bin/setup-wordpress.sh
install -m 0755 -o root -g root wordpress-post-create.sh /usr/local/bin/wordpress-post-create.sh
install -m 0644 -o root -g root wp-config.php.tpl /usr/share/wordpress/
install -m 0644 -o root -g root 010-wplogin.tpl /usr/share/wordpress/
install -d -D -m 0755 -o root -g root /var/lib/wordpress/postinstall.d
Expand Down
5 changes: 4 additions & 1 deletion features/src/wordpress/setup-wordpress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ fi
: "${WP_MULTISITE_TYPE:=subdirectory}"
: "${WP_PERSIST_UPLOADS:=""}"

env | sort > /workspaces/env.txt
if [ "${CODESPACES:-}" = 'true' ] && [ "${CLOUDENV_ENVIRONMENT_ID:-}" = 'null' ] && [ -n "${GITHUB_TOKEN}" ]; then
echo "Prebuild detected, skipping WordPress setup"
exit 0
fi

if [ -n "${CODESPACE_NAME}" ] && [ -n "${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" ]; then
WP_DOMAIN="${CODESPACE_NAME}-80.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
Expand Down
5 changes: 5 additions & 0 deletions features/src/wordpress/wordpress-post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

if [ ! -f "${HOME}/.local/share/vip-codespaces/login/010-wplogin.sh" ]; then
exec /usr/local/bin/setup-wordpress.sh
fi

0 comments on commit 3ca6095

Please sign in to comment.