From 6b039bbaba2ec711f07c01c9c5bf2cf8369b97ce Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 12 May 2015 02:04:07 +0200 Subject: [PATCH] Added find-bad-php.sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- find-bad-php.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 find-bad-php.sh diff --git a/find-bad-php.sh b/find-bad-php.sh new file mode 100755 index 00000000..2fdfecf4 --- /dev/null +++ b/find-bad-php.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +echo "$0: Searching for PHP scripts (except 3rd party) ..." +PHP=`find -type f -name "*.php" | grep -v "third_party"` + +for SCRIPT in ${PHP}; +do + HEADER=`cat ${SCRIPT} | head -n 1 | grep -v ""` + + if [ -n "${HEADER}" ]; + then + echo "$0: Script '${SCRIPT}' has non-typical header." + fi + + if [ -n "${FOOTER}" ]; + then + echo "$0: Script '${SCRIPT}' has non-typical footer." + fi + + LINT=`php -l "${SCRIPT}" 2>&1 | grep -v "No syntax errors detected in"` + + if [ -n "${LINT}" ] + then + echo "$0: ${LINT}" + fi +done + +echo "$0: All done." +exit 0 -- 2.39.2