6 # Simple script to find unused message strings by Michal Čihař
10 grep -o '^\$\<str[A-Z][a-zA-Z0-9_]*\>' libraries
/messages.inc.php \
12 |
grep -Ev '^str(Transformation_|ShowStatus)' |
sort -u > $tmp1
13 grep -ho '\<str[A-Z][a-zA-Z0-9_]*\>' `find . -type f -a -name '*.php' -a -not -path '*/libraries/messages.inc.php' -a -not -path '*/js/messages.php' -a -not -path '*.js'` \
14 |
grep -Ev '^str(Transformation_|ShowStatus|Setup)' |
sort -u > $tmp2
16 echo Please note that you need to check results of this
script, it doesn
\'t
17 echo understand PHP
, it only tries to
find what looks like message name.
20 echo Used messages not present
in messages
file:
21 echo '(this contains generated messages and composed message names, so these'
22 echo 'are not necessary a errors!)'
25 # filter out known false positives
26 diff $tmp1 $tmp2 |
awk '/^>/ {print $2}' |
grep -Ev '(strEncto|strXkana|strDBLink|strPrivDesc|strPrivDescProcess|strTableListOptions|strMissingParameter|strAttribute|strDoSelectAll)'
29 echo Not used messages present
in messages
file:
32 diff $tmp1 $tmp2 |
awk '/^</ {print $2}' |
grep -Ev '(strConfig.*_(desc|name)|strConfigForm_|strConfigFormset_)'