From b206e5a4b881056640e9cbbe364443c186134800 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 6 Apr 2015 01:57:34 +0200 Subject: [PATCH] Find bad PHP scripts. Signed-off-by: Roland Haeder --- find-bad-php.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 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 0000000..1d530b3 --- /dev/null +++ b/find-bad-php.sh @@ -0,0 +1,24 @@ +#!/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 +done + +echo "$0: All done." +exit 0 -- 2.39.5