captaincore/app/scan-errors
Austin Ginder 825b54016d 📦 NEW: Go CLI
2021-06-24 23:05:07 -04:00

51 lines
No EOL
1.2 KiB
Bash

#!/usr/bin/env bash
#
# Scans for Javascript errors on one or more sites.
#
# `captaincore scan-errors`
#
# [<site>...]
# One or more sites to update.
#
# [@<target>]
# Target groups of sites like @all @production or @staging. Use `captaincore update @production.updates-on` to target production sites marked for automatic updates.
#
if [ ${#@} -ne 1 ]; then
echo -e "${COLOR_RED}Error:${COLOR_NORMAL} Requires a <site>"
exit
fi
while read config; do
if [[ "$config" == "Error:"* ]]; then
continue
fi
declare "$config"
done <<< "$(php ${CAPTAINCORE_PATH}/lib/local-scripts/configs.php fetch)"
site=$1
run_command() {
cd ${CAPTAINCORE_PATH}/data
if [[ "$website" == *"-staging"* ]]; then
environment=staging
else
environment=production
fi
# Load site configs
while read site_configs; do declare "$site_configs"; done <<< "$(captaincore site get $site --bash --captain-id=$CAPTAIN_ID)"
# Scans for errors
wp eval-file ../lib/local-scripts/site-scan-errors-in-console.php site=$site environment=$environment
if [ -f "${path}/process-${process_id}-progress.log" ]; then
echo -n "." >> ${path}/process-${process_id}-progress.log
fi
}
run_command