mirror of
https://github.com/szepeviktor/wordpress-website-lifecycle.git
synced 2026-07-27 02:55:34 +08:00
1.4 KiB
1.4 KiB
Unity theme bundled plugin monitor
Use this script to detect new releases of the WPBakery and Revolution Slider
archives bundled by the Unity theme. This is an operations script, not an MU
plugin; do not place it in wp-content/mu-plugins/.
Instructions
- Save the snippet as
unity-plugin-update.shoutside the public web root. - Make the script executable.
- Create the initial
external-plugin-update.logbaseline. - Run the script without arguments from a scheduled job. It exits with the
status returned by
diffand prints any changed HTTP metadata. - After reviewing and deploying an update, refresh the baseline.
chmod 0755 unity-plugin-update.sh
./unity-plugin-update.sh --update
./unity-plugin-update.sh
Script
#!/usr/bin/env bash
set -eu
SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)"
CURRENT="${SCRIPT_DIR}/external-plugin-update.log"
REMOTE="$(mktemp)"
trap 'rm -f "${REMOTE}"' EXIT
EXTERNAL_PLUGINS=(
"https://source.wpopal.com/plugins/new/js_composer.zip"
"https://source.wpopal.com/plugins/new/revslider.zip"
)
for PLUGIN in "${EXTERNAL_PLUGINS[@]}"; do
curl -L -sI "${PLUGIN}" \
| sed -n '/^last-modified:/Ip'
done > "${REMOTE}"
if [ "${1:-}" = "--update" ]; then
cp "${REMOTE}" "${CURRENT}"
exit 0
fi
if [ ! -f "${CURRENT}" ]; then
echo "Baseline is missing. Run $0 --update first." >&2
exit 2
fi
diff -u "${CURRENT}" "${REMOTE}"