blob: beb1428007306a031b49f9751ef7264086d08d00 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/bin/bash
EXIT=0
# Output a line prefixed with a timestamp
info() {
echo "$(date +'%F %T') |"
}
# Track number of seconds required to run script
START=$(date +%s)
echo "$(info) starting build checks."
# Syntax check all php files
SYNTAX=$(find . -name "*.php" -type f -exec php --syntax-check {} \; 2>&1 > /dev/null)
if [[ ! -z ${SYNTAX} ]]; then
echo -e "${SYNTAX}"
echo -e "\n$(info) detected one or more syntax errors, failing build."
EXIT=1
fi
# Show build duration
END=$(date +%s)
echo "$(info) exiting with code ${EXIT} after $((${END} - ${START})) seconds."
exit ${EXIT}
|