bug #3057481 Unchecking ignore does not work for duplicated insert rows
[phpmyadmin/dkf.git] / scripts / find_unused_messages.sh
blobbf01ffc653e19c8f0a68f42f33d36eb15921d087
1 #!/bin/sh
3 export LANG=C
4 set -e
6 # Simple script to find unused message strings by Michal Čihař
8 tmp1=`mktemp`
9 tmp2=`mktemp`
10 grep -o '^\$\<str[A-Z][a-zA-Z0-9_]*\>' libraries/messages.inc.php \
11 | tr -d '$' \
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.
19 echo
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!)'
23 echo
25 # filter out known false positives
26 diff $tmp1 $tmp2 | awk '/^>/ {print $2}' | grep -Ev '(strEncto|strXkana|strDBLink|strPrivDesc|strPrivDescProcess|strTableListOptions|strMissingParameter|strAttribute|strDoSelectAll)'
28 echo
29 echo Not used messages present in messages file:
30 echo
32 diff $tmp1 $tmp2 | awk '/^</ {print $2}' | grep -Ev '(strConfig.*_(desc|name)|strConfigForm_|strConfigFormset_)'
35 rm -f $tmp1 $tmp2