PHP Classes
elePHPant
Icontem

File: bin/lint

Recommend this page to a friend!
  Classes of Marco Cesarato  >  PHP Malware Scanner Free Tool  >  bin/lint  >  Download  
File: bin/lint
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Malware Scanner Free Tool
Scan PHP files to find malicious code
Author: By
Last change:
Date: 21 days ago
Size: 777 bytes
 

 

Contents

Class file image Download
#!/usr/bin/env bash

# Variables
# shellcheck disable=SC2164
CURRENT_DIRECTORY="$(cd "$(dirname "$0")"; pwd -P)"
PROJECT_DIRECTORY="$(dirname "${CURRENT_DIRECTORY}")"

# shellcheck disable=SC2164
cd "${PROJECT_DIRECTORY}";

echo "Checking PHP Lint..."

if [ -z "$1" ]
then
  git diff --cached --name-only --diff-filter=ACMR HEAD -- '*.php' | while read line; do
      php -l -d display_errors=1 "${PROJECT_DIRECTORY}/$line"
      if [ $? != 0 ]
      then
          echo "[!] Fix the error before(s) commit."
          exit 1
      fi
      FILES="$FILES $PROJECT_DIRECTORY/$line"
  done
else
  php -l -d display_errors=1 "${PROJECT_DIRECTORY}/$1"
  if [ $? != 0 ]
  then
      echo "[!] Fix the error before(s) commit."
      exit 1
  fi
fi

echo "[Done] Operation completed!"