File tree Expand file tree Collapse file tree 3 files changed +18
-28
lines changed
Expand file tree Collapse file tree 3 files changed +18
-28
lines changed Original file line number Diff line number Diff line change @@ -71,15 +71,13 @@ if [ ! -f /var/www/html/config.php ]; then
7171 echo " Moodle installation complete."
7272 # Persist config.php to moodledata so it survives container recreations
7373 cp /var/www/html/config.php " ${MOODLE_DATA} /.moodle_config.php"
74+ chown www-data:www-data /var/www/html/config.php
7475elif php /var/www/html/admin/cli/upgrade.php --is-pending --non-interactive 2> /dev/null | grep -q " pending\|Upgrade" ; then
7576 echo " Database upgrade pending, running upgrade..."
7677 php /var/www/html/admin/cli/upgrade.php --non-interactive
7778 echo " Moodle upgrade complete."
7879 cp /var/www/html/config.php " ${MOODLE_DATA} /.moodle_config.php"
80+ chown www-data:www-data /var/www/html/config.php
7981fi
8082
81- # Ensure correct permissions
82- chown -R www-data:www-data /var/www/html
83- chown -R www-data:www-data " ${MOODLE_DATA} "
84-
8583exec " $@ "
Original file line number Diff line number Diff line change 1313fi
1414
1515# 等待wordpress完成引导
16- until docker exec $W9_ID wp core is-installed & > /dev/null; do
16+ until docker exec $W9_ID wp core is-installed > /dev/null 2>&1 ; do
1717 echo " wait for WordPress..."
1818 sleep 5
1919done
2020
21- # 设置home
22- if [ " ` docker exec $W9_ID wp option get home | cut -d: -f1` " == " https" ]; then
23- docker exec $W9_ID wp option update home " https://$W9_URL "
24- else
25- docker exec $W9_ID wp option update home " $WORDPRESS_ROOT_URL "
21+ # W9_URL为空时跳过URL更新,避免将站点URL设为无效值
22+ if [ -z " $W9_URL " ]; then
23+ echo " W9_URL is empty, skip URL update"
24+ exit 0
2625fi
2726
28- # 设置siteurl
29- if [ " ` docker exec $W9_ID wp option get siteurl | cut -d: -f1` " == " https" ]; then
30- docker exec $W9_ID wp option update siteurl " https://$W9_URL "
31- else
32- docker exec $W9_ID wp option update siteurl " $WORDPRESS_ROOT_URL "
33- fi
27+ # 设置home和siteurl
28+ docker exec $W9_ID wp option update home " $WORDPRESS_ROOT_URL "
29+ docker exec $W9_ID wp option update siteurl " $WORDPRESS_ROOT_URL "
Original file line number Diff line number Diff line change 1313fi
1414
1515# 等待wordpress完成引导
16- until docker exec $W9_ID -wordpress wp core is-installed & > /dev/null; do
16+ until docker exec $W9_ID -wordpress wp core is-installed > /dev/null 2>&1 ; do
1717 echo " wait for WordPress..."
1818 sleep 5
1919done
2020
21- # 设置home
22- if [ " ` docker exec $W9_ID -wordpress wp option get home | cut -d: -f1` " == " https" ]; then
23- docker exec $W9_ID -wordpress wp option update home " https://$W9_URL "
24- else
25- docker exec $W9_ID -wordpress wp option update home " $WORDPRESS_ROOT_URL "
21+ # W9_URL为空时跳过URL更新,避免将站点URL设为无效值
22+ if [ -z " $W9_URL " ]; then
23+ echo " W9_URL is empty, skip URL update"
24+ exit 0
2625fi
2726
28- # 设置siteurl
29- if [ " ` docker exec $W9_ID -wordpress wp option get siteurl | cut -d: -f1` " == " https" ]; then
30- docker exec $W9_ID -wordpress wp option update siteurl " https://$W9_URL "
31- else
32- docker exec $W9_ID -wordpress wp option update siteurl " $WORDPRESS_ROOT_URL "
33- fi
27+ # 设置home和siteurl
28+ docker exec $W9_ID -wordpress wp option update home " $WORDPRESS_ROOT_URL "
29+ docker exec $W9_ID -wordpress wp option update siteurl " $WORDPRESS_ROOT_URL "
You can’t perform that action at this time.
0 commit comments