From 739125ae86113a7f48a29e9d61fc91425bd187a8 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 2 May 2018 12:11:51 +0200 Subject: [PATCH] allow to specify PHP interpreter via PHP enviroment variable allow to specify a file/directory to scan --- doc/php_syntax_check.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/php_syntax_check.sh b/doc/php_syntax_check.sh index fe7f47b0ad..dcf076f2d2 100755 --- a/doc/php_syntax_check.sh +++ b/doc/php_syntax_check.sh @@ -1,15 +1,19 @@ #!/bin/bash ################################################################################ ### Tool to check for PHP Syntax errors +### ### Usage: doc/php_syntax_check [file or directory, defaults to whole egrouware] +### ### 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 +### +### Use PHP environment variable to point to a certain PHP binary. ################################################################################ -cd `dirname $0` -cd .. +cd ${1:-$(dirname $0)/..} -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 egrep '^(PHP|Parse error)' | \ # suppress PHP Deprecated in vendor, as they need to be solved by the vendor