mirror of
https://github.com/N0rthernL1ghts/wordpress.git
synced 2024-11-23 14:13:27 +01:00
Revert "Improve plugin installer reliability"
This reverts commit f81ec4c67e
.
This commit is contained in:
parent
c41860611d
commit
f387ec0773
|
@ -16,9 +16,7 @@ function scriptExitHandler() {
|
||||||
|
|
||||||
# Check if plugin installed. This is very basic check that doesn't involve database
|
# Check if plugin installed. This is very basic check that doesn't involve database
|
||||||
function isPluginInstalled() {
|
function isPluginInstalled() {
|
||||||
PLUGIN="${1:?PLUGIN is required}"
|
if [ -d "${PLUGIN_PATH}" ] || [ -f "${PLUGIN_PATH}.php" ]; then
|
||||||
|
|
||||||
if [ -d "${PLUGIN_PATH}" ] && [ -f "${PLUGIN_PATH}/${PLUGIN}.php" ]; then
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
|
@ -46,22 +44,20 @@ function main() {
|
||||||
for PLUGIN_EXPR in ${PLUGIN_LIST}; do
|
for PLUGIN_EXPR in ${PLUGIN_LIST}; do
|
||||||
IFS=':' read -ra PLUGIN <<<"${PLUGIN_EXPR}"
|
IFS=':' read -ra PLUGIN <<<"${PLUGIN_EXPR}"
|
||||||
|
|
||||||
PLUGIN_NAME="${PLUGIN[0]}"
|
PLUGIN_PATH="${WP_CONTENT_PATH}/plugins/${PLUGIN[0]}"
|
||||||
PLUGIN_PATH="${WP_CONTENT_PATH}/plugins/${PLUGIN_NAME}"
|
|
||||||
export PLUGIN_PATH
|
|
||||||
|
|
||||||
if isPluginInstalled "${PLUGIN_NAME}"; then
|
if isPluginInstalled; then
|
||||||
echo "> Plugin '${PLUGIN_NAME}' already installed and will be skipped."
|
echo "> Plugin '${PLUGIN[0]}' already installed and will be skipped."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
WP_PLUGIN_INSTALL_ARGS="${PLUGIN_NAME}"
|
WP_PLUGIN_INSTALL_ARGS="${PLUGIN[0]}"
|
||||||
|
|
||||||
if [ -n "${PLUGIN[1]}" ]; then
|
if [ -n "${PLUGIN[1]}" ]; then
|
||||||
WP_PLUGIN_INSTALL_ARGS="${WP_PLUGIN_INSTALL_ARGS} --version=${PLUGIN[1]}"
|
WP_PLUGIN_INSTALL_ARGS="${WP_PLUGIN_INSTALL_ARGS} --version=${PLUGIN[1]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "> Installing plugin '${PLUGIN_NAME}' version '${PLUGIN[1]}'"
|
echo "> Installing plugin '${PLUGIN[0]}' version '${PLUGIN[1]}'"
|
||||||
installPlugin "${WP_PLUGIN_INSTALL_ARGS}" &
|
installPlugin "${WP_PLUGIN_INSTALL_ARGS}" &
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -76,22 +72,20 @@ function main() {
|
||||||
for PLUGIN_EXPR in ${PLUGIN_LIST}; do
|
for PLUGIN_EXPR in ${PLUGIN_LIST}; do
|
||||||
IFS=':' read -ra PLUGIN <<<"${PLUGIN_EXPR}"
|
IFS=':' read -ra PLUGIN <<<"${PLUGIN_EXPR}"
|
||||||
|
|
||||||
PLUGIN_NAME="${PLUGIN[0]}"
|
PLUGIN_PATH="${WP_CONTENT_PATH}/plugins/${PLUGIN[0]}"
|
||||||
PLUGIN_PATH="${WP_CONTENT_PATH}/plugins/${PLUGIN_NAME}"
|
|
||||||
export PLUGIN_PATH
|
|
||||||
|
|
||||||
if isPluginInstalled "${PLUGIN_NAME}"; then
|
if isPluginInstalled; then
|
||||||
echo "> Plugin '${PLUGIN_NAME}' installed"
|
echo "> Plugin '${PLUGIN[0]}' installed"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
((FAILED_COUNT = FAILED_COUNT + 1))
|
((FAILED_COUNT = FAILED_COUNT + 1))
|
||||||
echo "> Warning: Plugin '${PLUGIN_NAME}' failed to install"
|
echo "> Warning: Plugin '${PLUGIN[0]}' failed to install"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "> Total of ${FAILED_COUNT} plugins failed to install"
|
echo "> Total of ${FAILED_COUNT} plugins failed to install"
|
||||||
|
|
||||||
if [ "${PLUGIN_STRICT_INSTALL}" = "true" ] && [ "${FAILED_COUNT}" != "0" ]; then
|
if [ "${PLUGIN_STRICT_INSTALL}" = "true" ] && [ ${FAILED_COUNT} != "0" ]; then
|
||||||
echo "> WORDPRESS_PLUGIN_INSTALL_STRICT is set to true. Terminating with non-zero exit code"
|
echo "> WORDPRESS_PLUGIN_INSTALL_STRICT is set to true. Terminating with non-zero exit code"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user