#!/bin/sh

# This script is meant to help people who have somehow lost their
# php.ini files.  It is meant to be run in the top level directory
# of an application once a reasonable php.ini file has been placed
# there, and will make the symlinks to it in all child directories.

if [ -f php.ini ]; then
	echo "Creating php.ini symlinks in child directories..."
	athrun scripts gfind . -mindepth 1 -type d \( -not -name .svn -not -name .git -or -not -prune \) -exec sh -c 'ln -sf "`echo "$1" | sed '\''s,[^/],,g; s,/,../,g'\''`php.ini" "$1/"' -- {} \;
	echo "Done!"
else
	echo "There is no php.ini file in this directory.  You should first"
	echo "put a valid php.ini file in the top level directory of your"
	echo "application, then change to that directory, and then run this"
	echo "script to make the symlinks to your php.ini file from all the"
	echo "child directories."
	exit 1
fi

