summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2002-07-10 16:22:49 +0000
committerPeter Palfrader <peter@palfrader.org>2002-07-10 16:22:49 +0000
commit9e10edb996b206d531caa5f929a117cefb790355 (patch)
tree27dd1ff688e99a1812314e884b9e9a893f0ad913 /tools
parentf116bd21fa2d0d13861dbde638ebdb33a01e8568 (diff)
Changed thesaurus filenames from nn-foo to nn.foo
Moved save_thesaurus() from Conf.pm to Thesaurus.pm
Diffstat (limited to 'tools')
-rwxr-xr-xtools/change-thesaurus-filenames42
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/change-thesaurus-filenames b/tools/change-thesaurus-filenames
new file mode 100755
index 0000000..735791d
--- /dev/null
+++ b/tools/change-thesaurus-filenames
@@ -0,0 +1,42 @@
+#! /bin/sh
+
+# In 2.0beta4 files in the Thesaurus were named <id>-<type>. E.g: 25-adminkey
+# 2.0beta5 uses dots now instead of dashes: 25.adminkey
+
+# This script reads renames files in the Thesaurus
+
+# It is assumed that the largest id in use is 999
+
+set -e
+
+FILES=`ls [0-9]-conf [0-9]-key [0-9]-stats [0-9]-help [0-9]-adminkey [0-9][0-9]-conf \
+ [0-9][0-9]-key [0-9][0-9]-stats [0-9][0-9]-help [0-9][0-9]-adminkey \
+ [0-9][0-9][0-9]-key [0-9][0-9][0-9]-stats [0-9][0-9][0-9]-help [0-9][0-9][0-9]-adminkey 2>/dev/null` || true
+
+if [ -z "$FILES" -a -d "results/thesaurus/" ]; then
+ echo Changing to directory results/thesaurus/
+ cd results/thesaurus/
+ FILES=`ls [0-9]-conf [0-9]-key [0-9]-stats [0-9]-help [0-9]-adminkey [0-9][0-9]-conf \
+ [0-9][0-9]-key [0-9][0-9]-stats [0-9][0-9]-help [0-9][0-9]-adminkey \
+ [0-9][0-9][0-9]-key [0-9][0-9][0-9]-stats [0-9][0-9][0-9]-help [0-9][0-9][0-9]-adminkey 2>/dev/null` || true
+fi
+if [ -z "$FILES" -a -d "thesaurus/" ]; then
+ echo Changing to directory thesaurus/
+ cd results/thesaurus/
+ FILES=`ls [0-9]-conf [0-9]-key [0-9]-stats [0-9]-help [0-9]-adminkey [0-9][0-9]-conf \
+ [0-9][0-9]-key [0-9][0-9]-stats [0-9][0-9]-help [0-9][0-9]-adminkey \
+ [0-9][0-9][0-9]-key [0-9][0-9][0-9]-stats [0-9][0-9][0-9]-help [0-9][0-9][0-9]-adminkey 2>/dev/null` || true
+fi
+
+if [ -z "$FILES" ]; then
+ echo "Could not find any old style filenames in '.', 'results/thesaurus/', or 'thesaurus/'" >&2
+ exit 1
+fi
+
+echo "Renaming files..."
+for file in $FILES ; do
+ mv $file `echo $file | tr '-' '.'`
+done
+
+echo "done."
+echo "The next buildthesaurus run (per default every hour) will fix the index file"