aboutsummaryrefslogtreecommitdiff
path: root/sources/wiki/update.sh
blob: b8ad763e3ed0bf13a2623ad8da5f6ec8235872d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
#
#  Taginfo source: Wiki
#
#  update.sh DIR
#

set -e

DIR=$1

DATECMD='date +%Y-%m-%dT%H:%M:%S'

if [ "x" = "x$DIR" ]; then
    echo "Usage: update.sh DIR"
    exit 1
fi

echo "`$DATECMD` Start wiki..."

EXEC_RUBY="$TAGINFO_RUBY"
if [ "x$EXEC_RUBY" = "x" ]; then
    EXEC_RUBY=ruby
fi
echo "Running with ruby set as '${EXEC_RUBY}'"

DATABASE=$DIR/taginfo-wiki.db
CACHEDB=$DIR/wikicache.db
LOGFILE_WIKI_DATA=$DIR/get_wiki_data.log
LOGFILE_IMAGE_INFO=$DIR/get_image_info.log

rm -f $DIR/allpages.list
rm -f $DIR/tagpages.list
rm -f $LOGFILE
rm -f $DATABASE

if [ ! -e $CACHEDB ]; then
    sqlite3 $CACHEDB <cache.sql
fi

echo "`$DATECMD` Running init.sql..."
sqlite3 $DATABASE <../init.sql

echo "`$DATECMD` Running pre.sql..."
sqlite3 $DATABASE <pre.sql

echo "`$DATECMD` Getting page list..."
$EXEC_RUBY ./get_page_list.rb $DIR

echo "`$DATECMD` Getting wiki data..."
$EXEC_RUBY ./get_wiki_data.rb $DIR >$LOGFILE_WIKI_DATA

echo "`$DATECMD` Getting image info..."
$EXEC_RUBY ./get_image_info.rb $DIR >$LOGFILE_IMAGE_INFO

#echo "`$DATECMD` Getting links to Key/Tag/Relation pages..."
#$EXEC_RUBY ./get_links.rb $DIR >$DIR/links.list

#echo "`$DATECMD` Classifying links..."
#$EXEC_RUBY ./classify_links.rb $DIR

echo "`$DATECMD` Extracting words..."
$EXEC_RUBY ./extract_words.rb $DIR

echo "`$DATECMD` Running post.sql..."
sqlite3 $DATABASE <post.sql

echo "`$DATECMD` Done wiki."