2014-11-18 20:18:53 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
2014-11-26 16:17:16 +01:00
|
|
|
my $awstats_lib_root = './';
|
|
|
|
my @awstats_libs = ('search_engines.pm', 'robots.pm');
|
|
|
|
|
|
|
|
# my $awstats_lib_root = '/usr/share/awstats/lib/';
|
|
|
|
# my @awstats_libs = ('browsers.pm', 'browsers_phone.pm', 'mime.pm', 'referer_spam.pm', 'search_engines.pm', 'operating_systems.pm', 'robots.pm', 'worms.pm');
|
2014-11-18 20:18:53 +01:00
|
|
|
|
|
|
|
foreach $lib (@awstats_libs) {require $awstats_lib_root . $lib;}
|
|
|
|
|
2014-11-26 16:17:16 +01:00
|
|
|
sub dumpList {
|
|
|
|
my @list = @{$_[0]};
|
|
|
|
my $FIC = $_[1];
|
|
|
|
my $first = $_[2];
|
2014-11-18 20:18:53 +01:00
|
|
|
|
2014-11-26 16:17:16 +01:00
|
|
|
foreach $r (@list)
|
2014-11-18 20:18:53 +01:00
|
|
|
{
|
2014-11-26 16:17:16 +01:00
|
|
|
$r =~ s/\'/\\\'/g;
|
|
|
|
if ($first == 0)
|
|
|
|
{
|
|
|
|
print $FIC ", ";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$first = 0;
|
|
|
|
}
|
2014-11-26 16:56:33 +01:00
|
|
|
print $FIC "'$r'";
|
2014-11-18 20:18:53 +01:00
|
|
|
}
|
|
|
|
}
|
2014-11-26 16:17:16 +01:00
|
|
|
|
|
|
|
sub dumpHash {
|
|
|
|
my %hash = %{$_[0]};
|
|
|
|
my $FIC = $_[1];
|
|
|
|
my $first = $_[2];
|
|
|
|
|
|
|
|
while( my ($k,$v) = each(%hash) ) {
|
|
|
|
$k =~ s/\'/\\\'/g;
|
|
|
|
$v =~ s/\'/\\\'/g;
|
|
|
|
if ($first == 0)
|
|
|
|
{
|
|
|
|
print $FIC ", ";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$first = 0;
|
|
|
|
}
|
2014-11-26 16:56:33 +01:00
|
|
|
print $FIC "'$k' : '$v'";
|
2014-11-26 16:17:16 +01:00
|
|
|
}
|
2014-11-18 20:18:53 +01:00
|
|
|
}
|
2014-11-26 16:17:16 +01:00
|
|
|
|
|
|
|
# Robots
|
|
|
|
open($FIC,">", "awstats_data.py") or die $!;
|
|
|
|
|
|
|
|
print $FIC "robots = [";
|
|
|
|
dumpList(\@RobotsSearchIDOrder_list1, $FIC, 1);
|
|
|
|
dumpList(\@RobotsSearchIDOrder_list2, $FIC, 0);
|
2014-11-18 20:18:53 +01:00
|
|
|
print $FIC "]\n\n";
|
|
|
|
|
2014-11-26 16:17:16 +01:00
|
|
|
print $FIC "search_engines = [";
|
|
|
|
dumpList(\@SearchEnginesSearchIDOrder_list1, $FIC, 1);
|
|
|
|
print $FIC "]\n\n";
|
|
|
|
|
|
|
|
print $FIC "search_engines_2 = [";
|
|
|
|
dumpList(\@SearchEnginesSearchIDOrder_list2, $FIC, 1);
|
|
|
|
print $FIC "]\n\n";
|
2014-11-18 20:18:53 +01:00
|
|
|
|
2014-11-26 16:17:16 +01:00
|
|
|
print $FIC "not_search_engines_keys = {";
|
|
|
|
dumpHash(\%NotSearchEnginesKeys, $FIC, 1);
|
|
|
|
print $FIC "}\n\n";
|
2014-11-18 20:18:53 +01:00
|
|
|
|
2014-11-26 16:17:16 +01:00
|
|
|
print $FIC "search_engines_hashid = {";
|
|
|
|
dumpHash(\%SearchEnginesHashID, $FIC, 1);
|
|
|
|
print $FIC "}\n\n";
|
|
|
|
|
|
|
|
print $FIC "search_engines_knwown_url = {";
|
|
|
|
dumpHash(\%SearchEnginesKnownUrl, $FIC, 1);
|
|
|
|
print $FIC "}\n\n";
|
|
|
|
|
|
|
|
close($FIC);
|