From e74965b0fa4f5c775dd1ead95081115ccda8e9d7 Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Sat, 17 Aug 2024 19:14:01 +0300 Subject: [PATCH] fix(wordpress): mount `vip-config` to WP root, not `/wp-content` --- features/src/wordpress/devcontainer-feature.json | 2 +- features/src/wordpress/setup-wordpress.sh | 7 ++++++- features/src/wordpress/wp/config/wp-config-defaults.php | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/features/src/wordpress/devcontainer-feature.json b/features/src/wordpress/devcontainer-feature.json index e3725edf..9fa1550f 100644 --- a/features/src/wordpress/devcontainer-feature.json +++ b/features/src/wordpress/devcontainer-feature.json @@ -2,7 +2,7 @@ "id": "wordpress", "name": "WordPress", "description": "Sets up WordPress into the Dev Environment", - "version": "2.6.0", + "version": "2.6.1", "documentationURL": "https://github.com/Automattic/vip-codespaces/tree/trunk/features/src/wordpress", "containerEnv": { "WP_CLI_CONFIG_PATH": "/etc/wp-cli/wp-cli.yaml", diff --git a/features/src/wordpress/setup-wordpress.sh b/features/src/wordpress/setup-wordpress.sh index 8f71b5bb..af80d5fa 100755 --- a/features/src/wordpress/setup-wordpress.sh +++ b/features/src/wordpress/setup-wordpress.sh @@ -47,13 +47,18 @@ else base=$(pwd) fi -for i in client-mu-plugins images languages plugins themes vip-config; do +for i in client-mu-plugins images languages plugins themes; do if [ -e "${base}/${i}" ]; then sudo rm -rf "/wp/wp-content/${i}" sudo ln -sf "${base}/${i}" "/wp/wp-content/${i}" fi done +if [ -e "${base}/vip-config" ]; then + sudo rm -rf "/wp/vip-config" + sudo ln -sf "${base}/vip-config" "/wp/vip-config" +fi + if [ -n "${WP_PERSIST_UPLOADS}" ]; then sudo install -d -o "${MY_UID}" -g "${MY_GID}" -m 0755 /workspaces/uploads sudo install -d -o "${MY_UID}" -g "${MY_GID}" -m 0755 /wp/wp-content diff --git a/features/src/wordpress/wp/config/wp-config-defaults.php b/features/src/wordpress/wp/config/wp-config-defaults.php index c3a45ff9..a19673a0 100644 --- a/features/src/wordpress/wp/config/wp-config-defaults.php +++ b/features/src/wordpress/wp/config/wp-config-defaults.php @@ -114,8 +114,10 @@ /** * VIP Config */ -if ( file_exists( ABSPATH . '/wp-content/vip-config/vip-config.php' ) ) { - require_once( ABSPATH . '/wp-content/vip-config/vip-config.php' ); +if ( file_exists( ABSPATH . '/vip-config/vip-config.php' ) ) { + require_once ABSPATH . '/vip-config/vip-config.php'; +} elseif ( file_exists( ABSPATH . '/wp-content/vip-config/vip-config.php' ) ) { + require_once ABSPATH . '/wp-content/vip-config/vip-config.php'; } /**