wordpress/abra.sh

92 lines
3.3 KiB
Bash
Raw Normal View History

export PHP_UPLOADS_CONF_VERSION=v3
2024-01-17 20:46:22 +00:00
export ENTRYPOINT_CONF_VERSION=v7
2022-03-30 23:24:33 +00:00
export ENTRYPOINT_MAILRELAY_CONF_VERSION=v2
2023-10-23 09:26:10 +00:00
export MSMTP_CONF_VERSION=v4
2024-01-17 20:40:07 +00:00
export HTACCESS_CONF_VERSION=v2
2022-03-30 23:24:33 +00:00
wp() {
2023-03-30 14:57:44 +00:00
su -p www-data -s /bin/bash -c "/usr/local/bin/wp $@"
}
2024-04-15 14:50:18 +00:00
update() {
wp "core update-db"
wp "plugin update --all"
wp "plugin auto-updates enable --all"
wp "theme update --all"
wp "theme auto-updates enable --all"
wp "language core update"
wp "language plugin update --all"
wp "language theme update --all"
}
2023-03-30 14:57:44 +00:00
core_install(){
ADMIN=admin
2023-06-08 14:00:19 +00:00
if [ -n "$AUTHENTIK_DOMAIN" ]
2023-03-30 14:57:44 +00:00
then
ADMIN=akadmin
fi
2023-08-24 09:33:24 +00:00
chown www-data:www-data -R /var/www/html/wp-content
2023-03-30 14:57:44 +00:00
wp "core install --url=$DOMAIN --title=\"$TITLE\" --admin_user=$ADMIN --admin_email=$ADMIN_EMAIL --locale=$LOCALE --skip-email"
2023-04-20 18:38:42 +00:00
wp "language core install $LOCALE"
wp "site switch-language $LOCALE"
2023-03-30 14:57:44 +00:00
wp "rewrite structure '/%year%/%monthnum%/%day%/%postname%/'"
wp "plugin install --activate disable-update-notifications"
wp "option update disable_notification_setting --format=json '{\"dpun_setting\":false,\"dwtu_setting\":false,\"dwcun_setting\":true}'"
2023-06-08 14:00:19 +00:00
if [ -n "$DEFAULT_USER_ROLE" ]
then
wp "option set default_role $DEFAULT_USER_ROLE"
else
wp "option set default_role subscriber"
fi
2024-04-15 14:50:18 +00:00
wp "theme auto-updates enable --all"
2023-08-24 09:33:24 +00:00
wp 'plugin auto-updates enable --all' || exit 0
2023-03-30 14:57:44 +00:00
}
set_authentik(){
AUTHENTIK_SECRET=$(cat /run/secrets/authentik_secret)
AUTHENTIK_ID=$(cat /run/secrets/authentik_id)
2023-04-06 17:34:05 +00:00
if [ -z $LOGIN_TYPE ]
2023-03-30 14:57:44 +00:00
then
LOGIN_TYPE='button'
fi
wp "user create akadmin admin@example.com --role=administrator"
wp "plugin install --activate daggerhart-openid-connect-generic"
2024-04-15 14:50:18 +00:00
wp 'plugin auto-updates enable daggerhart-openid-connect-generic'
2023-03-30 14:57:44 +00:00
wp "option update --format=json openid_connect_generic_settings '
{
\"login_type\":\"$LOGIN_TYPE\",
\"client_id\":\"$AUTHENTIK_ID\",
\"client_secret\":\"$AUTHENTIK_SECRET\",
\"scope\":\"email profile openid\",
\"endpoint_login\":\"https://$AUTHENTIK_DOMAIN/application/o/authorize/\",
\"endpoint_userinfo\":\"https://$AUTHENTIK_DOMAIN/application/o/userinfo/\",
\"endpoint_token\":\"https://$AUTHENTIK_DOMAIN/application/o/token/\",
\"endpoint_end_session\":\"https://$AUTHENTIK_DOMAIN/application/o/wordpress/end-session/\",
\"acr_values\":\"\",
\"identity_key\":\"preferred_username\",
\"no_sslverify\":\"0\",
\"http_request_timeout\":\"30\",
\"enforce_privacy\":\"0\",
\"alternate_redirect_uri\":\"1\",
\"nickname_key\":\"preferred_username\",
\"email_format\":\"{email}\",
2023-04-06 17:34:05 +00:00
\"displayname_format\":\"\",
2023-03-30 14:57:44 +00:00
\"identify_with_username\":\"1\",
\"state_time_limit\":\"\",
\"token_refresh_enable\":\"1\",
\"link_existing_users\":\"1\",
\"create_if_does_not_exist\":\"1\",
\"redirect_user_back\":\"0\",
\"redirect_on_logout\":\"1\",
\"enable_logging\":\"0\",
\"log_limit\":\"1000\"
}'"
wp "rewrite flush"
wp "cache flush"
2022-03-30 23:24:33 +00:00
}
2022-12-15 16:26:51 +00:00
fix_mysql() {
echo "ALTER TABLE mysql.column_stats MODIFY histogram longblob; ALTER TABLE mysql.column_stats MODIFY hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB');" | mysql -u root -p$(cat /run/secrets/db_root_password)
}