diff --git a/src/modules/site/create/ee_mod_setup_wordpress.sh b/src/modules/site/create/ee_mod_setup_wordpress.sh index 185f98ad..fbfd21b5 100644 --- a/src/modules/site/create/ee_mod_setup_wordpress.sh +++ b/src/modules/site/create/ee_mod_setup_wordpress.sh @@ -62,4 +62,36 @@ function ee_mod_setup_wordpress() printf '%s\n' "g/put your unique phrase here/d" \ a "$(curl -sL https://api.wordpress.org/secret-key/1.1/salt/)" . w \ | ed -s /var/www/$EE_DOMAIN/wp-config.php + + # WordPress default user: admin + EE_WP_USER=$($EE_CONFIG_GET wordpress.user) + if [[ $EE_WP_USER = "" ]]; then + EE_WP_USER=admin + fi + + # WordPress default user: admin + EE_WP_PASS=$($EE_CONFIG_GET wordpress.password) + if [[ $EE_WP_PASS = "" ]]; then + EE_WP_PASS=$EE_RANDOM + fi + + # WordPress default email: `git config user.email` + EE_WP_EMAIL=$($EE_CONFIG_GET wordpress.email) + if [[ $EE_WP_EMAIL = "" ]]; then + EE_WP_EMAIL=$(git config user.email) + fi + + # Create WordPress tables + ee_lib_echo "Setting up WordPress, please wait..." + cd /var/www/$EE_DOMAIN/htdocs \ + || ee_lib_error "Unable to change directory to install WordPress, exit status = " $? + + wp core install --allow-root --url=$EE_WWW_DOMAIN --title="$EE_WWW_DOMAIN" \ + --admin_name=$EE_WP_USER --admin_password=$EE_WP_PASS --admin_email=$EE_WP_EMAIL &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to create WordPress tables for $EE_DOMAIN, exit status = " $? + + # Update WordPress permalink structure day and postname + ee_lib_echo "Updating WordPress permalink, please wait..." + wp rewrite structure --allow-root /%year%/%monthnum%/%day%/%postname%/ &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to update WordPress permalink for $EE_DOMAIN, exit status = " $? }