envole/misc/wordpress/containers/volume/entrypoint.sh

67 lines
2.1 KiB
Bash
Raw Normal View History

2024-02-29 16:46:23 +01:00
#!/bin/bash
set -eo pipefail
cd /app/public
if [[ ! -f /app/public/wp-config.php ]]
then
wp config create \
--allow-root \
--dbhost="${WORDPRESS_DB_HOST}" \
--dbname="${WORDPRESS_DB_NAME}" \
--dbuser="${WORDPRESS_DB_USER}" \
--dbpass="${WORDPRESS_DB_PASSWORD}" \
--dbcharset="utf8mb4" \
--locale="fr_FR"
fi
wp core multisite-install \
--allow-root \
--url="${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}" \
--title="${WORDPRESS_TITLE}" \
--admin_user="${WORDPRESS_USER}" \
--admin_password="${WORDPRESS_PASSWORD}" \
--admin_email="${WORDPRESS_EMAIL}" \
--skip-email
wp config set --allow-root DB_HOST ${WORDPRESS_DB_HOST}
wp config set --allow-root DB_NAME ${WORDPRESS_DB_NAME}
wp config set --allow-root DB_USER ${WORDPRESS_DB_USER}
wp config set --allow-root DB_PASSWORD ${WORDPRESS_DB_PASSWORD}
wp config set --allow-root WP_HOME ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS}
wp config set --allow-root WP_SITEURL ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS}
wp config set --allow-root WP_ALLOW_MULTISITE true
wp config set --allow-root MULTISITE true
wp config set --allow-root SUBDOMAIN_INSTALL false
wp config set --allow-root DOMAIN_CURRENT_SITE ${WORDPRESS_DOMAINE}
wp config set --allow-root PATH_CURRENT_SITE ${WORDPRESS_ALIAS}
wp config set --allow-root FORCE_ADMIN_SSL false
2024-03-06 08:48:50 +01:00
wp config set --allow-root SITE_ID_CURRENT_SITE 1
wp config set --allow-root BLOG_ID_CURRENT_SITE 1
2024-02-29 16:46:23 +01:00
# On fait croire à WP qu'il est en https
if grep -qF "_SERVER['HTTPS']='on'" "wp-config.php"; then
if [[ "${WORDPRESS_PROTOCOL}" == "https" ]]
then
echo "FORCE HTTPS already set"
fi
else
if [[ "${WORDPRESS_PROTOCOL}" == "https" ]]
then
echo "FORCE HTTPS set"
head -n 1 "wp-config.php" > "wp-config.tmp"
echo "\$_SERVER['HTTPS']='on';" >> "wp-config.tmp"
tail -n +2 "wp-config.php" >> "wp-config.tmp"
mv "wp-config.tmp" "wp-config.php"
fi
fi
2024-03-06 08:48:50 +01:00
# Mise à jour theme / plugin / network
wp theme update --allow-root --all
wp plugin update --allow-root --all
wp core update-db --network
2024-02-29 16:46:23 +01:00
exec $@