Created
May 13, 2020 08:32
-
-
Save gggeek/f6bf9348a7c6c962853b8eaca4277909 to your computer and use it in GitHub Desktop.
Find out which ez4 templates are actually used in an ez5 site
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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