Skip to content

Commit 8d85453

Browse files
committed
switched to epel awstats package
1 parent 24fc53a commit 8d85453

File tree

6 files changed

+54
-18
lines changed

6 files changed

+54
-18
lines changed

bin/v-add-web-domain-stats

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ cat $WEBTPL/$type.tpl |\
6565
-e "s/%alias_idn%/${aliases_idn//,/ }/g" \
6666
> $HOMEDIR/$user/conf/web/$type.$domain.conf
6767

68+
if [ "$type" == 'awstats' ]; then
69+
ln -s $HOMEDIR/$user/conf/web/$type.$domain.conf /etc/awstats/
70+
fi
71+
6872

6973
#----------------------------------------------------------#
7074
# Vesta #

bin/v-delete-web-domain

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ fi
8585
if [ ! -z "$STATS" ] && [ "$STATS" != 'no' ]; then
8686
sed -i "/ $domain$/d" $VESTA/data/queue/webstats.pipe
8787
rm -f $HOMEDIR/$user/conf/web/$STATS.$domain.conf
88+
rm -f /etc/awstats/$STATS.$domain.conf
8889
fi
8990

9091
# Deleting ftp account

bin/v-delete-web-domain-stats

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ stats_dir="$HOMEDIR/$user/web/$domain/stats"
4848
rm -rf $stats_dir/*
4949

5050
# Deleting config
51+
rm -f /etc/awstats/$STATS.$domain.conf
5152
rm -f $HOMEDIR/$user/conf/web/$STATS.$domain.conf
5253

5354

bin/v-rebuild-user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fi
143143
if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then
144144
touch $USER_DATA/db.conf
145145
chmod 660 $USER_DATA/db.conf
146-
echo "v-update-databases-disk $user" >> $VESTA/data/queue/disk.pipe
146+
echo "v_update_datbases_disk $user" >> $VESTA/data/queue/disk.pipe
147147
fi
148148

149149
if [ ! -z "$CRON_SYSTEM" ] && [ "$CRON_SYSTEM" != 'no' ]; then

bin/v-rebuild-web-domains

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ for domain in $(shell_list) ; do
136136
-e "s/%alias_idn%/${aliases_idn//,/ }/g" \
137137
> $HOMEDIR/$user/conf/web/$STATS.$domain.conf
138138

139+
if [ "$STATS" == 'awstats' ]; then
140+
if [ ! -e "/etc/awstats/$STATS.$domain.conf" ]; then
141+
ln -s $HOMEDIR/$user/conf/web/$STATS.$domain.conf /etc/awstats/
142+
fi
143+
fi
144+
139145
webstats="$BIN/v-update-web-domain-stat $user $domain"
140146
check_webstats=$(grep "$webstats" $VESTA/data/queue/webstats.pipe)
141147
if [ -z "$check_webstats" ]; then

bin/v-update-web-domain-stat

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,46 +60,70 @@ build_webalizer() {
6060
}
6161

6262
build_awstats() {
63-
awstats="/var/www/awstats"
64-
awstats_options="-config=$config -staticlinks -update -output"
63+
awstats="/usr/share/awstats/wwwroot/cgi-bin/awstats.pl"
64+
wwwroot="/usr/share/awstats/wwwroot"
65+
opts="-config=$domain -staticlinks -update -output"
6566
month=$(date "+%Y-%m")
66-
output='alldomains allhosts lasthosts unknownip allrobots lastrobots
67-
session urldetail urlentry urlexit osdetail unknownos
68-
browserdetail unknownbrowser refererse refererpages keyphrases
69-
keywords errors404'
67+
output='alldomains allhosts lasthosts unknownip allemails lastemails
68+
allemailr lastemailr alllogins lastlogins allrobots lastrobots
69+
urldetail urldetail:filter urlentry urlentry:filter urlexit
70+
urlexit:filter osdetail browserdetail unknownbrowser unknownos
71+
refererse refererpages keyphrases keywords errors404 allextraX'
7072

7173
# Checking statistics directory
7274
if [ ! -e "$dir/$month" ]; then
7375
mkdir -p $dir/$month
7476
fi
7577

78+
# Logo check
79+
if [ ! -e "$dir/logo.png" ]; then
80+
cp -r $VESTA/web/images/logo.png $dir/
81+
fi
82+
7683
# Icon directory check
7784
if [ ! -e "$dir/icon" ]; then
78-
cp -r $awstats/icon $dir/
85+
cp -r $wwwroot/icon $dir/
7986
fi
8087

8188
# Creating main awstats page
82-
$awstats/awstats.pl $awstats_options |\
83-
sed -e "s%awstats.$config.%%g" > $dir/$month/index.html
89+
$awstats $opts | sed -e "s%awstats.$domain.%%g" > $dir/$month/index.html
8490

8591
# Creating suplemental awstats pages
8692
for format in $output; do
87-
$awstats/awstats.pl $awstats_options=$format |\
88-
sed -e "s%awstats.$config.%%g" > $dir/$month/$format.html
93+
$awstats $opts=$format |\
94+
sed -e "s%awstats.$domain.%%g" > $dir/$month/$format.html
8995
done
9096

9197
# Creating index page
92-
cat $WEBTPL/awstats_index.tpl | sed -e "s/%month%/$month/g" \
93-
> $dir/index.html
98+
cat $WEBTPL/awstats_index.tpl | sed -e "s/%month%/$month/g" >\
99+
$dir/index.html
94100

95101
# Creating navigation page
96102
months=$(find $dir -type d | sed -e "s%$dir/%%g" -e "s%$dir%%g" |\
97-
grep -v icon | sort -r )
103+
grep -v icon | sort -r )
98104
for link in $months; do
99-
select_m="$select_m\t <option value=\"$link\">$link<\/option>\n"
105+
year=$(echo $link |cut -f 1 -d \-)
106+
month=$(echo $link |cut -f 2 -d \-)
107+
case "$month" in
108+
1) month='January';;
109+
2) month='February';;
110+
3) month='March';;
111+
4) month='April';;
112+
5) month='May';;
113+
6) month='June';;
114+
7) month='July';;
115+
8) month='August';;
116+
9) month='September';;
117+
10) month='October';;
118+
11) month='November';;
119+
12) month='December';;
120+
esac
121+
echo $month
122+
123+
select_m="$select_m<option value=$link>$month $year<\/option>\n"
100124
done
101-
cat $WEBTPL/awstats_nav.tpl | sed -e "s/%select_month%/$select_m/" \
102-
> $dir/nav.html
125+
cat $WEBTPL/awstats_nav.tpl | sed -e "s/%select_month%/$select_m/" >\
126+
$dir/nav.html
103127

104128
}
105129

0 commit comments

Comments
 (0)