guess
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору патч позволяющий использовать общий DNS кеш (удобно на сервере хостинга) Код: --- /usr/local/www/awstats/cgi-bin/awstats.pl.orig Sun Feb 26 18:30:12 2006 +++ /usr/local/www/awstats/cgi-bin/awstats.pl Sun Feb 26 18:34:06 2006 @@ -45,7 +45,7 @@ use vars qw/ $DIR $PROG $Extension $Debug $ShowSteps -$DebugResetDone $DNSLookupAlreadyDone +$DebugResetDone $DNSLookupAlreadyDone $SameDNSCache $RunAsCli $UpdateFor $HeaderHTTPSent $HeaderHTMLSent $LastLine $LastLineNumber $LastLineOffset $LastLineChecksum $LastUpdate $lowerval @@ -64,7 +64,7 @@ /; $DIR=$PROG=$Extension=''; $Debug = $ShowSteps = 0; -$DebugResetDone = $DNSLookupAlreadyDone = 0; +$DebugResetDone = $DNSLookupAlreadyDone = $SameDNSCache = 0; $RunAsCli = $UpdateFor = $HeaderHTTPSent = $HeaderHTMLSent = 0; $LastLine = $LastLineNumber = $LastLineOffset = $LastLineChecksum = $LastUpdate = 0; $lowerval = 0; @@ -1132,7 +1132,7 @@ my @PossibleConfigDir=(); if ($configdir) { @PossibleConfigDir=("$configdir"); } - else { @PossibleConfigDir=("$DIR","/etc/awstats","/usr/local/etc/awstats","/etc","/etc/opt/awstats"); } + else { @PossibleConfigDir=("$DIR","/etc/awstats","/usr/local/etc/awstats","/etc","/etc/opt/awstats","/usr/local/etc/awstats/clients"); } # Open config file $FileConfig=$FileSuffix=''; @@ -4168,6 +4168,7 @@ my $filetoload=''; my $timetoload = time(); + if ($SameDNSCache) {$filesuffix='' }; if ($Debug) { debug("Call to Read_DNS_Cache [file=\"$dnscachefile\"]"); } if ($dnscachefile =~ s/(\.\w+)$//) { $dnscacheext=$1; } foreach my $dir ("$DirData",".","") { @@ -4221,6 +4222,7 @@ my $nbofelemtosave=$NBOFLASTUPDATELOOKUPTOSAVE; my $nbofelemsaved=0; + if ($SameDNSCache) {$filesuffix='' }; if ($Debug) { debug("Call to Save_DNS_Cache_File [file=\"$dnscachefile\"]"); } if (! scalar keys %$hashtosave) { if ($Debug) { debug(" No data to save"); } @@ -5514,7 +5516,7 @@ 'showsteps','showdropped','showcorrupted','showunknownorigin', 'limitflush','confdir','updatefor', 'hostfilter','hostfilterex','urlfilter','urlfilterex','refererpagesfilter','refererpagesfilterex', -'pluginmode','filterrawlog'); +'pluginmode','filterrawlog','samednscache'); $QueryString=''; # AWStats use GATEWAY_INTERFACE to known if ran as CLI or CGI. AWSTATS_DEL_GATEWAY_INTERFACE can @@ -5595,6 +5597,7 @@ if ($QueryString =~ /diricons=([^&]+)/i) { $DirIcons="$1"; } if ($QueryString =~ /pluginmode=([^&]+)/i) { $PluginMode=&Sanitize("$1",1); } if ($QueryString =~ /configdir=([^&]+)/i) { $DirConfig=&Sanitize("$1"); } + if ($QueryString =~ /samednscache/i) { $SameDNSCache=1; } # All filters if ($QueryString =~ /hostfilter=([^&]+)/i) { $FilterIn{'host'}="$1"; } # Filter on host list can also be defined with hostfilter=filter if ($QueryString =~ /hostfilterex=([^&]+)/i) { $FilterEx{'host'}="$1"; } # | сприпт по унификации обновления статистики сайтов (удобно для хостинга) болванки клиентов лежат ../etc/awstats/clients/ Код: # $Revision: 1.309 $ - $Author: eldy $ - $Date: 2005/02/18 19:11:17 $ SiteDomain="хххх" HostAliases="www.хххх" # Common part # # overrides settings Include "/usr/local/etc/awstats/awstats.common.conf" | Сам скрипт, он также генерит обновленную входящую страницу на статистику. Код: #!/bin/sh # #---------------------------------------------------------------------- # Description: awstats_update.sh: script Updating awstats databasee # Created at: 2005-02-28 16:25:18 (+0200) # System: FreeBSD 4.10-RELEASE-p4 on i386 # #---------------------------------------------------------------------- # Configure section: # LOGS=/var/db/awstats/logs awstats=/usr/local/www/awstats/cgi-bin/awstats.pl # where to put index ( empty string means no Index) index='/www/vhosts/stat/index.html' # # Do not rename variable, some rewrite rules rely on it # One can just add sites to variable UPDATES='test.com test.net' #---------------------------------------------------------------------- #cat /dev/null > $LOGS # echo --- Start -- `date` --- > $LOGS # Http - Apache # All ${awstats} -config=all -samednscache -update >> $LOGS # # clients for i in ${UPDATES} do ${awstats} -config=${i} -configdir='/usr/local/etc/awstats/clients/' -samednscache -update >> $LOGS done # /Http # Build configs echo --- End -- `date` --- >> $LOGS # # Generate Html Index file # # no index [ -z "$index" ] && exit url='/cgi-bin/awstats.pl?config=' # # Basic part body="<li><a href=\"${url}all\"> All sites </a> </li> <li><a href=\"${url}ftp\"> Ftp usage </a> </li> <br />" count_sites=2 # clients for i in ${UPDATES} do body="${body} <li> <a href=\"${url}${i}\"> ${i} </a> </li>" count_sites=$(($count_sites + 1)) done # # Check if we already have new index file [ -s $index ] && [ -n "`head -n 2 $index | grep "_count=${count_sites}_" `" ] && exit # Make index file cat > $index <<- _HTML_ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <?-- _count=${count_sites}_ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=koi8-r"> <title>Welcome to Webhosting Statictics Site!</title> </head> <body> <h3> Webhosting Statictics </h3> <b> Statisctics for : </b> ${body} <hr> <span dir="ltr" style="font: 11px verdana, arial, helvetica; color: #000000;"> <b>Advanced Web Statistics 6.4 </b> - Created by awstats</a> </span> <br /> \$: index.html,v 1.0 `date +'%Y/%m/%d %T'` freedom Exp $ </body> </html> _HTML_ # echo '' echo --- Generated $index -- `date` --- >> $LOGS #End. |
|