Skip to content

Instantly share code, notes, and snippets.

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 gggeek/f6bf9348a7c6c962853b8eaca4277909 to your computer and use it in GitHub Desktop.
Save gggeek/f6bf9348a7c6c962853b8eaca4277909 to your computer and use it in GitHub Desktop.
Find out which ez4 templates are actually used in an ez5 site
#!/usr/bin/env bash
# Looks in the legacy cache folder for any compiled legacy templates belonging to a specific design
# Useful to be put in a cronjob
DESIGN=my_site_design
VARDIR=my_site
# names of compiled templates files: ${sourcetpl}-hash.php
EXCLUDEDTEMPLATES=compiled/3-
ROOTDIR=$(dirname ${BASH_SOURCE[0]})/..
TODAY=$(date +%Y-%m-%d)
FILES=$(find ${ROOTDIR}/ezpublish_legacy/var/${VARDIR}/cache/template/compiled -mtime -1 -type f -print)
if [ -n "${FILES}" ]; then
for FILE in ${FILES}
do
fgrep -q "design/${DESIGN}/templates/" ${FILE}
if [ $? -eq 0 ]; then
SOURCE=$(fgrep '// Filename:' ${FILE})
COMPILATIONDATE=$(stat -c %y ${FILE})
echo "Legacy ${DESIGN} template: ${SOURCE/\/\/ Filename: /} - compiled at ${COMPILATIONDATE} into ${FILE}"
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment