diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 6161a328cf4e15c08dc8d9315adac650f3f42e10..8ab4ad02856c68fb09b26fdaacda3b58207c6636 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -171,6 +171,8 @@ setup_components() { [[ $(wp theme list --status=active --format=count) -eq 0 ]] && wp theme activate $(wp theme list --field=name | head -n1) + deactivate_missing_plugins + setup_s3 return 0 @@ -221,6 +223,20 @@ collect_static() . static/ } +deactivate_missing_plugins() +{ + local plugin + wp option get active_plugins --format=json | + jq -r '.[]' | + while read plugin; do + test -e wp-content/plugins/$plugin && + echo $plugin || + echo >&2 "Deactivating removed plugin: $(dirname $plugin)" + done | + jq -R '[[.],[inputs]]|add' | + wp option update active_plugins --format=json +} + next_cron() { echo $(($(wp cron event list --field=time|sort|head -n1) - $(date +%s))) diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh index e6b4d75d2d995b43b7c3b36a0affe39e8bcb6bfe..51d0f812f8a75dd8c3cdcfb7e1506ee6a537768e 100755 --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -1,4 +1,10 @@ #!/bin/sh +# Copyright 2019-2021 Dominik Sekotill +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + set -eux # Install packaged dependencies @@ -6,6 +12,7 @@ apk update apk add \ bash \ imagemagick-libs \ + jq \ libgmpxx \ libjpeg \ libpng \