2014-11-18 20:18:53 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
2015-01-08 20:59:11 +01:00
|
|
|
my $awstats_lib_root = '/usr/share/awstats/lib/';
|
|
|
|
# my $awstats_lib_root = './';
|
|
|
|
my @awstats_libs = ('search_engines.pm', 'robots.pm', 'operating_systems.pm', 'browsers.pm');
|
2014-11-26 16:17:16 +01:00
|
|
|
|
|
|
|
# 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;}
|
2015-06-12 17:56:27 +02:00
|
|
|
require './tools/own_search_engines.pm';
|
2014-11-18 20:18:53 +01:00
|
|
|
|
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 $!;
|
|
|
|
|
2015-01-08 20:59:11 +01:00
|
|
|
print $FIC "#This file was automatically generated by iwla_convert.pl. Do not edit manually.\n\n";
|
|
|
|
|
2014-11-26 16:17:16 +01:00
|
|
|
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);
|
2015-06-12 17:56:27 +02:00
|
|
|
dumpList(\@Own_SearchEnginesSearchIDOrder, $FIC, 0);
|
2014-11-26 16:17:16 +01:00
|
|
|
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);
|
2015-06-12 17:56:27 +02:00
|
|
|
dumpHash(\%Own_SearchEnginesHashID, $FIC, 0);
|
2014-11-26 16:17:16 +01:00
|
|
|
print $FIC "}\n\n";
|
|
|
|
|
|
|
|
print $FIC "search_engines_knwown_url = {";
|
|
|
|
dumpHash(\%SearchEnginesKnownUrl, $FIC, 1);
|
2015-06-12 17:56:27 +02:00
|
|
|
dumpHash(\%Own_SearchEnginesKnownUrl, $FIC, 0);
|
2014-11-26 16:17:16 +01:00
|
|
|
print $FIC "}\n\n";
|
|
|
|
|
2015-01-08 20:59:11 +01:00
|
|
|
print $FIC "operating_systems = [";
|
|
|
|
dumpList(\@OSSearchIDOrder, $FIC, 1);
|
|
|
|
print $FIC "]\n\n";
|
|
|
|
|
|
|
|
print $FIC "operating_systems_hashid = {";
|
|
|
|
dumpHash(\%OSHashID, $FIC, 1);
|
|
|
|
print $FIC "}\n\n";
|
|
|
|
|
|
|
|
print $FIC "operating_systems_family = {";
|
|
|
|
dumpHash(\%OSFamily, $FIC, 1);
|
|
|
|
print $FIC "}\n\n";
|
|
|
|
|
|
|
|
print $FIC "browsers = [";
|
|
|
|
dumpList(\@BrowsersSearchIDOrder, $FIC, 1);
|
|
|
|
print $FIC "]\n\n";
|
|
|
|
|
|
|
|
print $FIC "browsers_hashid = {";
|
|
|
|
dumpHash(\%BrowsersHashIDLib, $FIC, 1);
|
|
|
|
print $FIC "}\n\n";
|
|
|
|
|
|
|
|
print $FIC "browsers_icons = {";
|
|
|
|
dumpHash(\%BrowsersHashIcon, $FIC, 1);
|
|
|
|
print $FIC "}\n\n";
|
|
|
|
|
2014-11-26 16:17:16 +01:00
|
|
|
close($FIC);
|