From 1b494c41d42116763ba2bf154da8f7d8e4636029 Mon Sep 17 00:00:00 2001 From: zhaojing1987 Date: Fri, 20 Mar 2026 14:00:58 +0800 Subject: [PATCH 1/2] fix: update moodle entrypoint script --- apps/moodle/docker-entrypoint.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/moodle/docker-entrypoint.sh b/apps/moodle/docker-entrypoint.sh index c3e8c853f..8f8e51bd9 100644 --- a/apps/moodle/docker-entrypoint.sh +++ b/apps/moodle/docker-entrypoint.sh @@ -71,15 +71,13 @@ if [ ! -f /var/www/html/config.php ]; then echo "Moodle installation complete." # Persist config.php to moodledata so it survives container recreations cp /var/www/html/config.php "${MOODLE_DATA}/.moodle_config.php" + chown www-data:www-data /var/www/html/config.php elif php /var/www/html/admin/cli/upgrade.php --is-pending --non-interactive 2>/dev/null | grep -q "pending\|Upgrade"; then echo "Database upgrade pending, running upgrade..." php /var/www/html/admin/cli/upgrade.php --non-interactive echo "Moodle upgrade complete." cp /var/www/html/config.php "${MOODLE_DATA}/.moodle_config.php" + chown www-data:www-data /var/www/html/config.php fi -# Ensure correct permissions -chown -R www-data:www-data /var/www/html -chown -R www-data:www-data "${MOODLE_DATA}" - exec "$@" From e1a4cbb21babf8f5c736e5ea2ba89d39362a2e85 Mon Sep 17 00:00:00 2001 From: zhaojing1987 Date: Fri, 20 Mar 2026 14:21:38 +0800 Subject: [PATCH 2/2] fix: update wordpress init scripts --- apps/wordpress/src/init.sh | 20 ++++++++------------ apps/wordpresspro/src/init.sh | 20 ++++++++------------ 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/apps/wordpress/src/init.sh b/apps/wordpress/src/init.sh index d46b7a734..547f9d3fd 100644 --- a/apps/wordpress/src/init.sh +++ b/apps/wordpress/src/init.sh @@ -13,21 +13,17 @@ else fi # 等待wordpress完成引导 -until docker exec $W9_ID wp core is-installed &>/dev/null; do +until docker exec $W9_ID wp core is-installed >/dev/null 2>&1; do echo "wait for WordPress..." sleep 5 done -# 设置home -if [ "`docker exec $W9_ID wp option get home | cut -d: -f1`" == "https" ];then - docker exec $W9_ID wp option update home "https://$W9_URL" -else - docker exec $W9_ID wp option update home "$WORDPRESS_ROOT_URL" +# W9_URL为空时跳过URL更新,避免将站点URL设为无效值 +if [ -z "$W9_URL" ]; then + echo "W9_URL is empty, skip URL update" + exit 0 fi -# 设置siteurl -if [ "`docker exec $W9_ID wp option get siteurl | cut -d: -f1`" == "https" ];then - docker exec $W9_ID wp option update siteurl "https://$W9_URL" -else - docker exec $W9_ID wp option update siteurl "$WORDPRESS_ROOT_URL" -fi \ No newline at end of file +# 设置home和siteurl +docker exec $W9_ID wp option update home "$WORDPRESS_ROOT_URL" +docker exec $W9_ID wp option update siteurl "$WORDPRESS_ROOT_URL" \ No newline at end of file diff --git a/apps/wordpresspro/src/init.sh b/apps/wordpresspro/src/init.sh index 86ebb78ac..017669c0d 100644 --- a/apps/wordpresspro/src/init.sh +++ b/apps/wordpresspro/src/init.sh @@ -13,21 +13,17 @@ else fi # 等待wordpress完成引导 -until docker exec $W9_ID-wordpress wp core is-installed &>/dev/null; do +until docker exec $W9_ID-wordpress wp core is-installed >/dev/null 2>&1; do echo "wait for WordPress..." sleep 5 done -# 设置home -if [ "`docker exec $W9_ID-wordpress wp option get home | cut -d: -f1`" == "https" ];then - docker exec $W9_ID-wordpress wp option update home "https://$W9_URL" -else - docker exec $W9_ID-wordpress wp option update home "$WORDPRESS_ROOT_URL" +# W9_URL为空时跳过URL更新,避免将站点URL设为无效值 +if [ -z "$W9_URL" ]; then + echo "W9_URL is empty, skip URL update" + exit 0 fi -# 设置siteurl -if [ "`docker exec $W9_ID-wordpress wp option get siteurl | cut -d: -f1`" == "https" ];then - docker exec $W9_ID-wordpress wp option update siteurl "https://$W9_URL" -else - docker exec $W9_ID-wordpress wp option update siteurl "$WORDPRESS_ROOT_URL" -fi \ No newline at end of file +# 设置home和siteurl +docker exec $W9_ID-wordpress wp option update home "$WORDPRESS_ROOT_URL" +docker exec $W9_ID-wordpress wp option update siteurl "$WORDPRESS_ROOT_URL" \ No newline at end of file