Optimize plugin installer performance

Implement manual plugin existence check. WP-CLI is quite slow and processing large list of plugins delays container boot too much
This commit is contained in:
xZero707 2021-02-15 01:14:42 +01:00
parent f3ce642242
commit e9c35c6bd2

View File

@ -2,6 +2,7 @@
set -e set -e
PLUGIN_LIST="${WORDPRESS_PLUGIN_LIST:-}" PLUGIN_LIST="${WORDPRESS_PLUGIN_LIST:-}"
WP_CONTENT_PATH="/var/www/${WEB_ROOT}/wp-content"
echo "> Automated WordPress Plugin Installer" echo "> Automated WordPress Plugin Installer"
@ -20,6 +21,13 @@ for PLUGIN_NAME in ${PLUGIN_LIST}; do
WP_PLUGIN_INSTALL_ARGS="${WP_PLUGIN_INSTALL_ARGS} --version=${PLUGIN[1]}" WP_PLUGIN_INSTALL_ARGS="${WP_PLUGIN_INSTALL_ARGS} --version=${PLUGIN[1]}"
fi fi
PLUGIN_PATH="${WP_CONTENT_PATH}/plugins/${PLUGIN[0]}"
if [ -d "${PLUGIN_PATH}" ] || [ -f "${PLUGIN_PATH}.php" ]; then
echo "> Plugin '${PLUGIN[0]}' already installed and will be skipped."
continue
fi
echo "> Installing plugin '${PLUGIN[0]}' version '${PLUGIN[1]}'" echo "> Installing plugin '${PLUGIN[0]}' version '${PLUGIN[1]}'"
wp plugin install ${WP_PLUGIN_INSTALL_ARGS} wp plugin install ${WP_PLUGIN_INSTALL_ARGS}
done done