Run database migration as www-data user

This commit is contained in:
Almira Krdzic
2018-09-03 23:22:10 +02:00
parent d90c12406b
commit 06fc46fbc5
2 changed files with 23 additions and 23 deletions

View File

@@ -8,29 +8,29 @@ while ! mysqladmin ping -h"db" --silent; do
done
echo "Ready...."
# Apply core database updates if needed
wp core update-db --allow-root
sudo -u www-data -s -- <<EOF
# Export variables for www-data user so they
# are accessible when running wp CLI
export WP_ENV="$WP_ENV"
export WP_HOME="$WP_HOME"
export WP_DB_HOST="$WP_DB_HOST"
export MYSQL_DATABASE="$MYSQL_DATABASE"
export MYSQL_USER="$MYSQL_USER"
export MYSQL_PASSWORD="$MYSQL_PASSWORD"
export WP_AUTH_KEY="$WP_AUTH_KEY"
export WP_SECURE_AUTH_KEY="$WP_SECURE_AUTH_KEY"
export WP_LOGGED_IN_KEY="$WP_LOGGED_IN_KEY"
export WP_NONCE_KEY="$WP_NONCE_KEY"
export WP_AUTH_SALT="$WP_AUTH_SALT"
export WP_SECURE_AUTH_SALT="$WP_SECURE_AUTH_SALT"
export WP_LOGGED_IN_SALT="$WP_LOGGED_IN_SALT"
export WP_NONCE_SALT="$WP_NONCE_SALT"
export WP_JWT_AUTH_SECRET_KEY="$WP_JWT_AUTH_SECRET_KEY"
# Activate plugins in desired order
# (if plugin is already activated command will do nothing)
wp plugin activate woocommerce --allow-root
wp plugin activate woocommerce-product-bundles --allow-root
wp plugin activate woocommerce-jetpack --allow-root
wp plugin activate jwt-authentication-for-wp-rest-api --allow-root
wp plugin activate gravityforms --allow-root
wp plugin activate gravityflow --allow-root
wp plugin activate capability-manager-enhanced --allow-root
wp plugin activate groups --allow-root
wp plugin activate wp-user-groups --allow-root
wp plugin activate wiaas --allow-root
# Execute database update
composer update-db
# Execute database update for updated plugins
# (if no changes detected command will do nothing)
wp wc update --allow-root
# Execute database update for wiaas
# (if no changes detected command will do nothing)
wp wiaas update-db --allow-root
EOF
echo "Done"