Fork me on GitHub
Hoopla! - now with extra whiz-bang home

#!/bin/bash

check_dir() {
  for file in $*/*.php
   do
    if [ -d $file ]; then
      echo "going into $file"
      check_dir $file
    else
      if [ "`php -l $file`" = "No syntax errors detected in $file" ]; then
        echo "valid in $file"
      else
        echo "$file invalid"
      fi
    fi
  done
}


for dir in $*
 do
  check_dir $dir
done
It's very simple - but it's all that's required to get started. From here I'm going to replace the echo'ed output with tasks. Specifically, a php file will be run when files are found to be invalid and both an email and an SMS will be sent to the developer's phones. We're setting this script to run every 5 minutes, hopefully no weekends will pass from now on without being error- (at least parse error-) free.
blog comments powered by Disqus