Kaynağa Gözat

reset admin password after configuring email

it looks like an email is sent?
Girish Ramakrishnan 9 yıl önce
ebeveyn
işleme
cbe17f754e
1 değiştirilmiş dosya ile 9 ekleme ve 5 silme
  1. 9 5
      start.sh

+ 9 - 5
start.sh

@@ -51,14 +51,12 @@ if [[ -z "$(ls -A /app/data)" ]]; then
     rm -rf /app/data/wp-content/mu-plugins/authLdap-*/
 else
     # Update wordpress
+    echo "Updating wordpress database"
     $WP core update-db
 fi
 
-# reset the admin password
-$WP user update $($WP user get admin --field=ID) --user_pass="${admin_password}"
-$WP user update $($WP user get admin --field=ID) --user_email="${admin_email}"
-
 # configure WP mail smtp plugin (smtp_user, smtp_pass can be set when supported)
+echo "Configuring smtp mail"
 $WP option update mailer smtp
 $WP option update mail_from ${MAIL_SMTP_USERNAME}@${MAIL_DOMAIN}
 $WP option update mail_from_name ${MAIL_SMTP_USERNAME}
@@ -66,8 +64,14 @@ $WP option update smtp_host ${MAIL_SMTP_SERVER}
 $WP option update smtp_port ${MAIL_SMTP_PORT}
 $WP option update smtp_auth false
 
+# reset the admin password. do this after configuring smtp mail
+echo "Resetting admin password"
+$WP user update $($WP user get admin --field=ID) --user_pass="${admin_password}"
+$WP user update $($WP user get admin --field=ID) --user_email="${admin_email}"
+
 # configure LDAP
 # https://github.com/heiglandreas/authLdap/blob/master/authLdap.php#L644
+echo "Configuring LDAP"
 ldapConfig=$(cat <<EOF
 {
     "Enabled"       : true,
@@ -92,7 +96,7 @@ EOF
 )
 $WP --autoload=true --format=json option update authLDAPOptions "${ldapConfig}"
 
-chown -R www-data:www-data /app/data
+chown -R www-data:www-data /app/data /run/wordpress
 
 echo "Starting apache"
 APACHE_CONFDIR="" source /etc/apache2/envvars