Skip to content

Instantly share code, notes, and snippets.

@gerardroche
Created January 9, 2016 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerardroche/a91b2fb4983fd78c53f6 to your computer and use it in GitHub Desktop.
Save gerardroche/a91b2fb4983fd78c53f6 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
unset CDPATH
unset IFS
init_strip_require_once() {
current_dir_name="$(basename "$PWD")"
if [ "$current_dir_name" = "Zend" -o "$current_dir_name" = "ZendX" ]; then
find . -name '*.php' \
-not -wholename '*/Loader/Autoloader.php' \
-not -wholename '*/Loader/StandardAutoloader.php' \
-not -wholename '*/Application.php' \
-print0 | xargs -0 \
sed --regexp-extended \
--in-place 's/(require_once)/\/\/ COMMENTED_REQUIRE_ONCE \1/g'
else
echo >&2 "$0: zend framework directory not found"
exit 1
fi
}
case "$1" in
--stip-require-once)
init_strip_require_once
exit 0
;;
esac
echo "usage: $0 --stip-require-once"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment