File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Original code: @jroman00 (https://gist.github.com/mathiasverraes/3096500#gistcomment-1575416)
3+
4+ error=false
5+ current=$1
6+
7+ if [ -z " $current " ]; then
8+ current=" /usr/local/hestia/web/"
9+ fi
10+
11+ if [ ! -d $current ] && [ ! -f $current ] ; then
12+ echo " Invalid directory or file: $current "
13+ error=true
14+
15+ continue
16+ fi
17+
18+ echo " Checking PHP files..."
19+ for file in ` find $current -type f -name " *.php" ` ; do
20+ RESULTS=` php -l -n $file `
21+
22+ if [ " $RESULTS " != " No syntax errors detected in $file " ] ; then
23+ echo $RESULTS
24+ error=true
25+ fi
26+ done
27+
28+ echo " Checking HTML/PHP combined files..."
29+ for file in ` find $current -type f -name " *.html" ` ; do
30+ RESULTS=` php -l -n $file `
31+
32+ if [ " $RESULTS " != " No syntax errors detected in $file " ] ; then
33+ echo $RESULTS
34+ error=true
35+ fi
36+ done
37+
38+ if [ " $error " = true ] ; then
39+ exit 1
40+ else
41+ exit 0
42+ fi
You can’t perform that action at this time.
0 commit comments