Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2005-10-08 18:42:43 +0400
committerMichal Čihař <michal@cihar.com>2005-10-08 18:42:43 +0400
commitf3caa70e17e2fa3c3128e459237de4c8ec4c1b39 (patch)
tree851ad241b4749ed8494620d3a0678d49d88fbe72 /scripts
parentbdafbb64a34a77314d857bfb55e2304754062dd0 (diff)
complete rewrite, now much faster and finds also unset messages
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/find_unused_messages.sh39
1 files changed, 27 insertions, 12 deletions
diff --git a/scripts/find_unused_messages.sh b/scripts/find_unused_messages.sh
index 7c1ca71f03..e5c0efd5e9 100755
--- a/scripts/find_unused_messages.sh
+++ b/scripts/find_unused_messages.sh
@@ -2,15 +2,30 @@
# Simple script to find unused message strings by Michal Čihař
-phpfiles=`find . -type f -a -name '*.php' -a -not -path '*/lang/*'`
-
-grep -o 'str[A-Z][a-zA-Z_]*' lang/english-iso-8859-1.inc.php \
- | grep -Ev '^str(Transformation_|ShowStatus)' \
- | while read x
- do
- echo "Checking for $x" >&2
- if [ `grep -r "\\<$x\\>" $phpfiles | wc -l` -eq 0 ]
- then
- echo $x
- fi
- done
+tmp1=`mktemp`
+tmp2=`mktemp`
+grep -o '\<str[A-Z][a-zA-Z0-9_]*\>' lang/english-iso-8859-1.inc.php \
+ | grep -Ev '^str(Transformation_|ShowStatus)' | sort -u > $tmp1
+grep -ho '\<str[A-Z][a-zA-Z0-9_]*\>' `find . -type f -a -name '*.php' -a -not -path '*/lang/*'` \
+ | grep -Ev '^str(Transformation_|ShowStatus)' | sort -u > $tmp2
+
+echo Please note that you need to check results of this script, it doesn\'t
+echo understand PHP, it only tries to find what looks like message name.
+
+echo
+echo Used messages not present in english language file:
+echo '(this contains generated messages and composed message names, so these'
+echo 'are not necessary a errors!)'
+echo
+
+# filter out known false positives
+diff $tmp1 $tmp2 | awk '/^>/ {print $2}' | grep -Ev '(strEncto|strXkana|strDBLink|strPrivDesc|strPrivDescProcess|strTableListOptions|strMissingParameter|strAttribute)'
+
+echo
+echo Not used messages present in english language file:
+echo
+
+diff $tmp1 $tmp2 | awk '/^</ {print $2}'
+
+
+rm -f $tmp1 $tmp2