allow to specify PHP interpreter via PHP enviroment variable

allow to specify a file/directory to scan
This commit is contained in:
Ralf Becker 2018-05-02 12:11:51 +02:00
parent 6a3a55a4fa
commit 739125ae86

View File

@ -1,15 +1,19 @@
#!/bin/bash #!/bin/bash
################################################################################ ################################################################################
### Tool to check for PHP Syntax errors ### Tool to check for PHP Syntax errors
###
### Usage: doc/php_syntax_check [file or directory, defaults to whole egrouware] ### Usage: doc/php_syntax_check [file or directory, defaults to whole egrouware]
###
### Will output all PHP Fatal, Parse errors and also Deprecated incl. filename ### Will output all PHP Fatal, Parse errors and also Deprecated incl. filename
###
### Exit-status: 0 on no error, but maybe Deprecated warnings, 1 on error ### Exit-status: 0 on no error, but maybe Deprecated warnings, 1 on error
###
### Use PHP environment variable to point to a certain PHP binary.
################################################################################ ################################################################################
cd `dirname $0` cd ${1:-$(dirname $0)/..}
cd ..
find ${@-.} -name '*.php' -exec php -l {} \; 2>&1 | \ find ${@-.} -name '*.php' -exec ${PHP:-php} -l {} \; 2>&1 | \
# only show errors and PHP Deprecated, no success messages # only show errors and PHP Deprecated, no success messages
egrep '^(PHP|Parse error)' | \ egrep '^(PHP|Parse error)' | \
# suppress PHP Deprecated in vendor, as they need to be solved by the vendor # suppress PHP Deprecated in vendor, as they need to be solved by the vendor