--- /dev/null
+#!/usr/bin/python
+# 1 mp3 to m3u
+# depends: fapg
+
+import os, sys, string
+
+host = 'audio.pre-barreau.com'
+root_dir = '/home/pro-barreau/www/audio'
+web_dir = '/'
+types = ['mp3','ogg','flac']
+
+#s.chdir(root_dir)
+
+for root, dirs, files in os.walk(root_dir+web_dir):
+ #print root
+ for file in files:
+ file_split = file.split('.')
+ filename = file_split[len(file_split)-2]
+ #print filename
+ if not os.path.exists(root+os.sep+filename+'.m3u'):
+ fileext = file_split[len(file_split)-1]
+ if fileext in types :
+ os.chdir(root_dir)
+ prefix = 'http://'+host+'/'
+ dest_dir = string.replace(root,'/home/pro-barreau/www/audio/','')
+ file_new = string.replace(file,' ','_')
+ filename_new = string.replace(filename,' ','_')
+ if file_new != file:
+ os.system('mv "'+dest_dir+os.sep+file+'" "'+dest_dir+os.sep+file_new+'"')
+ os.system('fapg -f m3u -p '+prefix+' -o "'+root+os.sep+filename_new+'.m3u" "'+dest_dir+os.sep+file_new+'"')
+
--- /dev/null
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# 1 mp3 to m3u
+# depends: fapg
+
+import os, sys, string
+
+stretch_app = '/home/momo/apps/audio/paulstretch_python/paulstretch_newmethod.py'
+root_dir = '/home/momo/music_local/source'
+dest_dir = '/home/momo/music_local/stretch'
+types = ['wav','WAV']
+streches = ['0.25','0.5','2','10','50']
+
+for root, dirs, files in os.walk(root_dir):
+ for file in files:
+ print file
+ in_file = root+os.sep+file
+ file_split = file.split('.')
+ filename = file_split[len(file_split)-2]
+ for s in streches:
+ new_file = dest_dir+os.sep+filename+'_s'+s+'.wav'
+ if not os.path.exists(new_file):
+ os.system(stretch_app + ' -s '+s+' "'+in_file+'" "'+new_file+'"')
+
+
--- /dev/null
+#!/usr/bin/python
+
+import os
+import sys
+import string
+
+class ApacheConfig:
+ """Implements the whole configuration of Apache server"""
+
+ def __init__(self, conf_dir):
+ self.conf_dir = conf_dir
+ self.conf_list = os.listdir(self.conf_dir)
+ self.confs = self.get_confs()
+ self.domains = self.get_domains()
+ self.conf_number = len(self.confs)
+
+ def get_confs(self):
+ """return a dictionnary describing all the Apache domains"""
+ confs = []
+ for conf in self.conf_list:
+ c = ApacheVitualHost(self.conf_dir+os.sep+conf)
+ conf_dict = {}
+ conf_dict['domain'] = c.domain
+ conf_dict['conf'] = c.conf
+ confs.append(conf_dict)
+ return confs
+
+ def get_domains(self):
+ domains = []
+ for conf in self.confs:
+ if conf['domain']:
+ domains.append(conf['domain'])
+ return domains
+
+ #if 'ServerName' in conf:
+ #domain = conf['ServerName']
+ #else:
+ #domain = 'unknown'
+ #if domain and not 'stats' in domain:
+ #domains.append(domain)
+
+ def get_param(self, param):
+ pass
+
+ def get_custom_logs(self):
+ logs = {}
+ for conf in self.confs:
+ if conf['conf']['CustomLog']:
+ logs[conf['domain']] = conf['conf']['CustomLog']
+ return logs
+
+
+class ApacheVitualHost:
+ """Implements an Apache virtualhost"""
+
+ def __init__(self, conf_file):
+ self.conf_file = conf_file
+ self.conf = self.get_conf()
+ self.domain = self.get_domain()
+
+ def get_conf(self):
+ """return a dictionnary describing the Apache virtualhost"""
+ conf_file = open(self.conf_file)
+ conf = conf_file.readlines()
+ conf_dict = {}
+ for line in conf:
+ line = line.strip()
+ if line:
+ if line[0] != '<' and line[0] != '#':
+ #print line
+ param = line.split(' ')
+ param = [w for w in param if len(w) > 0]
+ #print param
+ if len(param) > 1:
+ conf_dict[param[0]] = param[1]
+ #print conf_dict
+ return conf_dict
+ conf_file.close()
+
+ def get_domain(self):
+ if 'ServerName' in self.conf:
+ domain = self.conf['ServerName']
+ else:
+ domain = 'unknown'
+ if domain:
+ return domain
+
+
+class AwstatsConfig:
+ """Implements the whole configuration of Awstats system"""
+
+ def __init__(self, conf_dir):
+ self.conf_dir = conf_dir
+ self.conf_list = os.listdir(self.conf_dir)
+ self.confs = self.get_confs()
+ self.domains = self.get_domains()
+ self.conf_number = len(self.confs)
+ self.default_conf = 'awstats_default.conf'
+
+ def get_confs(self):
+ """return a dictionnary describing all the Awstats domains"""
+ confs = []
+ for conf in self.conf_list:
+ c = AwstatsDomain(self.conf_dir+os.sep+conf)
+ conf_dict = {}
+ conf_dict['domain'] = c.domain
+ conf_dict['conf'] = c.conf
+ confs.append(conf_dict)
+ return confs
+
+ def get_domains(self):
+ domains = []
+ for conf in self.confs:
+ if conf['domain']:
+ domains.append(conf['domain'])
+ return domains
+
+ def get_custom_logs(self):
+ """return a dictionnary of all the custom log files"""
+ logs = {}
+ for conf in self.confs:
+ if conf['conf']:
+ if conf['conf']['LogFile']:
+ logs[conf['domain']] = conf['conf']['LogFile']
+ return logs
+
+
+class AwstatsDomain:
+ """Implements an Awstasts domain"""
+ def __init__(self, conf_file):
+ self.conf_file = conf_file
+ self.conf = self.get_conf()
+ self.domain = self.get_domain()
+
+ def get_conf(self):
+ """return a dictionnary describing the Awstats domain"""
+ conf_file = open(self.conf_file)
+ conf = conf_file.readlines()
+ conf_dict = {}
+ for line in conf:
+ line = line.strip()
+ if line:
+ if line[0] != '<' and line[0] != '#':
+ #print line
+ param = line.split('=')
+ param = [w for w in param if len(w) > 0]
+ #print param
+ if len(param) > 1:
+ conf_dict[param[0]] = param[1].replace('"','').replace('\t','').strip()
+ #print conf_dict
+ return conf_dict
+ conf_file.close()
+
+ def get_domain(self):
+ if 'SiteDomain' in self.conf:
+ domain = self.conf['SiteDomain']
+ else:
+ domain = ''
+ if domain:
+ return domain
+
+ def set_conf(self):
+ pass
+
+ def get_apache_conf(self):
+ return """ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
+ <Directory "/usr/lib/cgi-bin">
+ AllowOverride All
+ Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+ Alias /awstats-icon/ "/usr/share/awstats/icon/"
+ <Directory /usr/share/awstats/icon>
+ AllowOverride None
+ Options None
+ Order allow,deny
+ Allow from all
+ </Directory>
+ """
+
+def main():
+ a = ApacheConfig('/etc/apache2/sites-available/')
+ w = AwstatsConfig('/etc/awstats/')
+
+<<<<<<< .mine
+#print w.get_confs( )
+print w.get_domains()
+print w.get_custom_logs()
+=======
+ print a.get_domains()
+ print a.get_custom_logs()
+
+ #print w.get_confs()
+ print w.get_domains()
+ print w.get_custom_logs()
+ print
+
+if __name__ == '__main__':
+ main()
+
+>>>>>>> .r64
--- /dev/null
+# AWSTATS CONFIGURE FILE 6.6
+#-----------------------------------------------------------------------------
+# Copy this file into awstats.www.mydomain.conf and edit this new config file
+# to setup AWStats (See documentation in docs/ directory).
+# The config file must be in /etc/awstats, /usr/local/etc/awstats or /etc (for
+# Unix/Linux) or same directory than awstats.pl (Windows, Mac, Unix/Linux...)
+# To include an environment variable in any parameter (AWStats will replace
+# it with its value when reading it), follow the example:
+# Parameter="__ENVNAME__"
+# Note that environment variable AWSTATS_CURRENT_CONFIG is always defined with
+# the config value in an AWStats running session and can be used like others.
+#-----------------------------------------------------------------------------
+# $Revision: 1.327 $ - $Author: eldy $ - $Date: 2006/04/21 22:28:49 $
+
+
+
+#-----------------------------------------------------------------------------
+# MAIN SETUP SECTION (Required to make AWStats work)
+#-----------------------------------------------------------------------------
+
+# "LogFile" contains the web, ftp or mail server log file to analyze.
+# Possible values: A full path, or a relative path from awstats.pl directory.
+# Example: "/var/log/apache/access.log"
+# Example: "../logs/mycombinedlog.log"
+# You can also use tags in this filename if you need a dynamic file name
+# depending on date or time (Replacement is made by AWStats at the beginning
+# of its execution). This is available tags :
+# %YYYY-n is replaced with 4 digits year we were n hours ago
+# %YY-n is replaced with 2 digits year we were n hours ago
+# %MM-n is replaced with 2 digits month we were n hours ago
+# %MO-n is replaced with 3 letters month we were n hours ago
+# %DD-n is replaced with day we were n hours ago
+# %HH-n is replaced with hour we were n hours ago
+# %NS-n is replaced with number of seconds at 00:00 since 1970
+# %WM-n is replaced with the week number in month (1-5)
+# %Wm-n is replaced with the week number in month (0-4)
+# %WY-n is replaced with the week number in year (01-52)
+# %Wy-n is replaced with the week number in year (00-51)
+# %DW-n is replaced with the day number in week (1-7, 1=sunday)
+# use n=24 if you need (1-7, 1=monday)
+# %Dw-n is replaced with the day number in week (0-6, 0=sunday)
+# use n=24 if you need (0-6, 0=monday)
+# Use 0 for n if you need current year, month, day, hour...
+# Example: "/var/log/access_log.%YYYY-0%MM-0%DD-0.log"
+# Example: "C:/WINNT/system32/LogFiles/W3SVC1/ex%YY-24%MM-24%DD-24.log"
+# You can also use a pipe if log file come from a pipe :
+# Example: "gzip -d </var/log/apache/access.log.gz |"
+# If there are several log files from load balancing servers :
+# Example: "/pathtotools/logresolvemerge.pl *.log |"
+#
+LogFile="/var/log/apache/access.log"
+
+
+# Enter the log file type you want to analyze.
+# Possible values:
+# W - For a web log file
+# S - For a streaming log file
+# M - For a mail log file
+# F - For a ftp log file
+# Example: W
+# Default: W
+#
+LogType=W
+
+
+# Enter here your log format (Must match your web server config. See setup
+# instructions in documentation to know how to configure your web server to
+# have the required log format).
+# Possible values: 1,2,3,4 or "your_own_personalized_log_format"
+# 1 - Apache or Lotus Notes/Domino native combined log format (NCSA combined/XLF/ELF log format)
+# 2 - IIS or ISA format (IIS W3C log format). See FAQ-COM115 For ISA.
+# 3 - Webstar native log format.
+# 4 - Apache or Squid native common log format (NCSA common/CLF log format)
+# With LogFormat=4, some features (browsers, os, keywords...) can't work.
+# "your_own_personalized_log_format" = If your log is ftp, mail or other format,
+# you must use following keys to define the log format string (See FAQ for
+# ftp, mail or exotic web log format examples):
+# %host Client hostname or IP address (or Sender host for mail log)
+# %host_r Receiver hostname or IP address (for mail log)
+# %lognamequot Authenticated login/user with format: "john"
+# %logname Authenticated login/user with format: john
+# %time1 Date and time with format: [dd/mon/yyyy:hh:mm:ss +0000] or [dd/mon/yyyy:hh:mm:ss]
+# %time2 Date and time with format: yyyy-mm-dd hh:mm:ss
+# %time3 Date and time with format: Mon dd hh:mm:ss or Mon dd hh:mm:ss yyyy
+# %time4 Date and time with unix timestamp format: dddddddddd
+# %methodurl Method and URL with format: "GET /index.html HTTP/x.x"
+# %methodurlnoprot Method and URL with format: "GET /index.html"
+# %method Method with format: GET
+# %url URL only with format: /index.html
+# %query Query string (used by URLWithQuery option)
+# %code Return code status (with format for web log: 999)
+# %bytesd Size of document in bytes
+# %refererquot Referer page with format: "http://from.com/from.htm"
+# %referer Referer page with format: http://from.com/from.htm
+# %uabracket User agent with format: [Mozilla/4.0 (compatible, ...)]
+# %uaquot User agent with format: "Mozilla/4.0 (compatible, ...)"
+# %ua User agent with format: Mozilla/4.0_(compatible...)
+# %gzipin mod_gzip compression input bytes: In:XXX
+# %gzipout mod_gzip compression output bytes & ratio: Out:YYY:ZZpct.
+# %gzipratio mod_gzip compression ratio: ZZpct.
+# %deflateratio mod_deflate compression ratio with format: (ZZ)
+# %email EMail sender (for mail log)
+# %email_r EMail receiver (for mail log)
+# %virtualname Web sever virtual hostname. Use this tag when same log
+# contains data of several virtual web servers. AWStats
+# will discard records not in SiteDomain nor HostAliases
+# %cluster If log file is provided from several computers (merged by
+# logresolvemerge.pl), use this to define cluster id field.
+# %extraX Another field that you plan to use for building a
+# personalized report with ExtraSection feature (See later).
+# If your log format has some fields not included in this list, use:
+# %other Means another not used field
+# %otherquot Means another not used double quoted field
+#
+# Examples for Apache combined logs (following two examples are equivalent):
+# LogFormat = 1
+# LogFormat = "%host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot"
+#
+# Example for IIS:
+# LogFormat = 2
+#
+LogFormat=1
+
+
+# If your log field's separator is not a space, you can change this parameter.
+# This parameter is not used if LogFormat is a predefined value (1,2,3,4)
+# Backslash can be used as escape character.
+# Example: " "
+# Example: "\t"
+# Example: "\|"
+# Example: ","
+# Default: " "
+#
+LogSeparator=" "
+
+
+# "SiteDomain" must contain the main domain name, or the main intranet web
+# server name, used to reach the web site.
+# If you share the same log file for several virtual web servers, this
+# parameter is used to tell AWStats to filter record that contains records for
+# this virtual host name only (So check that this virtual hostname can be
+# found in your log file and use a personalized log format that include the
+# %virtualname tag).
+# But for multi hosting a better solution is to have one log file for each
+# virtual web server. In this case, this parameter is only used to generate
+# full URL's links when ShowLinksOnUrl option is set to 1.
+# If analyzing mail log, enter here the domain name of mail server.
+# Example: "myintranetserver"
+# Example: "www.domain.com"
+# Example: "ftp.domain.com"
+# Example: "domain.com"
+#
+SiteDomain=""
+
+
+# Enter here all other possible domain names, addresses or virtual host
+# aliases someone can use to access your site. Try to keep only the minimum
+# number of possible names/addresses to have the best performances.
+# You can repeat the "SiteDomain" value in this list.
+# This parameter is used to analyze referer field in log file and to help
+# AWStats to know if a referer URL is a local URL of same site or an URL of
+# another site.
+# Note: Use space between each value.
+# Note: You can use regular expression values writing value with REGEX[value].
+# Note: You can also use @/mypath/myfile if list of aliases are in a file.
+# Example: "www.myserver.com localhost 127.0.0.1 REGEX[mydomain\.(net|org)$]"
+#
+HostAliases="localhost 127.0.0.1"
+
+
+# If you want to have hosts reported by name instead of ip address, AWStats
+# need to make reverse DNS lookups (if not already done in your log file).
+# With DNSLookup to 0, all hosts will be reported by their IP addresses and
+# not by the full hostname of visitors (except if names are already available
+# in log file).
+# If you want/need to set DNSLookup to 1, don't forget that this will reduce
+# dramatically AWStats update process speed. Do not use on large web sites.
+# Note: Reverse DNS lookup is done on IPv4 only (Enable ipv6 plugin for IPv6).
+# Note: Result of DNS Lookup can be used to build the Country report. However
+# it is highly recommanded to enable the plugin 'geoipfree' or 'geoip' to
+# have an accurate Country report with no need of DNS Lookup.
+# Possible values:
+# 0 - No DNS Lookup
+# 1 - DNS Lookup is fully enabled
+# 2 - DNS Lookup is made only from static DNS cache file (if it exists)
+# Default: 2
+#
+DNSLookup=1
+
+
+# When AWStats updates its statistics, it stores results of its analysis in
+# files (AWStats database). All those files are written in the directory
+# defined by the "DirData" parameter. Set this value to the directory where
+# you want AWStats to save its database and working files into.
+# Warning: If you want to be able to use the "AllowToUpdateStatsFromBrowser"
+# feature (see later), you need "Write" permissions by web server user on this
+# directory (and "Modify" for Windows NTFS file systems).
+# Example: "/var/lib/awstats"
+# Example: "../data"
+# Example: "C:/awstats_data_dir"
+# Default: "." (means same directory as awstats.pl)
+#
+DirData="/var/lib/awstats"
+
+
+# Relative or absolute web URL of your awstats cgi-bin directory.
+# This parameter is used only when AWStats is run from command line
+# with -output option (to generate links in HTML reported page).
+# Example: "/awstats"
+# Default: "/cgi-bin" (means awstats.pl is in "/yourwwwroot/cgi-bin")
+#
+DirCgi="/cgi-bin"
+
+
+# Relative or absolute web URL of your awstats icon directory.
+# If you build static reports ("... -output > outputpath/output.html"), enter
+# path of icon directory relative to the output directory 'outputpath'.
+# Example: "/awstatsicons"
+# Example: "../icon"
+# Default: "/icon" (means you must copy icon directories in "/mywwwroot/icon")
+#
+DirIcons="/awstats-icon"
+
+
+# When this parameter is set to 1, AWStats adds a button on report page to
+# allow to "update" statistics from a web browser. Warning, when "update" is
+# made from a browser, AWStats is run as a CGI by the web server user defined
+# in your web server (user "nobody" by default with Apache, "IUSR_XXX" with
+# IIS), so the "DirData" directory and all already existing history files
+# awstatsMMYYYY[.xxx].txt must be writable by this user. Change permissions if
+# necessary to "Read/Write" (and "Modify" for Windows NTFS file systems).
+# Warning: Update process can be long so you might experience "time out"
+# browser errors if you don't launch AWStats frequently enough.
+# When set to 0, update is only made when AWStats is run from the command
+# line interface (or a task scheduler).
+# Possible values: 0 or 1
+# Default: 0
+#
+AllowToUpdateStatsFromBrowser=0
+
+
+# AWStats saves and sorts its database on a month basis (except if using
+# databasebreak option from command line).
+# However, if you choose the -month=all from command line or
+# value '-Year-' from CGI combo form to have a report for all year, AWStats
+# needs to reload all data for full year (each month), and sort them,
+# requiring a large amount of time, memory and CPU. This might be a problem
+# for web hosting providers that offer AWStats for large sites, on shared
+# servers, to non CPU cautious customers.
+# For this reason, the 'full year' is only enabled on Command Line by default.
+# You can change this by setting this parameter to 0, 1, 2 or 3.
+# Possible values:
+# 0 - Never allowed
+# 1 - Allowed on CLI only, -Year- value in combo is not visible
+# 2 - Allowed on CLI only, -Year- value in combo is visible but not allowed
+# 3 - Possible on CLI and CGI
+# Default: 2
+#
+AllowFullYearView=2
+
+
+
+#-----------------------------------------------------------------------------
+# OPTIONAL SETUP SECTION (Not required but increase AWStats features)
+#-----------------------------------------------------------------------------
+
+# When the update process runs, AWStats can set a lock file in TEMP or TMP
+# directory. This lock is to avoid to have 2 update processes running at the
+# same time to prevent unknown conflicts problems and avoid DoS attacks when
+# AllowToUpdateStatsFromBrowser is set to 1.
+# Because, when you use lock file, you can experience sometimes problems in
+# lock file not correctly removed (killed process for example requires that
+# you remove the file manualy), this option is not enabled by default (Do
+# not enable this option with no console server access).
+# Change : Effective immediatly
+# Possible values: 0 or 1
+# Default: 0
+#
+EnableLockForUpdate=0
+
+
+# AWStats can do reverse DNS lookups through a static DNS cache file that was
+# previously created manually. If no path is given in static DNS cache file
+# name, AWStats will search DirData directory. This file is never changed.
+# This option is not used if DNSLookup=0.
+# Note: DNS cache file format is 'minsince1970 ipaddress resolved_hostname'
+# or just 'ipaddress resolved_hostname'
+# Change : Effective for new updates only
+# Example: "/mydnscachedir/dnscache"
+# Default: "dnscache.txt"
+#
+DNSStaticCacheFile="dnscache.txt"
+
+
+# AWStats can do reverse DNS lookups through a DNS cache file that was created
+# by a previous run of AWStats. This file is erased and recreated after each
+# statistics update process. You don't need to create and/or edit it.
+# AWStats will read and save this file in DirData directory.
+# This option is used only if DNSLookup=1.
+# Note: If a DNSStaticCacheFile is available, AWStats will check for DNS
+# lookup in DNSLastUpdateCacheFile after checking into DNSStaticCacheFile.
+# Change : Effective for new updates only
+# Example: "/mydnscachedir/dnscachelastupdate"
+# Default: "dnscachelastupdate.txt"
+#
+DNSLastUpdateCacheFile="dnscachelastupdate.txt"
+
+
+# You can specify specific IP addresses that should NOT be looked up in DNS.
+# This option is used only if DNSLookup=1.
+# Note: Use space between each value.
+# Note: You can use regular expression values writing value with REGEX[value].
+# Change : Effective for new updates only
+# Example: "123.123.123.123 REGEX[^192\.168\.]"
+# Default: ""
+#
+SkipDNSLookupFor=""
+
+
+# The following two parameters allow you to protect a config file from being
+# read by AWStats when called from a browser if web user has not been
+# authenticated. Your AWStats program must be in a web protected "realm" (With
+# Apache, you can use .htaccess files to do so. With other web servers, see
+# your server setup manual).
+# Change : Effective immediatly
+# Possible values: 0 or 1
+# Default: 0
+#
+AllowAccessFromWebToAuthenticatedUsersOnly=0
+
+
+# This parameter gives the list of all authorized authenticated users to view
+# statistics for this domain/config file. This parameter is used only if
+# AllowAccessFromWebToAuthenticatedUsersOnly is set to 1.
+# Change : Effective immediatly
+# Example: "user1 user2"
+# Example: "__REMOTE_USER__"
+# Default: ""
+#
+AllowAccessFromWebToFollowingAuthenticatedUsers=""
+
+
+# When this parameter is defined to something, the IP address of the user that
+# reads its statistics from a browser (when AWStats is used as a CGI) is
+# checked and must match one of the IP address values or ranges.
+# Change : Effective immediatly
+# Example: "127.0.0.1 123.123.123.1-123.123.123.255"
+# Default: ""
+#
+AllowAccessFromWebToFollowingIPAddresses=""
+
+
+# If the "DirData" directory (see above) does not exist, AWStats return an
+# error. However, you can ask AWStats to create it.
+# This option can be used by some Web Hosting Providers that has defined a
+# dynamic value for DirData (for example DirData="/home/__REMOTE_USER__") and
+# don't want to have to create a new directory each time they add a new user.
+# Change : Effective immediatly
+# Possible values: 0 or 1
+# Default: 0
+#
+CreateDirDataIfNotExists=0
+
+
+# You can choose in which format the Awstats history database is saved.
+# Note: Using "xml" format make AWStats building database files three times
+# larger than using "text" format.
+# Change : Database format is switched after next update
+# Possible values: text or xml
+# Default: text
+#
+BuildHistoryFormat=text
+
+
+# If you prefer having the report output pages be built as XML compliant pages
+# instead of simple HTML pages, you can set this to 'xhtml' (May not work
+# properly with old browsers).
+# Change : Effective immediatly
+# Possible values: html or xhtml
+# Default: html
+#
+BuildReportFormat=html
+
+
+# AWStats databases can be updated from command line of from a browser (when
+# used as a cgi program). So AWStats database files need write permission
+# for both command line user and default web server user (nobody for Unix,
+# IUSR_xxx for IIS/Windows,...).
+# To avoid permission problems between update process (run by an admin user)
+# and CGI process (ran by a low level user), AWStats can save its database
+# files with read and write permissions for everyone.
+# By default, AWStats keeps default user permissions on updated files. If you
+# set AllowToUpdateStatsFromBrowser to 1, you can change this parameter to 1.
+# Change : Effective for new updates only
+# Possible values: 0 or 1
+# Default: 0
+#
+SaveDatabaseFilesWithPermissionsForEveryone=0
+
+
+# AWStats can purge log file, after analyzing it. Note that AWStats is able
+# to detect new lines in a log file, to process only them, so you can launch
+# AWStats as often as you want, even with this parameter to 0.
+# With 0, no purge is made, so you must use a scheduled task or a web server
+# that make this purge frequently.
+# With 1, the purge of the log file is made each time AWStats update is run.
+# This parameter doesn't work with IIS (This web server doesn't let its log
+# file to be purged).
+# Change : Effective for new updates only
+# Possible values: 0 or 1
+# Default: 0
+#
+PurgeLogFile=0
+
+
+# When PurgeLogFile is setup to 1, AWStats will clean your log file after
+# processing it. You can however keep an archive file of all processed log
+# records by setting this parameter (For example if you want to use another
+# log analyzer). The archived log file is saved in "DirData" with name
+# awstats_archive.configname[.suffix].log
+# This parameter is not used if PurgeLogFile=0
+# Change : Effective for new updates only
+# Possible values: 0, 1, or tags (See LogFile parameter) for suffix
+# Example: 1
+# Example: %YYYY%MM%DD
+# Default: 0
+#
+ArchiveLogRecords=0
+
+
+# Each time you run the update process, AWStats overwrites the 'historic file'
+# for the month (awstatsMMYYYY[.*].txt) with the updated one.
+# When write errors occurs (IO, disk full,...), this historic file can be
+# corrupted and must be deleted. Because this file contains information of all
+# past processed log files, you will loose old stats if removed. So you can
+# ask AWStats to save last non corrupted file in a .bak file. This file is
+# stored in "DirData" directory with other 'historic files'.
+# Change : Effective for new updates only
+# Possible values: 0 or 1
+# Default: 0
+#
+KeepBackupOfHistoricFiles=0
+
+
+# Default index page name for your web server.
+# Change : Effective for new updates only
+# Example: "index.php index.html default.html"
+# Default: "index.html"
+#
+DefaultFile="index.html"
+
+
+# Do not include access from clients that match following criteria.
+# If your log file contains IP addresses in host field, you must enter here
+# matching IP addresses criteria.
+# If DNS lookup is already done in your log file, you must enter here hostname
+# criteria, else enter ip address criteria.
+# The opposite parameter of "SkipHosts" is "OnlyHosts".
+# Note: Use space between each value. This parameter is not case sensitive.
+# Note: You can use regular expression values writing value with REGEX[value].
+# Change : Effective for new updates only
+# Example: "127.0.0.1 REGEX[^192\.168\.] REGEX[^10\.]"
+# Example: "localhost REGEX[^.*\.localdomain$]"
+# Default: ""
+#
+SkipHosts=""
+
+
+# Do not include access from clients with a user agent that match following
+# criteria. If you want to exclude a robot, you should update the robots.pm
+# file instead of this parameter.
+# The opposite parameter of "SkipUserAgents" is "OnlyUserAgents".
+# Note: Use space between each value. This parameter is not case sensitive.
+# Note: You can use regular expression values writing value with REGEX[value].
+# Change : Effective for new updates only
+# Example: "konqueror REGEX[ua_test_v\d\.\d]"
+# Default: ""
+#
+SkipUserAgents=""
+
+
+# Use SkipFiles to ignore access to URLs that match one of following entries.
+# You can enter a list of not important URLs (like framed menus, hidden pages,
+# etc...) to exclude them from statistics. You must enter here exact relative
+# URL as found in log file, or a matching REGEX value. Check apply on URL with
+# all its query paramaters.
+# For example, to ignore /badpage.php, just add "/badpage.php". To ignore all
+# pages in a particular directory, add "REGEX[^\/directorytoexclude]".
+# The opposite parameter of "SkipFiles" is "OnlyFiles".
+# Note: Use space between each value. This parameter is or not case sensitive
+# depending on URLNotCaseSensitive parameter.
+# Note: You can use regular expression values writing value with REGEX[value].
+# Change : Effective for new updates only
+# Example: "/badpage.php /page.php?param=x REGEX[^\/excludedirectory]"
+# Default: ""
+#
+SkipFiles=""
+
+
+# Use SkipReferrersBlackList if you want to exclude records coming from a SPAM
+# referrer. Parameter must receive a local file name containing rules applied
+# on referrer field. If parameter is empty, no filter is applied.
+# An example of such a file is available in lib/blacklist.txt
+# You can download updated version at http://www.jayallen.org/comment_spam/
+# Change : Effective for new updates only
+# Example: "/mylibpath/blacklist.txt"
+# Default: ""
+#
+# WARNING!! Using this feature make AWStats running very slower (5 times slower
+# with black list file provided with AWStats !
+#
+SkipReferrersBlackList=""
+
+
+# Include in stats, only accesses from hosts that match one of following
+# entries. For example, if you want AWStats to filter access to keep only
+# stats for visits from particular hosts, you can add those host names in
+# this parameter.
+# If DNS lookup is already done in your log file, you must enter here hostname
+# criteria, else enter ip address criteria.
+# The opposite parameter of "OnlyHosts" is "SkipHosts".
+# Note: Use space between each value. This parameter is not case sensitive.
+# Note: You can use regular expression values writing value with REGEX[value].
+# Change : Effective for new updates only
+# Example: "127.0.0.1 REGEX[^192\.168\.] REGEX[^10\.]"
+# Default: ""
+#
+OnlyHosts=""
+
+
+# Include in stats, only accesses from user agent that match one of following
+# entries. For example, if you want AWStats to filter access to keep only
+# stats for visits from particular browsers, you can add their user agents
+# string in this parameter.
+# The opposite parameter of "OnlyUserAgents" is "SkipUserAgents".
+# Note: Use space between each value. This parameter is not case sensitive.
+# Note: You can use regular expression values writing value with REGEX[value].
+# Change : Effective for new updates only
+# Example: "msie"
+# Default: ""
+#
+OnlyUserAgents=""
+
+
+# Include in stats, only accesses to URLs that match one of following entries.
+# For example, if you want AWStats to filter access to keep only stats that
+# match a particular string, like a particular directory, you can add this
+# directory name in this parameter.
+# The opposite parameter of "OnlyFiles" is "SkipFiles".
+# Note: Use space between each value. This parameter is or not case sensitive
+# depending on URLNotCaseSensitive parameter.
+# Note: You can use regular expression values writing value with REGEX[value].
+# Change : Effective for new updates only
+# Example: "REGEX[marketing_directory] REGEX[office\/.*\.(csv|sxw)$]"
+# Default: ""
+#
+OnlyFiles=""
+
+
+# Add here a list of kind of url (file extension) that must be counted as
+# "Hit only" and not as a "Hit" and "Page/Download". You can set here all
+# image extensions as they are hit downloaded that must be counted but they
+# are not viewed pages. URLs with such extensions are not included in the TOP
+# Pages/URL report.
+# Note: If you want to exclude particular URLs from stats (No Pages and no
+# Hits reported), you must use SkipFiles parameter.
+# Change : Effective for new updates only
+# Example: "css js class gif jpg jpeg png bmp ico zip arj gz z wav mp3 wma mpg"
+# Example: ""
+# Default: "css js class gif jpg jpeg png bmp ico"
+#
+NotPageList="css js class gif jpg jpeg png bmp ico swf"
+
+
+# By default, AWStats considers that records found in web log file are
+# successful hits if HTTP code returned by server is a valid HTTP code (200
+# and 304). Any other code are reported in HTTP status chart.
+# Note that HTTP 'control codes', like redirection (302, 305) are not added by
+# default in this list as they are not pages seen by a visitor but are
+# protocol exchange codes to tell the browser to ask another page. Because
+# this other page will be counted and seen with a 200 or 304 code, if you
+# add such codes, you will have 2 pages viewed reported for only one in facts.
+# Change : Effective for new updates only
+# Example: "200 304 302 305"
+# Default: "200 304"
+#
+ValidHTTPCodes="200 304"
+
+
+# By default, AWStats considers that records found in mail log file are
+# successful mail transfers if field that represent return code in analyzed
+# log file match values defined by this parameter.
+# Change : Effective for new updates only
+# Example: "1 250 200"
+# Default: "1 250"
+#
+ValidSMTPCodes="1 250"
+
+
+# Some web servers on some Operating systems (IIS-Windows) consider that a
+# login with same value but different case are the same login. To tell AWStats
+# to also consider them as one, set this parameter to 1.
+# Change : Effective for new updates only
+# Possible values: 0 or 1
+# Default: 0
+#
+AuthenticatedUsersNotCaseSensitive=0
+
+
+# Some web servers on some Operating systems (IIS-Windows) considers that two
+# URLs with same value but different case are the same URL. To tell AWStats to
+# also considers them as one, set this parameter to 1.
+# Change : Effective for new updates only
+# Possible values: 0 or 1
+# Default: 0
+#
+URLNotCaseSensitive=0
+
+
+# Keep or remove the anchor string you can find in some URLs.
+# Change : Effective for new updates only
+# Possible values: 0 or 1
+# Default: 0
+#
+URLWithAnchor=0
+
+
+# In URL links, "?" char is used to add parameter's list in URLs. Syntax is:
+# /mypage.html?param1=value1¶m2=value2
+# However, some servers/sites use also other chars to isolate dynamic part of
+# their URLs. You can complete this list with all such characters.
+# Change : Effective for new updates only
+# Example: "?;,"
+# Default: "?;"
+#
+URLQuerySeparators="?;"
+
+
+# Keep or remove the query string to the URL in the statistics for individual
+# pages. This is primarily used to differentiate between the URLs of dynamic
+# pages. If set to 1, mypage.html?id=x and mypage.html?id=y are counted as two
+# different pages.
+# Warning, when set to 1, memory required to run AWStats is dramatically
+# increased if you have a lot of changing URLs (for example URLs with a random
+# id inside). Such web sites should not set this option to 1 or use seriously
+# the next parameter URLWithQueryWithOnlyFollowingParameters (or eventually
+# URLWithQueryWithoutFollowingParameters).
+# Change : Effective for new updates only
+# Possible values:
+# 0 - URLs are cleaned from the query string (ie: "/mypage.html")
+# 1 - Full URL with query string is used (ie: "/mypage.html?p=x&q=y")
+# Default: 0
+#
+URLWithQuery=0
+
+
+# When URLWithQuery is on, you will get the full URL with all parameters in
+# URL reports. But among thoose parameters, sometimes you don't need a
+# particular parameter because it does not identify the page or because it's
+# a random ID changing for each access even if URL points to same page. In
+# such cases, it is higly recommanded to ask AWStats to keep only parameters
+# you need (if you know them) before counting, manipulating and storing URL.
+# Enter here list of wanted parameters. For example, with "param", one hit on
+# /mypage.cgi?param=abc&id=Yo4UomP9d and /mypage.cgi?param=abc&id=Mu8fdxl3r
+# will be reported as 2 hits on /mypage.cgi?param=abc
+# This parameter is not used when URLWithQuery is 0 and can't be used with
+# URLWithQueryWithoutFollowingParameters.
+# Change : Effective for new updates only
+# Example: "param"
+# Default: ""
+#
+URLWithQueryWithOnlyFollowingParameters=""
+
+
+# When URLWithQuery is on, you will get the full URL with all parameters in
+# URL reports. But among thoose parameters, sometimes you don't need a
+# particular parameter because it does not identify the page or because it's
+# a random ID changing for each access even if URL points to same page. In
+# such cases, it is higly recommanded to ask AWStats to remove such parameters
+# from the URL before counting, manipulating and storing URL. Enter here list
+# of all non wanted parameters. For example if you enter "id", one hit on
+# /mypage.cgi?param=abc&id=Yo4UomP9d and /mypage.cgi?param=abc&id=Mu8fdxl3r
+# will be reported as 2 hits on /mypage.cgi?param=abc
+# This parameter is not used when URLWithQuery is 0 and can't be used with
+# URLWithQueryWithOnlyFollowingParameters.
+# Change : Effective for new updates only
+# Example: "PHPSESSID jsessionid"
+# Default: ""
+#
+URLWithQueryWithoutFollowingParameters=""
+
+
+# Keep or remove the query string to the referrer URL in the statistics for
+# external referrer pages. This is used to differentiate between the URLs of
+# dynamic referrer pages. If set to 1, mypage.html?id=x and mypage.html?id=y
+# are counted as two different referrer pages.
+# Change : Effective for new updates only
+# Possible values:
+# 0 - Referrer URLs are cleaned from the query string (ie: "/mypage.html")
+# 1 - Full URL with query string is used (ie: "/mypage.html?p=x&q=y")
+# Default: 0
+#
+URLReferrerWithQuery=0
+
+
+# AWStats can detect setup problems or show you important informations to have
+# a better use. Keep this to 1, except if AWStats says you can change it.
+# Change : Effective immediatly
+# Possible values: 0 or 1
+# Default: 1
+#
+WarningMessages=1
+
+
+# When an error occurs, AWStats outputs a message related to errors. If you
+# want (in most cases for security reasons) to have no error messages, you
+# can set this parameter to your personalized generic message.
+# Change : Effective immediatly
+# Example: "An error occurred. Contact your Administrator"
+# Default: ""
+#
+ErrorMessages=""
+
+
+# AWStat can be run with debug=x parameter to output various informations
+# to help in debugging or solving troubles. If you want to allow this (not
+# enabled by default for security reasons), set this parameter to 0.
+# Change : Effective immediatly
+# Possible values: 0 or 1
+# Default: 0
+#
+DebugMessages=0
+
+
+# To help you to detect if your log format is good, AWStats reports an error
+# if all the first NbOfLinesForCorruptedLog lines have a format that does not
+# match the LogFormat parameter.
+# However, some worm virus attack on your web server can result in a very high
+# number of corrupted lines in your log. So if you experience awstats stop
+# because of bad virus records at the beginning of your log file, you can
+# increase this parameter (very rare).
+# Change : Effective for new updates only
+# Default: 50
+#
+NbOfLinesForCorruptedLog=50
+
+
+# For some particular integration needs, you may want to have CGI links to
+# point to another script than awstats.pl.
+# Use the name of this script in WrapperScript parameter.
+# Change : Effective immediatly
+# Example: "awstatslauncher.pl"
+# Default: ""
+#
+WrapperScript=""
+
+
+# DecodeUA must be set to 1 if you use Roxen web server. This server converts
+# all spaces in user agent field into %20. This make the AWStats robots, OS
+# and browsers detection fail in some cases. Just change it to 1 if and only
+# if your web server is Roxen.
+# Change : Effective for new updates only
+# Possible values: 0 or 1
+# Default: 0
+#
+DecodeUA=0
+
+
+# MiscTrackerUrl can be used to make AWStats able to detect some miscellaneous
+# things, that can not be tracked on other way, like:
+# - Javascript disabled
+# - Java enabled
+# - Screen size
+# - Color depth
+# - Macromedia Director plugin
+# - Macromedia Shockwave plugin
+# - Realplayer G2 plugin
+# - QuickTime plugin
+# - Mediaplayer plugin
+# - Acrobat PDF plugin
+# To enable all these features, you must copy the awstats_misc_tracker.js file
+# into a /js/ directory stored in your web document root and add the following
+# HTML code at the end of your index page (but before </BODY>) :
+#
+# <script language=javascript src="/js/awstats_misc_tracker.js"></script>
+# <noscript><img src="/js/awstats_misc_tracker.js?nojs=y" height=0 width=0 border=0 style="display: none"></noscript>
+#
+# If code is not added in index page, all those detection capabilities will be
+# disabled. You must also check that ShowScreenSizeStats and ShowMiscStats
+# parameters are set to 1 to make results appear in AWStats report page.
+# If you want to use another directory than /js/, you must also change the
+# awstatsmisctrackerurl variable into the awstats_misc_tracker.js file.
+# Change : Effective for new updates only.
+# Possible value: URL of javascript tracker file added in your HTML code.
+# Default: "/js/awstats_misc_tracker.js"
+#
+MiscTrackerUrl="/js/awstats_misc_tracker.js"
+
+
+
+#-----------------------------------------------------------------------------
+# OPTIONAL ACCURACY SETUP SECTION (Not required but increase AWStats features)
+#-----------------------------------------------------------------------------
+
+# The following values allow you to define accuracy of AWStats entities
+# (robots, browsers, os, referers, file types) detection.
+# It might be a good idea for large web sites or ISP that provides AWStats to
+# high number of customers, to set this parameter to 1 (or 0), instead of 2.
+# Possible values:
+# 0 = No detection,
+# 1 = Medium/Standard detection
+# 2 = Full detection
+# Change : Effective for new updates only
+# Note : LevelForBrowsersDetection can also accept value "allphones". This
+# enable detailed detection of phone/pda browsers.
+# Default: 2 (0 for LevelForWormsDetection)
+#
+LevelForBrowsersDetection=2 # 0 disables Browsers detection.
+ # 2 reduces AWStats speed by 2%
+ # allphones reduces AWStats speed by 5%
+LevelForOSDetection=2 # 0 disables OS detection.
+ # 2 reduces AWStats speed by 3%
+LevelForRefererAnalyze=2 # 0 disables Origin detection.
+ # 2 reduces AWStats speed by 14%
+LevelForRobotsDetection=2 # 0 disables Robots detection.
+ # 2 reduces AWStats speed by 2.5%
+LevelForSearchEnginesDetection=2 # 0 disables Search engines detection.
+ # 2 reduces AWStats speed by 9%
+LevelForKeywordsDetection=2 # 0 disables Keyphrases/Keywords detection.
+ # 2 reduces AWStats speed by 1%
+LevelForFileTypesDetection=2 # 0 disables File types detection.
+ # 2 reduces AWStats speed by 1%
+LevelForWormsDetection=0 # 0 disables Worms detection.
+ # 2 reduces AWStats speed by 15%
+
+
+
+#-----------------------------------------------------------------------------
+# OPTIONAL APPEARANCE SETUP SECTION (Not required but increase AWStats features)
+#-----------------------------------------------------------------------------
+
+# When you use AWStats as a CGI, you can have the reports shown in HTML frames.
+# Frames are only available for report viewed dynamically. When you build
+# pages from command line, this option is not used and no frames are built.
+# Possible values: 0 or 1
+# Default: 1
+#
+UseFramesWhenCGI=1
+
+
+# This parameter asks your browser to open detailed reports into a different
+# window than the main page.
+# Possible values:
+# 0 - Open all in same browser window
+# 1 - Open detailed reports in another window except if using frames
+# 2 - Open always in a different window even if reports are framed
+# Default: 1
+#
+DetailedReportsOnNewWindows=1
+
+
+# You can add, in the HTML report page, a cache lifetime (in seconds) that
+# will be returned to the browser in HTTP header answer by server.
+# This parameter is not used when reports are built with -staticlinks option.
+# Example: 3600
+# Default: 0
+#
+Expires=0
+
+
+# To avoid too large web pages, you can ask AWStats to limit number of rows of
+# all reported charts to this number when no other limits apply.
+# Default: 1000
+#
+MaxRowsInHTMLOutput=1000
+
+
+# Set your primary language (ISO-639-1 language codes).
+# Possible values:
+# Albanian=al, Bosnian=ba, Bulgarian=bg, Catalan=ca,
+# Chinese (Taiwan)=tw, Chinese (Simpliefied)=cn, Croatian=hr, Czech=cz,
+# Danish=dk, Dutch=nl, English=en, Estonian=et, Euskara=eu, Finnish=fi,
+# French=fr, Galician=gl, German=de, Greek=gr, Hebrew=he, Hungarian=hu,
+# Icelandic=is, Indonesian=id, Italian=it, Japanese=jp, Korean=ko,
+# Latvian=lv, Norwegian (Nynorsk)=nn, Norwegian (Bokmal)=nb, Polish=pl,
+# Portuguese=pt, Portuguese (Brazilian)=br, Romanian=ro, Russian=ru,
+# Serbian=sr, Slovak=sk, Slovenian=si, Spanish=es, Swedish=se, Turkish=tr,
+# Ukrainian=ua, Welsh=cy.
+# First available language accepted by browser=auto
+# Default: "auto"
+#
+Lang="auto"
+
+
+# Set the location of language files.
+# Example: "/usr/share/awstats/lang"
+# Default: "./lang" (means lang directory is in same location than awstats.pl)
+#
+DirLang="/usr/share/awstats/lang"
+
+
+# Show menu header with reports' links
+# Possible values: 0 or 1
+# Default: 1
+#
+ShowMenu=1
+
+
+# You choose here which reports you want to see in the main page and what you
+# want to see in those reports.
+# Possible values:
+# 0 - Report is not shown at all
+# 1 - Report is shown in main page with an entry in menu and default columns
+# XYZ - Report shows column informations defined by code X,Y,Z...
+# X,Y,Z... are code letters among the following:
+# U = Unique visitors
+# V = Visits
+# P = Number of pages
+# H = Number of hits (or mails)
+# B = Bandwith (or total mail size for mail logs)
+# L = Last access date
+# E = Entry pages
+# X = Exit pages
+# C = Web compression (mod_gzip,mod_deflate)
+# M = Average mail size (mail logs)
+#
+
+# Show monthly summary
+# Context: Web, Streaming, Mail, Ftp
+# Default: UVPHB, Possible column codes: UVPHB
+ShowSummary=UVPHB
+
+# Show monthly chart
+# Context: Web, Streaming, Mail, Ftp
+# Default: UVPHB, Possible column codes: UVPHB
+ShowMonthStats=UVPHB
+
+# Show days of month chart
+# Context: Web, Streaming, Mail, Ftp
+# Default: VPHB, Possible column codes: VPHB
+ShowDaysOfMonthStats=VPHB
+
+# Show days of week chart
+# Context: Web, Streaming, Mail, Ftp
+# Default: PHB, Possible column codes: PHB
+ShowDaysOfWeekStats=PHB
+
+# Show hourly chart
+# Context: Web, Streaming, Mail, Ftp
+# Default: PHB, Possible column codes: PHB
+ShowHoursStats=PHB
+
+# Show domains/country chart
+# Context: Web, Streaming, Mail, Ftp
+# Default: PHB, Possible column codes: PHB
+ShowDomainsStats=PHB
+
+# Show hosts chart
+# Context: Web, Streaming, Mail, Ftp
+# Default: PHBL, Possible column codes: PHBL
+ShowHostsStats=PHBL
+
+# Show authenticated users chart
+# Context: Web, Streaming, Ftp
+# Default: 0, Possible column codes: PHBL
+ShowAuthenticatedUsers=0
+
+# Show robots chart
+# Context: Web, Streaming
+# Default: HBL, Possible column codes: HBL
+ShowRobotsStats=HBL
+
+# Show worms chart
+# Context: Web, Streaming
+# Default: 0 (If set to other than 0, see also LevelForWormsDetection), Possible column codes: HBL
+ShowWormsStats=0
+
+# Show email senders chart (For use when analyzing mail log files)
+# Context: Mail
+# Default: 0, Possible column codes: HBML
+ShowEMailSenders=0
+
+# Show email receivers chart (For use when analyzing mail log files)
+# Context: Mail
+# Default: 0, Possible column codes: HBML
+ShowEMailReceivers=0
+
+# Show session chart
+# Context: Web, Streaming, Ftp
+# Default: 1, Possible column codes: None
+ShowSessionsStats=1
+
+# Show pages-url chart.
+# Context: Web, Streaming, Ftp
+# Default: PBEX, Possible column codes: PBEX
+ShowPagesStats=PBEX
+
+# Show file types chart.
+# Context: Web, Streaming, Ftp
+# Default: HB, Possible column codes: HBC
+ShowFileTypesStats=HB
+
+# Show file size chart (Not yet available)
+# Context: Web, Streaming, Mail, Ftp
+# Default: 1, Possible column codes: None
+ShowFileSizesStats=0
+
+# Show operating systems chart
+# Context: Web, Streaming, Ftp
+# Default: 1, Possible column codes: None
+ShowOSStats=1
+
+# Show browsers chart
+# Context: Web, Streaming
+# Default: 1, Possible column codes: None
+ShowBrowsersStats=1
+
+# Show screen size chart
+# Context: Web, Streaming
+# Default: 0 (If set to 1, see also MiscTrackerUrl), Possible column codes: None
+ShowScreenSizeStats=0
+
+# Show origin chart
+# Context: Web, Streaming
+# Default: PH, Possible column codes: PH
+ShowOriginStats=PH
+
+# Show keyphrases chart
+# Context: Web, Streaming
+# Default: 1, Possible column codes: None
+ShowKeyphrasesStats=1
+
+# Show keywords chart
+# Context: Web, Streaming
+# Default: 1, Possible column codes: None
+ShowKeywordsStats=1
+
+# Show misc chart
+# Context: Web, Streaming
+# Default: a (See also MiscTrackerUrl parameter), Possible column codes: anjdfrqwp
+ShowMiscStats=a
+
+# Show http errors chart
+# Context: Web, Streaming
+# Default: 1, Possible column codes: None
+ShowHTTPErrorsStats=1
+
+# Show smtp errors chart (For use when analyzing mail log files)
+# Context: Mail
+# Default: 0, Possible column codes: None
+ShowSMTPErrorsStats=0
+
+# Show the cluster report (Your LogFormat must contains the %cluster tag)
+# Context: Web, Streaming, Ftp
+# Default: 0, Possible column codes: PHB
+ShowClusterStats=0
+
+
+# Some graphical reports are followed by the data array of values.
+# If you don't want this array (to reduce the report size for example), you
+# can set thoose options to 0.
+# Possible values: 0 or 1
+# Default: 1
+#
+# Data array values for the ShowMonthStats report
+AddDataArrayMonthStats=1
+# Data array values for the ShowDaysOfMonthStats report
+AddDataArrayShowDaysOfMonthStats=1
+# Data array values for the ShowDaysOfWeekStats report
+AddDataArrayShowDaysOfWeekStats=1
+# Data array values for the ShowHoursStats report
+AddDataArrayShowHoursStats=1
+
+
+# In the Origin chart, you have stats on where your hits came from. You can
+# include hits on pages that come from pages of same sites in this chart.
+# Possible values: 0 or 1
+# Default: 0
+#
+IncludeInternalLinksInOriginSection=0
+
+
+# The following parameters can be used to choose the maximum number of lines
+# shown for the particular following reports.
+#
+# Stats by countries/domains
+MaxNbOfDomain = 10
+MinHitDomain = 1
+# Stats by hosts
+MaxNbOfHostsShown = 10
+MinHitHost = 1
+# Stats by authenticated users
+MaxNbOfLoginShown = 10
+MinHitLogin = 1
+# Stats by robots
+MaxNbOfRobotShown = 10
+MinHitRobot = 1
+# Stats by pages
+MaxNbOfPageShown = 10
+MinHitFile = 1
+# Stats by OS
+MaxNbOfOsShown = 10
+MinHitOs = 1
+# Stats by browsers
+MaxNbOfBrowsersShown = 10
+MinHitBrowser = 1
+# Stats by screen size
+MaxNbOfScreenSizesShown = 5
+MinHitScreenSize = 1
+# Stats by window size (following 2 parameters are not yet used)
+MaxNbOfWindowSizesShown = 5
+MinHitWindowSize = 1
+# Stats by referers
+MaxNbOfRefererShown = 10
+MinHitRefer = 1
+# Stats for keyphrases
+MaxNbOfKeyphrasesShown = 10
+MinHitKeyphrase = 1
+# Stats for keywords
+MaxNbOfKeywordsShown = 10
+MinHitKeyword = 1
+# Stats for sender or receiver emails
+MaxNbOfEMailsShown = 20
+MinHitEMail = 1
+
+
+# Choose if you want the week report to start on sunday or monday
+# Possible values:
+# 0 - Week starts on sunday
+# 1 - Week starts on monday
+# Default: 1
+#
+FirstDayOfWeek=1
+
+
+# List of visible flags that link to other language translations.
+# See Lang parameter for list of allowed flag/language codes.
+# If you don't want any flag link, set ShowFlagLinks to "".
+# This parameter is used only if ShowMenu parameter is set to 1.
+# Possible values: "" or "language_codes_separated_by_space"
+# Example: "en es fr nl de"
+# Default: ""
+#
+ShowFlagLinks=""
+
+
+# Each URL, shown in stats report views, are links you can click.
+# Possible values: 0 or 1
+# Default: 1
+#
+ShowLinksOnUrl=1
+
+
+# When AWStats builds HTML links in its report pages, it starts those links
+# with "http://". However some links might be HTTPS links, so you can enter
+# here the root of all your HTTPS links. If all your site is a SSL web site,
+# just enter "/".
+# This parameter is not used if ShowLinksOnUrl is 0.
+# Example: "/shopping"
+# Example: "/"
+# Default: ""
+#
+UseHTTPSLinkForUrl=""
+
+
+# Maximum length of URL part shown on stats page (number of characters).
+# This affects only URL visible text, links still work.
+# Default: 64
+#
+MaxLengthOfShownURL=64
+
+
+# You can enter HTML code that will be added at the top of AWStats reports.
+# Default: ""
+#
+HTMLHeadSection=""
+
+
+# You can enter HTML code that will be added at the end of AWStats reports.
+# Great to add advert ban.
+# Default: ""
+#
+HTMLEndSection=""
+
+
+# You can set Logo and LogoLink to use your own logo.
+# Logo must be the name of image file (must be in $DirIcons/other directory).
+# LogoLink is the expected URL when clicking on Logo.
+# Default: "awstats_logo6.png"
+#
+Logo="awstats_logo6.png"
+LogoLink="http://awstats.sourceforge.net"
+
+
+# Value of maximum bar width/height for horizontal/vertical HTML graphics bars.
+# Default: 260/90
+#
+BarWidth = 260
+BarHeight = 90
+
+
+# You can ask AWStats to use a particular CSS (Cascading Style Sheet) to
+# change its look. To create a style sheet, you can use samples provided with
+# AWStats in wwwroot/css directory.
+# Example: "/awstatscss/awstats_bw.css"
+# Example: "/css/awstats_bw.css"
+# Default: ""
+#
+StyleSheet=""
+
+
+# Those color parameters can be used (if StyleSheet parameter is not used)
+# to change AWStats look.
+# Example: color_name="RRGGBB" # RRGGBB is Red Green Blue components in Hex
+#
+color_Background="FFFFFF" # Background color for main page (Default = "FFFFFF")
+color_TableBGTitle="CCCCDD" # Background color for table title (Default = "CCCCDD")
+color_TableTitle="000000" # Table title font color (Default = "000000")
+color_TableBG="CCCCDD" # Background color for table (Default = "CCCCDD")
+color_TableRowTitle="FFFFFF" # Table row title font color (Default = "FFFFFF")
+color_TableBGRowTitle="ECECEC" # Background color for row title (Default = "ECECEC")
+color_TableBorder="ECECEC" # Table border color (Default = "ECECEC")
+color_text="000000" # Color of text (Default = "000000")
+color_textpercent="606060" # Color of text for percent values (Default = "606060")
+color_titletext="000000" # Color of text title within colored Title Rows (Default = "000000")
+color_weekend="EAEAEA" # Color for week-end days (Default = "EAEAEA")
+color_link="0011BB" # Color of HTML links (Default = "0011BB")
+color_hover="605040" # Color of HTML on-mouseover links (Default = "605040")
+color_u="FFAA66" # Background color for number of unique visitors (Default = "FFAA66")
+color_v="F4F090" # Background color for number of visites (Default = "F4F090")
+color_p="4477DD" # Background color for number of pages (Default = "4477DD")
+color_h="66DDEE" # Background color for number of hits (Default = "66DDEE")
+color_k="2EA495" # Background color for number of bytes (Default = "2EA495")
+color_s="8888DD" # Background color for number of search (Default = "8888DD")
+color_e="CEC2E8" # Background color for number of entry pages (Default = "CEC2E8")
+color_x="C1B2E2" # Background color for number of exit pages (Default = "C1B2E2")
+
+
+
+#-----------------------------------------------------------------------------
+# PLUGINS
+#-----------------------------------------------------------------------------
+
+# Add here all plugin files you want to load.
+# Plugin files must be .pm files stored in 'plugins' directory.
+# Uncomment LoadPlugin lines to enable a plugin after checking that perl
+# modules required by the plugin are installed.
+
+# Plugin: Tooltips
+# Perl modules required: None
+# Add some tooltips help on HTML report pages.
+# Note that enabling this kind of help will increased HTML report pages size,
+# so server load and bandwidth.
+#
+#LoadPlugin="tooltips"
+
+# Plugin: DecodeUTFKeys
+# Perl modules required: Encode and URI::Escape
+# Allow AWStats to show correctly (in language charset) keywords/keyphrases
+# strings even if they were UTF8 coded by the referer search engine.
+#
+#LoadPlugin="decodeutfkeys"
+
+# Plugin: IPv6
+# Perl modules required: Net::IP and Net::DNS
+# This plugin gives AWStats capability to make reverse DNS lookup on IPv6
+# addresses.
+# Note: If you are interested in having country report, you should use the
+# geoipfree or geoip plugin instead of enabled reverse DNS lookup.
+#
+#LoadPlugin="ipv6"
+
+# Plugin: HashFiles
+# Perl modules required: Storable
+# AWStats DNS cache files are read/saved as native hash files. This increases
+# DNS cache files loading speed, above all for very large web sites.
+#
+LoadPlugin="hashfiles"
+
+# Plugin: GeoIP
+# Perl modules required: Geo::IP or Geo::IP::PurePerl (from Maxmind)
+# Country chart is built from an Internet IP-Country database.
+# This plugin is useless for intranet only log files.
+# Note: You must choose between using this plugin (need Perl Geo::IP module
+# from Maxmind, database more up to date) or the GeoIPfree plugin (need
+# Perl Geo::IPfree module, database less up to date).
+# This plugin reduces AWStats speed of 8% !
+#
+#LoadPlugin="geoip GEOIP_STANDARD /pathto/GeoIP.dat"
+
+# Plugin: GeoIPfree
+# Perl modules required: Geo::IPfree version 0.2+ (from Graciliano M.P.)
+# Country chart is built from an Internet IP-Country database.
+# This plugin is useless for intranet only log files.
+# Note: You must choose between using this plugin (need Perl Geo::IPfree
+# module, database less up to date) or the GeoIP plugin (need Perl Geo::IP
+# module from Maxmind, database more up to date).
+# Note: Activestate provide a corrupted version of Geo::IPfree 0.2 Perl
+# module, so install it from elsewhere (from www.cpan.org for example).
+# This plugin reduces AWStats speed of 10% !
+#
+#LoadPlugin="geoipfree"
+
+# Plugin: GeoIP_Region_Maxmind
+# Perl modules required: Geo::IP (from Maxmind)
+# This plugin add a chart of hits by regions. Only regions for US and
+# Canada can be detected.
+# Note: This plugin need Maxmind GeoIP Perl module AND the region database.
+# Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
+# on Windows but it works great on Linux with default Perl.
+# You need to purchase a license from Maxmind to get/use the Region database.
+# This plugin reduces AWStats speed.
+#
+#LoadPlugin="geoip_region_maxmind GEOIP_STANDARD /pathto/GeoIPRegion.dat"
+
+# Plugin: GeoIP_City_Maxmind
+# Perl modules required: Geo::IP (from Maxmind)
+# This plugin add a chart of hits by cities (with country and regions
+# informations for major countries).
+# Note: This plugin need Maxmind GeoIP Perl module AND the city database.
+# Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
+# on Windows but it works great on Linux with default Perl.
+# You need to purchase a license from Maxmind to get/use the City database.
+# This plugin reduces AWStats speed.
+#
+#LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /pathto/GeoIPCity.dat"
+
+# Plugin: GeoIP_ISP_Maxmind
+# Perl modules required: Geo::IP (from Maxmind)
+# This plugin add a chart of hits by ISP.
+# Note: This plugin need Maxmind GeoIP Perl module AND the ISP database.
+# Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
+# on Windows but it works great on Linux with default Perl.
+# You need to purchase a license from Maxmind to get/use the ISP database.
+# This plugin reduces AWStats speed.
+#
+#LoadPlugin="geoip_isp_maxmind GEOIP_STANDARD /pathto/GeoIPISP.dat"
+
+# Plugin: GeoIP_Org_Maxmind
+# Perl modules required: Geo::IP (from Maxmind)
+# This plugin add a chart of hits by Organization name
+# Note: This plugin need Maxmind GeoIP Perl module AND the Org database.
+# Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
+# on Windows but it works great on Linux with default Perl.
+# You need to purchase a license from Maxmind to get/use the Org database.
+# This plugin reduces AWStats speed.
+#
+#LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /pathto/GeoIPOrg.dat"
+
+# Plugin: UserInfo
+# Perl modules required: None
+# Add a text (Firtname, Lastname, Office Department, ...) in authenticated user
+# reports for each login value.
+# A text file called userinfo.myconfig.txt, with two fields (first is login,
+# second is text to show, separated by a tab char) must be created in DirData
+# directory.
+#
+#LoadPlugin="userinfo"
+
+# Plugin: HostInfo
+# Perl modules required: Net::XWhois
+# Add a column into host chart with a link to open a popup window that shows
+# info on host (like whois records).
+#
+#LoadPlugin="hostinfo"
+
+# Plugin: ClusterInfo
+# Perl modules required: None
+# Add a text (for example a full hostname) in cluster reports for each cluster
+# number.
+# A text file called clusterinfo.myconfig.txt, with two fields (first is
+# cluster number, second is text to show) separated by a tab char. must be
+# created into DirData directory.
+# Note this plugin is useless if ShowClusterStats is set to 0 or if you don't
+# use a personalized log format that contains %cluster tag.
+#
+#LoadPlugin="clusterinfo"
+
+# Plugin: UrlAliases
+# Perl modules required: None
+# Add a text (Page title, description...) in URL reports before URL value.
+# A text file called urlalias.myconfig.txt, with two fields (first is URL,
+# second is text to show, separated by a tab char) must be created into
+# DirData directory.
+#
+#LoadPlugin="urlalias"
+
+# Plugin: TimeHiRes
+# Perl modules required: Time::HiRes (if Perl < 5.8)
+# Time reported by -showsteps option is in millisecond. For debug purpose.
+#
+#LoadPlugin="timehires"
+
+# Plugin: TimeZone
+# Perl modules required: Time::Local
+# Allow AWStats to correct a bad timezone for user of some IIS that use
+# GMT date in its log instead of local server time.
+# This module is useless for Apache and most IIS version.
+# This plugin reduces AWStats speed of 40% !!!!!!!
+#
+#LoadPlugin="timezone +2"
+
+# Plugin: Rawlog
+# Perl modules required: None
+# This plugin adds a form in AWStats main page to allow users to see raw
+# content of current log files. A filter is also available.
+#
+#LoadPlugin="rawlog"
+
+# Plugin: GraphApplet
+# Perl modules required: None
+# Supported charts are built by a 3D graphic applet.
+#
+#LoadPlugin="graphapplet /awstatsclasses" # EXPERIMENTAL FEATURE
+
+
+
+#-----------------------------------------------------------------------------
+# EXTRA SECTIONS
+#-----------------------------------------------------------------------------
+
+# You can define your own charts, you choose here what are rows and columns
+# keys. This feature is particularly useful for marketing purpose, tracking
+# products orders for example.
+# For this, edit all parameters of Extra section. Each set of parameter is a
+# different chart. For several charts, duplicate section changing the number.
+# Note: Each Extra section reduces AWStats speed by 8%.
+#
+# WARNING: A wrong setup of Extra section might result in too large arrays
+# that will consume all your memory, making AWStats unusable after several
+# updates, so be sure to setup it correctly.
+# In most cases, you don't need this feature.
+#
+# ExtraSectionNameX is title of your personalized chart.
+# ExtraSectionCodeFilterX is list of codes the record code field must match.
+# Put an empty string for no test on code.
+# ExtraSectionConditionX are conditions you can use to count or not the hit,
+# Use one of the field condition
+# (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOST,extraX)
+# and a regex to match, after a coma. Use "||" for "OR".
+# ExtraSectionFirstColumnTitleX is the first column title of the chart.
+# ExtraSectionFirstColumnValuesX is a string to tell AWStats which field to
+# extract value from
+# (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOST,VHOST,extraX)
+# and how to extract the value (using regex syntax). Each different value
+# found will appear in first column of report on a different row. Be sure
+# that list of different possible values will not grow indefinitely.
+# ExtraSectionFirstColumnFormatX is the string used to write value.
+# ExtraSectionStatTypesX are things you want to count. You can use standard
+# code letters (P for pages,H for hits,B for bandwidth,L for last access).
+# ExtraSectionAddAverageRowX add a row at bottom of chart with average values.
+# ExtraSectionAddSumRowX add a row at bottom of chart with sum values.
+# MaxNbOfExtraX is maximum number of rows shown in chart.
+# MinHitExtraX is minimum number of hits required to be shown in chart.
+#
+
+# Example to report the 20 products the most ordered by "order.cgi" script
+#ExtraSectionName1="Product orders"
+#ExtraSectionCodeFilter1="200 304"
+#ExtraSectionCondition1="URL,\/cgi\-bin\/order\.cgi||URL,\/cgi\-bin\/order2\.cgi"
+#ExtraSectionFirstColumnTitle1="Product ID"
+#ExtraSectionFirstColumnValues1="QUERY_STRING,productid=([^&]+)"
+#ExtraSectionFirstColumnFormat1="%s"
+#ExtraSectionStatTypes1=PL
+#ExtraSectionAddAverageRow1=0
+#ExtraSectionAddSumRow1=1
+#MaxNbOfExtra1=20
+#MinHitExtra1=1
+
+
+# There is also a global parameter ExtraTrackedRowsLimit that limits the
+# number of possible rows an ExtraSection can report. This parameter is
+# here to protect too much memory use when you make a bad setup in your
+# ExtraSection. It applies to all ExtraSection independently meaning that
+# none ExtraSection can report more rows than value defined by ExtraTrackedRowsLimit.
+# If you know an ExtraSection will report more rows than its value, you should
+# increase this parameter or AWStats will stop with an error.
+# Example: 2000
+# Default: 500
+#
+ExtraTrackedRowsLimit=500
+
+
+#-----------------------------------------------------------------------------
+# INCLUDES
+#-----------------------------------------------------------------------------
+
+# You can include other config files using the directive with the name of the
+# config file.
+# This is particularly useful for users who have a lot of virtual servers, so
+# a lot of config files and want to maintain common values in only one file.
+# Note that when a variable is defined both in a config file and in an
+# included file, AWStats will use the last value read for parameters that
+# contains one value and AWStats will concat all values from both files for
+# parameters that are lists of values.
+#
+
+Include "/etc/awstats/awstats.conf.local"
+
--- /dev/null
+#!/bin/sh
+
+u=$1
+sudo deluser $u
+sudo rm -rf /home/$u
+
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os, time, sys
+
+root_orig = sys.argv[1]
+#root_dest = sys.argv[2]
+date_filter = '08'
+
+date_file_list = []
+for root, dirs, files in os.walk(root_orig):
+ for file in files:
+ #print file
+ stats = os.stat(root+os.sep+file)
+ lastmod_date = time.localtime(stats[8])
+ date_file_tuple = lastmod_date, root+os.sep+file, stats[6]
+ date_file_list.append(date_file_tuple)
+
+date_file_list.sort()
+date_file_list.reverse() # newest mod date now first
+
+total_size = 0
+print "%-50s %s" % ("filename:", "last modified:")
+for file in date_file_list:
+ if os.path.isfile(file[1]):
+ file_date = time.strftime("%y/%m/%d %H:%M:%S", file[0])
+ year = time.strftime("%y", file[0])
+ #dest_file = root_dest+os.sep+file[1]
+ if year <= date_filter and file[1].split('.')[-1] == 'mp3' and 'CRFPA' in file[1] :
+ #os.path.exists(dest_file) :
+ print "%-50s %s" % (file[1], file_date)
+ total_size += file[2]
+
+ #os.system('sudo rm "' + file[1] + '"')
+ #os.system('sudo touch "' + file[1] + '"')
+ #os.system('sudo chown zope:zope "' + file[1] + '"')
+ #os.system('sudo chmod 600 "' + file[1] + '"')
+
+ #os.symlink(dest_file, file[1])
+ #print "File linked !"
+
+print total_size
\ No newline at end of file
--- /dev/null
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import os, sys, stat, time
+
+if len(sys.argv) <= 2:
+ exit('Usage : python rm_date.py MONTH YEAR PATH')
+
+
+dir = sys.argv[-1]
+year = int(sys.argv[-2])
+month = int(sys.argv[-3])
+
+date_file_list = []
+for root, dirs, files in os.walk(dir):
+ for file in files:
+ #print file
+ stats = os.stat(root+os.sep+file)
+ lastmod_date = time.strftime("%d_%m_%Y",time.localtime(stats[stat.ST_MTIME]))
+ date_file_tuple = lastmod_date, root+os.sep+file
+ date_file_list.append(date_file_tuple)
+
+date_file_list.sort()
+date_file_list.reverse() # newest mod date now first
+
+for file in date_file_list:
+ if os.path.isfile(file[1]):
+ date = file[0].split('_')
+ m = int(date[1])
+ y = int(date[2])
+ if y <= year and m <= month:
+ os.remove(file[1])
+ print 'removed : ', y, m, file
+
+
\ No newline at end of file
--- /dev/null
+#
+# DAV testing hack
+#
+
+import os
+import sys
+import davlib
+import string
+import gdbm
+import StringIO
+import base64
+from xml.utils import qp_xml
+
+#HOST = 'parisson.com'
+HOST = 'localhost'
+PORT = '1983'
+BASE = 'http://%s:%s' % (HOST, PORT)
+USERNAME = 'admin'
+DESTDIR = 'CRFPA/formations/formations-en-ligne/cours-audio/droit_penal_cours/'
+#DESTDIR = 'parisson.com_2/Members/yomguy/dav'
+#DESTDIR = 'dav'
+SOURCEDIR = '/home/momo/music/mp3'
+FILE = 'lll-0001.mp3'
+#FILE = '04_Idjut_Boys_-_Rebirth_Evil_Vibrations.mp3'
+PASSWORD = sys.argv[1]
+
+
+
+def getprop(dirname, fname, ns, propname):
+ g = gdbm.open(dirname + '/.DAV/' + fname, 'r')
+ return g[str(ns) + ':' + propname + '\0']
+
+def setprop(dirname, fname, ns, propname, value):
+ g = gdbm.open(dirname + '/.DAV/' + fname, 'c')
+ g[str(ns) + ':' + propname + '\0'] = value + '\0'
+
+def dump(dirname, fname):
+ g = gdbm.open(dirname + '/.DAV/' + fname, 'r')
+ for key in g.keys():
+ print `key`, '=', `g[key]`
+
+class mydav(davlib.DAV):
+ def _request(self, method, url, *rest, **kw):
+ print 'REQUEST:', method, url
+ response = apply(davlib.DAV._request, (self, method, url) + rest, kw)
+ print "STATUS:", response.status
+ print "REASON:", response.reason
+ for hdr in response.msg.headers:
+ print string.strip (hdr)
+ print '-'*70
+ if response.status == 207:
+ #print response.doc.dump()
+ #print response.doc.toxml()
+ response.parse_multistatus()
+ davlib.qp_xml.dump(sys.stdout, response.root)
+ elif method == 'LOCK' and response.status == 200:
+ response.parse_lock_response()
+ davlib.qp_xml.dump(sys.stdout, response.root)
+ else:
+ print response.read()
+ print '-'*70
+ return response
+ def get_lock(self, url, owner='', timeout=None, depth=None):
+ return self.lock(url, owner, timeout, depth).locktoken
+
+
+def _dav():
+ return mydav(HOST, PORT)
+
+def getvalue(url, ns, prop):
+ response = _dav().getprops(url, prop, ns=ns)
+ resp = response.msr.responses[0]
+ if resp.status and resp.status[0] != 200:
+ raise 'error retrieving property', response.status
+ propstat = resp.propstat[0]
+ if propstat.status and propstat.status[0] != 200:
+ raise 'error retrieving property', propstat.status
+ return propstat.prop[(ns, prop)]
+
+ #s = StringIO.StringIO()
+ #davlib.qp_xml.dump(s, propstat.prop[(ns, prop)])
+ #return s.getvalue()
+
+
+def del_test_data():
+ _dav().delete('/dav/testdata')
+
+def gettest():
+ _dav()._request('GET', '/dav/test.html')
+
+def if_test():
+ _dav().put('/dav/foo.html', 'foo.html contents\n')
+ etag = qp_xml.textof(getvalue('/dav/foo.html', 'DAV:', 'getetag'))
+ print 'ETAG:', etag
+ _dav()._request('DELETE', '/dav/foo.html', extra_hdrs={
+ 'If' : '(["abc"])',
+ })
+ _dav()._request('DELETE', '/dav/foo.html', extra_hdrs={
+ 'If' : '([' + etag + '])',
+ })
+
+def lock_test():
+ _dav().delete('/dav/locktest')
+ _dav().mkcol('/dav/locktest')
+ _dav().mkcol('/dav/locktest/sub')
+
+ # test a locknull resource
+ r = _dav().lock('/dav/locktest/locknull')
+
+def upload(base, dest_dir, source_dir, file, username, password, encodeduserpass):
+ _dav().setauth(username, password)
+ auth_dict = {"Authorization":"Basic %s" % encodeduserpass}
+ auth = auth_dict['Authorization']
+ print auth
+
+ f = open(source_dir + os.sep + file,'r')
+ #_dav().mkcol(BASE+'/'+DESTDIR,auth)
+ _dav().put(base+'/'+dest_dir+'/'+file,f.read(),None,None,auth_dict)
+
+
+
+if __name__ == '__main__':
+ if HOST == 'FILL THIS IN':
+ import sys
+ sys.stdout = sys.stderr
+ print 'ERROR: you must edit davtest.py to set the HOST/PORT values'
+ print ' at the top of the script.'
+ sys.exit(1)
+
+ encodedUSERPASS = base64.encodestring(USERNAME+":"+PASSWORD)
+ upload(BASE, DESTDIR, SOURCEDIR, FILE, USERNAME, PASSWORD, encodedUSERPASS)
--- /dev/null
+#
+# DAV testing hack
+#
+
+import os
+import sys
+import davlib
+import string
+import gdbm
+import StringIO
+import base64
+from xml.utils import qp_xml
+
+HOST = 'localhost'
+#HOST = 'crfpa.pre-barreau.com'
+PORT = '1983'
+BASE = 'http://%s:%s' % (HOST, PORT)
+USERNAME = 'zope'
+DESTDIR = 'CRFPA/formations/formations-en-ligne/cours-audio/'
+#DESTDIR = 'CRFPA/'
+TITLE = 'Pre-barreau_-_Augustins_-_CRFPA_-_'
+SOURCEDIR = '/home/augustins/audio/media/CRFPA/2008/'
+#PASSWORD = sys.argv[1]
+PASSWORD = 'wasncellar;z'
+COURSES = 'pre-barreau_courses_crfpa.txt'
+
+
+
+def getprop(dirname, fname, ns, propname):
+ g = gdbm.open(dirname + '/.DAV/' + fname, 'r')
+ return g[str(ns) + ':' + propname + '\0']
+
+def setprop(dirname, fname, ns, propname, value):
+ g = gdbm.open(dirname + '/.DAV/' + fname, 'c')
+ g[str(ns) + ':' + propname + '\0'] = value + '\0'
+
+def dump(dirname, fname):
+ g = gdbm.open(dirname + '/.DAV/' + fname, 'r')
+ for key in g.keys():
+ print `key`, '=', `g[key]`
+
+class mydav(davlib.DAV):
+ def _request(self, method, url, *rest, **kw):
+ print 'REQUEST:', method, url
+ response = apply(davlib.DAV._request, (self, method, url) + rest, kw)
+ print "STATUS:", response.status
+ print "REASON:", response.reason
+ for hdr in response.msg.headers:
+ print string.strip (hdr)
+ print '-'*70
+ if response.status == 207:
+ #print response.doc.dump()
+ #print response.doc.toxml()
+ response.parse_multistatus()
+ davlib.qp_xml.dump(sys.stdout, response.root)
+ elif method == 'LOCK' and response.status == 200:
+ response.parse_lock_response()
+ davlib.qp_xml.dump(sys.stdout, response.root)
+ else:
+ print response.read()
+ print '-'*70
+ return response
+ def get_lock(self, url, owner='', timeout=None, depth=None):
+ return self.lock(url, owner, timeout, depth).locktoken
+
+
+def _dav():
+ return mydav(HOST, PORT)
+
+def getvalue(url, ns, prop):
+ response = _dav().getprops(url, prop, ns=ns)
+ resp = response.msr.responses[0]
+ if resp.status and resp.status[0] != 200:
+ raise 'error retrieving property', response.status
+ propstat = resp.propstat[0]
+ if propstat.status and propstat.status[0] != 200:
+ raise 'error retrieving property', propstat.status
+ return propstat.prop[(ns, prop)]
+
+ #s = StringIO.StringIO()
+ #davlib.qp_xml.dump(s, propstat.prop[(ns, prop)])
+ #return s.getvalue()
+
+
+def del_test_data():
+ _dav().delete('/dav/testdata')
+
+def gettest():
+ _dav()._request('GET', '/dav/test.html')
+
+def if_test():
+ _dav().put('/dav/foo.html', 'foo.html contents\n')
+ etag = qp_xml.textof(getvalue('/dav/foo.html', 'DAV:', 'getetag'))
+ print 'ETAG:', etag
+ _dav()._request('DELETE', '/dav/foo.html', extra_hdrs={
+ 'If' : '(["abc"])',
+ })
+ _dav()._request('DELETE', '/dav/foo.html', extra_hdrs={
+ 'If' : '([' + etag + '])',
+ })
+
+def lock_test():
+ _dav().delete('/dav/locktest')
+ _dav().mkcol('/dav/locktest')
+ _dav().mkcol('/dav/locktest/sub')
+
+ # test a locknull resource
+ r = _dav().lock('/dav/locktest/locknull')
+
+def upload(base, title, dest_dir, source_dir, username, password, encodeduserpass):
+ _dav().setauth(username, password)
+ auth_dict = {"Authorization":"Basic %s" % encodeduserpass}
+ auth = auth_dict['Authorization']
+ print auth
+
+ for _dir in os.listdir(source_dir):
+ _dir_low = _dir.replace(title, '')
+ _dest_dir = dest_dir + _dir_low.lower()
+ #_dav().mkcol(base+'/'+dest_dir,auth_dict)
+ for file in os.listdir(source_dir+os.sep+_dir):
+ print source_dir + os.sep +_dir + os.sep + file
+ f = open(source_dir + os.sep +_dir + os.sep + file,'r')
+ _dav().put(base+'/'+_dest_dir+'/'+file,f.read(),None,None,auth_dict)
+
+def init(base, title, dest_dir, source_dir, username, password, encodeduserpass):
+ _dav().setauth(username, password)
+ auth_dict = {"Authorization":"Basic %s" % encodeduserpass}
+ auth = auth_dict['Authorization']
+ print auth
+ f = open(COURSES, 'r')
+ courses = f.readlines()
+ for course in courses:
+ _dav().mkcol(base+'/'+dest_dir+course.lower()+'/'+'Archives_Audio',auth)
+
+if __name__ == '__main__':
+ if HOST == 'FILL THIS IN':
+ import sys
+ sys.stdout = sys.stderr
+ print 'ERROR: you must edit davtest.py to set the HOST/PORT values'
+ print ' at the top of the script.'
+ sys.exit(1)
+
+ encodedUSERPASS = base64.encodestring(USERNAME+":"+PASSWORD)
+ #upload(BASE, TITLE, DESTDIR, SOURCEDIR, USERNAME, PASSWORD, encodedUSERPASS)
+ init(BASE, TITLE, DESTDIR, SOURCEDIR, USERNAME, PASSWORD, encodedUSERPASS)
+
--- /dev/null
+#
+# DAV client library
+#
+# Copyright (C) 1998-2000 Guido van Rossum. All Rights Reserved.
+# Written by Greg Stein. Given to Guido. Licensed using the Python license.
+#
+# This module is maintained by Greg and is available at:
+# http://www.lyra.org/greg/python/davlib.py
+#
+# Since this isn't in the Python distribution yet, we'll use the CVS ID
+# for tracking:
+# $Id: davlib.py,v 1.7 2000/06/11 10:04:49 gstein Exp $
+#
+
+import httplib
+import urllib
+import string
+import types
+import mimetypes
+#import qp_xml
+from xml.utils import qp_xml
+
+
+INFINITY = 'infinity'
+XML_DOC_HEADER = '<?xml version="1.0" encoding="utf-8"?>'
+XML_CONTENT_TYPE = 'text/xml; charset="utf-8"'
+
+# block size for copying files up to the server
+BLOCKSIZE = 16384
+
+
+class HTTPConnectionAuth(httplib.HTTPConnection):
+ def __init__(self, *args, **kw):
+ apply(httplib.HTTPConnection.__init__, (self,) + args, kw)
+
+ self.__username = None
+ self.__password = None
+ self.__nonce = None
+ self.__opaque = None
+
+ def setauth(self, username, password):
+ self.__username = username
+ self.__password = password
+
+
+def _parse_status(elem):
+ text = elem.textof()
+ idx1 = string.find(text, ' ')
+ idx2 = string.find(text, ' ', idx1+1)
+ return int(text[idx1:idx2]), text[idx2+1:]
+
+class _blank:
+ def __init__(self, **kw):
+ self.__dict__.update(kw)
+class _propstat(_blank): pass
+class _response(_blank): pass
+class _multistatus(_blank): pass
+
+def _extract_propstat(elem):
+ ps = _propstat(prop={}, status=None, responsedescription=None)
+ for child in elem.children:
+ if child.ns != 'DAV:':
+ continue
+ if child.name == 'prop':
+ for prop in child.children:
+ ps.prop[(prop.ns, prop.name)] = prop
+ elif child.name == 'status':
+ ps.status = _parse_status(child)
+ elif child.name == 'responsedescription':
+ ps.responsedescription = child.textof()
+ ### unknown element name
+
+ return ps
+
+def _extract_response(elem):
+ resp = _response(href=[], status=None, responsedescription=None, propstat=[])
+ for child in elem.children:
+ if child.ns != 'DAV:':
+ continue
+ if child.name == 'href':
+ resp.href.append(child.textof())
+ elif child.name == 'status':
+ resp.status = _parse_status(child)
+ elif child.name == 'responsedescription':
+ resp.responsedescription = child.textof()
+ elif child.name == 'propstat':
+ resp.propstat.append(_extract_propstat(child))
+ ### unknown child element
+
+ return resp
+
+def _extract_msr(root):
+ if root.ns != 'DAV:' or root.name != 'multistatus':
+ raise 'invalid response: <DAV:multistatus> expected'
+
+ msr = _multistatus(responses=[ ], responsedescription=None)
+
+ for child in root.children:
+ if child.ns != 'DAV:':
+ continue
+ if child.name == 'responsedescription':
+ msr.responsedescription = child.textof()
+ elif child.name == 'response':
+ msr.responses.append(_extract_response(child))
+ ### unknown child element
+
+ return msr
+
+def _extract_locktoken(root):
+ if root.ns != 'DAV:' or root.name != 'prop':
+ raise 'invalid response: <DAV:prop> expected'
+ elem = root.find('lockdiscovery', 'DAV:')
+ if not elem:
+ raise 'invalid response: <DAV:lockdiscovery> expected'
+ elem = elem.find('activelock', 'DAV:')
+ if not elem:
+ raise 'invalid response: <DAV:activelock> expected'
+ elem = elem.find('locktoken', 'DAV:')
+ if not elem:
+ raise 'invalid response: <DAV:locktoken> expected'
+ elem = elem.find('href', 'DAV:')
+ if not elem:
+ raise 'invalid response: <DAV:href> expected'
+ return elem.textof()
+
+
+class DAVResponse(httplib.HTTPResponse):
+ def parse_multistatus(self):
+ self.root = qp_xml.Parser().parse(self)
+ self.msr = _extract_msr(self.root)
+
+ def parse_lock_response(self):
+ self.root = qp_xml.Parser().parse(self)
+ self.locktoken = _extract_locktoken(self.root)
+
+
+class DAV(HTTPConnectionAuth):
+
+ response_class = DAVResponse
+
+ def get(self, url, extra_hdrs={ }):
+ return self._request('GET', url, extra_hdrs=extra_hdrs)
+
+ def head(self, url, extra_hdrs={ }):
+ return self._request('HEAD', url, extra_hdrs=extra_hdrs)
+
+ def post(self, url, data={ }, body=None, extra_hdrs={ }):
+ headers = extra_hdrs.copy()
+
+ assert body or data, "body or data must be supplied"
+ assert not (body and data), "cannot supply both body and data"
+ if data:
+ body = ''
+ for key, value in data.items():
+ if isinstance(value, types.ListType):
+ for item in value:
+ body = body + '&' + key + '=' + urllib.quote(str(item))
+ else:
+ body = body + '&' + key + '=' + urllib.quote(str(value))
+ body = body[1:]
+ headers['Content-Type'] = 'application/x-www-form-urlencoded'
+
+ return self._request('POST', url, body, headers)
+
+ def options(self, url='*', extra_hdrs={ }):
+ return self._request('OPTIONS', url, extra_hdrs=extra_hdrs)
+
+ def trace(self, url, extra_hdrs={ }):
+ return self._request('TRACE', url, extra_hdrs=extra_hdrs)
+
+ def put(self, url, contents,
+ content_type=None, content_enc=None, extra_hdrs={ }):
+
+ if not content_type:
+ content_type, content_enc = mimetypes.guess_type(url)
+
+ headers = extra_hdrs.copy()
+ if content_type:
+ headers['Content-Type'] = content_type
+ if content_enc:
+ headers['Content-Encoding'] = content_enc
+ return self._request('PUT', url, contents, headers)
+
+ def delete(self, url, extra_hdrs={ }):
+ return self._request('DELETE', url, extra_hdrs=extra_hdrs)
+
+ def propfind(self, url, body=None, depth=None, extra_hdrs={ }):
+ headers = extra_hdrs.copy()
+ headers['Content-Type'] = XML_CONTENT_TYPE
+ if depth is not None:
+ headers['Depth'] = str(depth)
+ return self._request('PROPFIND', url, body, headers)
+
+ def proppatch(self, url, body, extra_hdrs={ }):
+ headers = extra_hdrs.copy()
+ headers['Content-Type'] = XML_CONTENT_TYPE
+ return self._request('PROPPATCH', url, body, headers)
+
+ def mkcol(self, url, extra_hdrs={ }):
+ return self._request('MKCOL', url, extra_hdrs)
+
+ def move(self, src, dst, extra_hdrs={ }):
+ headers = extra_hdrs.copy()
+ headers['Destination'] = dst
+ return self._request('MOVE', src, extra_hdrs=headers)
+
+ def copy(self, src, dst, depth=None, extra_hdrs={ }):
+ headers = extra_hdrs.copy()
+ headers['Destination'] = dst
+ if depth is not None:
+ headers['Depth'] = str(depth)
+ return self._request('COPY', src, extra_hdrs=headers)
+
+ def lock(self, url, owner='', timeout=None, depth=None,
+ scope='exclusive', type='write', extra_hdrs={ }):
+ headers = extra_hdrs.copy()
+ headers['Content-Type'] = XML_CONTENT_TYPE
+ if depth is not None:
+ headers['Depth'] = str(depth)
+ if timeout is not None:
+ headers['Timeout'] = timeout
+ body = XML_DOC_HEADER + \
+ '<DAV:lockinfo xmlns:DAV="DAV:">' + \
+ '<DAV:lockscope><DAV:%s/></DAV:lockscope>' % scope + \
+ '<DAV:locktype><DAV:%s/></DAV:locktype>' % type + \
+ owner + \
+ '</DAV:lockinfo>'
+ return self._request('LOCK', url, body, extra_hdrs=headers)
+
+ def unlock(self, url, locktoken, extra_hdrs={ }):
+ headers = extra_hdrs.copy()
+ if locktoken[0] != '<':
+ locktoken = '<' + locktoken + '>'
+ headers['Lock-Token'] = locktoken
+ return self._request('UNLOCK', url, extra_hdrs=headers)
+
+ def _request(self, method, url, body=None, extra_hdrs={}):
+ "Internal method for sending a request."
+
+ self.request(method, url, body, extra_hdrs)
+ return self.getresponse()
+
+
+ #
+ # Higher-level methods for typical client use
+ #
+
+ def allprops(self, url, depth=None):
+ return self.propfind(url, depth=depth)
+
+ def propnames(self, url, depth=None):
+ body = XML_DOC_HEADER + \
+ '<DAV:propfind xmlns:DAV="DAV:"><DAV:propname/></DAV:propfind>'
+ return self.propfind(url, body, depth)
+
+ def getprops(self, url, *names, **kw):
+ assert names, 'at least one property name must be provided'
+ if kw.has_key('ns'):
+ xmlns = ' xmlns:NS="' + kw['ns'] + '"'
+ ns = 'NS:'
+ del kw['ns']
+ else:
+ xmlns = ns = ''
+ if kw.has_key('depth'):
+ depth = kw['depth']
+ del kw['depth']
+ else:
+ depth = 0
+ assert not kw, 'unknown arguments'
+ body = XML_DOC_HEADER + \
+ '<DAV:propfind xmlns:DAV="DAV:"' + xmlns + '><DAV:prop><' + ns + \
+ string.joinfields(names, '/><' + ns) + \
+ '/></DAV:prop></DAV:propfind>'
+ return self.propfind(url, body, depth)
+
+ def delprops(self, url, *names, **kw):
+ assert names, 'at least one property name must be provided'
+ if kw.has_key('ns'):
+ xmlns = ' xmlns:NS="' + kw['ns'] + '"'
+ ns = 'NS:'
+ del kw['ns']
+ else:
+ xmlns = ns = ''
+ assert not kw, 'unknown arguments'
+ body = XML_DOC_HEADER + \
+ '<DAV:propertyupdate xmlns:DAV="DAV:"' + xmlns + \
+ '><DAV:remove><DAV:prop><' + ns + \
+ string.joinfields(names, '/><' + ns) + \
+ '/></DAV:prop></DAV:remove></DAV:propertyupdate>'
+ return self.proppatch(url, body)
+
+ def setprops(self, url, *xmlprops, **props):
+ assert xmlprops or props, 'at least one property must be provided'
+ xmlprops = list(xmlprops)
+ if props.has_key('ns'):
+ xmlns = ' xmlns:NS="' + props['ns'] + '"'
+ ns = 'NS:'
+ del props['ns']
+ else:
+ xmlns = ns = ''
+ for key, value in props.items():
+ if value:
+ xmlprops.append('<%s%s>%s</%s%s>' % (ns, key, value, ns, key))
+ else:
+ xmlprops.append('<%s%s/>' % (ns, key))
+ elems = string.joinfields(xmlprops, '')
+ body = XML_DOC_HEADER + \
+ '<DAV:propertyupdate xmlns:DAV="DAV:"' + xmlns + \
+ '><DAV:set><DAV:prop>' + \
+ elems + \
+ '</DAV:prop></DAV:set></DAV:propertyupdate>'
+ return self.proppatch(url, body)
+
+ def get_lock(self, url, owner='', timeout=None, depth=None):
+ response = self.lock(url, owner, timeout, depth)
+ response.parse_lock_response()
+ return response.locktoken
--- /dev/null
+#
+# DAV testing hack
+#
+
+import sys
+import davlib
+import string
+import gdbm
+import StringIO
+import base64
+from xml.utils import qp_xml
+
+HOST = 'parisson.com'
+#HOST = 'localhost'
+PORT = '1983'
+BASE = 'http://%s:%s' % (HOST, PORT)
+USERNAME = 'zope'
+DESTDIR = 'CRFPA/formations/formations-en-ligne/cours-audio/droit_penal_cours/'
+#DESTDIR = 'parisson.com_2/Members/yomguy/dav'
+#DESTDIR = 'dav'
+#FILE = 'vc07_lop_nobd_100bpm.wav.mp3'
+FILE = '04_Idjut_Boys_-_Rebirth_Evil_Vibrations.mp3'
+PASSWORD = sys.argv[1]
+encodedUSERPASS = base64.encodestring(USERNAME+":"+PASSWORD)
+
+
+def getprop(dirname, fname, ns, propname):
+ g = gdbm.open(dirname + '/.DAV/' + fname, 'r')
+ return g[str(ns) + ':' + propname + '\0']
+
+def setprop(dirname, fname, ns, propname, value):
+ g = gdbm.open(dirname + '/.DAV/' + fname, 'c')
+ g[str(ns) + ':' + propname + '\0'] = value + '\0'
+
+def dump(dirname, fname):
+ g = gdbm.open(dirname + '/.DAV/' + fname, 'r')
+ for key in g.keys():
+ print `key`, '=', `g[key]`
+
+class mydav(davlib.DAV):
+ def _request(self, method, url, *rest, **kw):
+ print 'REQUEST:', method, url
+ response = apply(davlib.DAV._request, (self, method, url) + rest, kw)
+ print "STATUS:", response.status
+ print "REASON:", response.reason
+ for hdr in response.msg.headers:
+ print string.strip (hdr)
+ print '-'*70
+ if response.status == 207:
+ #print response.doc.dump()
+ #print response.doc.toxml()
+ response.parse_multistatus()
+ davlib.qp_xml.dump(sys.stdout, response.root)
+ elif method == 'LOCK' and response.status == 200:
+ response.parse_lock_response()
+ davlib.qp_xml.dump(sys.stdout, response.root)
+ else:
+ print response.read()
+ print '-'*70
+ return response
+ def get_lock(self, url, owner='', timeout=None, depth=None):
+ return self.lock(url, owner, timeout, depth).locktoken
+
+
+def _dav():
+ return mydav(HOST, PORT)
+
+def getvalue(url, ns, prop):
+ response = _dav().getprops(url, prop, ns=ns)
+ resp = response.msr.responses[0]
+ if resp.status and resp.status[0] != 200:
+ raise 'error retrieving property', response.status
+ propstat = resp.propstat[0]
+ if propstat.status and propstat.status[0] != 200:
+ raise 'error retrieving property', propstat.status
+ return propstat.prop[(ns, prop)]
+
+ #s = StringIO.StringIO()
+ #davlib.qp_xml.dump(s, propstat.prop[(ns, prop)])
+ #return s.getvalue()
+
+def gen_test_data():
+ # some property values
+ pv1 = '<pv1>pv1</pv1>'
+ pv2 = '<pv2/>'
+ pv3 = '<foo:pv3 xmlns:foo="namespace">pv3</foo:pv3>'
+ pv4 = '<foo:pv4 xmlns:foo="namespace"/>'
+ pv5 = '<bar:pv5 xmlns:bar="namespace">pv5</bar:pv5>'
+ pv6 = '<bar:pv6 xmlns:bar="namespace"/>'
+ pv7 = '<pv7 xmlns="namespace">pv7</pv7>'
+ pv8 = '<pv8 xmlns="namespace"/>'
+ pv9 = '<foo:pv9 xmlns:foo="other">pv9</foo:pv9>'
+ pv10 = '<foo:pv10 xmlns:foo="other"/>'
+ pv11 = '<bar:pv11 xmlns:bar="other">pv11</bar:pv11>'
+ pv12 = '<bar:pv12 xmlns:bar="other"/>'
+ pv13 = '<pv13 xmlns="other">pv13</pv13>'
+ pv14 = '<pv14 xmlns="other"/>'
+
+ # prep the file structure
+ _dav().mkcol('/dav/testdata')
+ _dav().put('/dav/testdata/file1', 'file1 contents\n')
+ _dav().put('/dav/testdata/file2', 'file2 contents\n')
+ _dav().put('/dav/testdata/file3', 'file3 contents\n')
+ _dav().mkcol('/dav/testdata/sub')
+ _dav().put('/dav/testdata/sub/file1', 'sub/file1 contents\n')
+ _dav().put('/dav/testdata/sub/file2', 'sub/file1 contents\n')
+ _dav().put('/dav/testdata/sub/file3', 'sub/file1 contents\n')
+
+ # attach a bunch of properties
+ _dav().setprops('/dav/testdata',
+ pv1, pv2,
+ pv3, pv4, pv5, pv6, pv7, pv8,
+ pv9, pv10, pv11, pv12, pv13, pv14)
+ _dav().setprops('/dav/testdata/file1',
+ pv1, pv2,
+ pv3, pv4, pv5, pv6, pv7, pv8,
+ pv9, pv10, pv11, pv12, pv13, pv14)
+ _dav().setprops('/dav/testdata/file2',
+ pv9, pv10, pv11, pv12, pv13, pv14)
+ _dav().setprops('/dav/testdata/file3',
+ pv1, pv2,
+ pv3, pv4, pv5, pv6, pv7, pv8)
+ _dav().setprops('/dav/testdata/sub',
+ pv1, pv2)
+ _dav().setprops('/dav/testdata/sub/file1',
+ pv1, pv2,
+ pv9, pv10, pv11, pv12, pv13, pv14)
+ _dav().setprops('/dav/testdata/sub/file2',
+ pv3, pv4, pv5, pv6, pv7, pv8,
+ pv9, pv10, pv11, pv12, pv13, pv14)
+ _dav().setprops('/dav/testdata/sub/file3',
+ pv1, pv2,
+ pv3, pv4, pv5, pv6, pv7, pv8)
+
+ # do some moves and copies
+ _dav().move('/dav/testdata/file1', BASE + '/dav/testdata/newfile1')
+ _dav().move('/dav/testdata/sub', BASE + '/dav/testdata/newsub')
+ _dav().move('/dav/testdata/newsub/file2', BASE + '/dav/testdata/newsubfile2')
+ _dav().copy('/dav/testdata/newsub/file3', BASE + '/dav/testdata/newsub/file3copy')
+ _dav().copy('/dav/testdata/newsub/file1', BASE + '/dav/testdata/subfile1copy')
+ _dav().copy('/dav/testdata/newsub', BASE + '/dav/testdata/subcopy')
+
+ # dump all the data
+ _dav().allprops('/dav/testdata')
+
+
+def del_test_data():
+ _dav().delete('/dav/testdata')
+
+def gettest():
+ _dav()._request('GET', '/dav/test.html')
+
+def if_test():
+ _dav().put('/dav/foo.html', 'foo.html contents\n')
+ etag = qp_xml.textof(getvalue('/dav/foo.html', 'DAV:', 'getetag'))
+ print 'ETAG:', etag
+ _dav()._request('DELETE', '/dav/foo.html', extra_hdrs={
+ 'If' : '(["abc"])',
+ })
+ _dav()._request('DELETE', '/dav/foo.html', extra_hdrs={
+ 'If' : '([' + etag + '])',
+ })
+
+def lock_test():
+ _dav().delete('/dav/locktest')
+ _dav().mkcol('/dav/locktest')
+ _dav().mkcol('/dav/locktest/sub')
+
+ # test a locknull resource
+ r = _dav().lock('/dav/locktest/locknull')
+
+def test():
+ _dav().setauth(USERNAME,PASSWORD)
+ auth_dict = {"Authorization":"Basic %s" % encodedUSERPASS}
+ auth = auth_dict['Authorization']
+ print auth
+
+ f = open(FILE,'r')
+ #_dav().mkcol(BASE+'/'+DESTDIR,auth)
+ _dav().put(BASE+'/'+DESTDIR+'/'+FILE,f.read(),None,None,auth_dict)
+
+ #_data = _dav().get(BASE+'/test/'+FILE,auth_dict)
+ #f = open(FILE,'w')
+ #f.write(_data)
+ #f.close()
+
+ #_dav().getprops(BASE+'/test/foo.html', 'author', 'foober', 'title')
+ #_dav().mkcol(BASE+'/dav/',{"Authorization":"Basic %s" % encodedUSERPASS})
+ #_dav().put(BASE+'/foo.html','\n OKKKKKKKKKKK \n',{"Authorization":"Basic %s" % encodedUSERPASS})
+ #_dav().options('/dav/foo.html')
+ #_dav().delete('/dav/foo.html')
+ #_dav().delete('/dav/newdir')
+ #_dav().mkcol('/dav/newdir')
+ #_dav().mkcol('/dav/newdir/another')
+ #_dav().allprops('/dav', 1)
+ #_dav().propnames('/dav', 1)
+ #_dav().getprops('/dav', 'author', 'foober', 'title')
+ #_dav().propfind('/dav',
+ #'<?xml version="1.0"?><propfind xmlns="DAV:"><prop>'
+ #'<author/><foobar/><title/>'
+ #'</prop></propfind>',
+ #'infinity')
+ #_dav().delprops('/dav', 'author')
+ #_dav().setprops('/dav', '''<author>
+ #<complex oops="hi" two="three" > stuff goes in here
+ #</complex>
+ #<more foo="bar"/>
+ #stuff
+ #</author>''')
+ #_dav().put('/dav/blah.cgi', 'body of blah.cgi\n')
+ #_dav().put('/dav/file1', 'body of file1\n')
+ #_dav().move('/dav/blah.cgi', BASE + '/dav/foo.cgi')
+ #_dav().copy('/dav/subdir', BASE + '/dav/subdir3')
+ #_dav().setprops('/dav/file1','<woo>bar</woo>')
+
+ #_dav().propfind('/dav/foo.cgi', '''<?xml version="1.0"?>
+ #<propfind xmlns="DAV:"><propname/>
+ #<foo:bar xmlns:foo="xyz" xmlns:bar="abc">
+ #<foo:bar bar:xxx="hello"/>
+ #<bar:ddd what:aaa="hi" xmlns:what="ha"/>
+ #<geez xmlns="empty"/>
+ #<davtag/>
+ #<rep:davtag2 xmlns:rep="DAV:"/>
+ #</foo:bar>
+ #</propfind>
+ #''')
+
+ #del_test_data()
+ #gen_test_data()
+
+
+if __name__ == '__main__':
+ if HOST == 'FILL THIS IN':
+ import sys
+ sys.stdout = sys.stderr
+ print 'ERROR: you must edit davtest.py to set the HOST/PORT values'
+ print ' at the top of the script.'
+ sys.exit(1)
+
+ test()
--- /dev/null
+
+Hello World !
+
+Yomguy
+:)
--- /dev/null
+#!/usr/bin.python
+
+import davlib
+
+HOST = 'localhost'
+PORT = 1980
+BASE = 'http://%s:%s' % (HOST, PORT)
+
+class mydav(davlib.DAV):
+ def _request(self, method, url, *rest, **kw):
+ print 'REQUEST:', method, url
+ response = apply(davlib.DAV._request, (self, method, url) + rest, kw)
+ print "STATUS:", response.status
+ print "REASON:", response.reason
+ for hdr in response.msg.headers:
+ print string.strip(hdr)
+ print '-'*70
+ if response.status == 207:
+ #print response.doc.dump()
+ #print response.doc.toxml()
+ response.parse_multistatus()
+ davlib.qp_xml.dump(sys.stdout, response.root)
+ elif method == 'LOCK' and response.status == 200:
+ response.parse_lock_response()
+ davlib.qp_xml.dump(sys.stdout, response.root)
+ else:
+ print response.read()
+ print '-'*70
+ return response
+ def get_lock(self, url, owner='', timeout=None, depth=None):
+ return self.lock(url, owner, timeout, depth).locktoken
+
+
+def _dav():
+ return mydav(HOST, PORT)
+
+
+def getvalue(url, ns, prop):
+ response = _dav().getprops(url, prop, ns=ns)
+ resp = response.msr.responses[0]
+ if resp.status and resp.status[0] != 200:
+ raise 'error retrieving property', response.status
+ propstat = resp.propstat[0]
+ if propstat.status and propstat.status[0] != 200:
+ raise 'error retrieving property', propstat.status
+ return propstat.prop[(ns, prop)]
+
--- /dev/null
+"""Python interface to Webthumb API (see http://bluga.net/webthumb/)
+
+By Ross Poulton - www.rossp.org
+
+License: Use this how you like, just don't claim it as your own because
+ that isn't cool. I'm not responsible for what this script does.
+
+Usage: Define WEBTHUMB_APIKEY with your API key, as per the above URL.
+
+Then, just call get_thumbnail(url, output_path). It will return true on
+success, false on anything else.
+
+An optional third parameter can be passed for the image size.
+"""
+
+import time
+import os
+import httplib
+
+import xml.dom.minidom
+from xml.dom.minidom import Node
+
+WEBTHUMB_APIKEY='e1716f8b48a6b9f4b27fa9d06fbc8579'
+
+WEBTHUMB_HOST='webthumb.bluga.net'
+WEBTHUMB_URI='/api.php'
+
+VALID_SIZES = (
+ 'small',
+ 'medium',
+ 'medium2',
+ 'large',
+)
+
+def get_thumbnail(url, output_path, size='medium2'):
+ if size not in VALID_SIZES:
+ return False
+
+ request = """
+<webthumb>
+ <apikey>%s</apikey>
+ <request>
+ <url>%s</url>
+ <output_type>png</output_type>
+ </request>
+</webthumb>
+ """ % (WEBTHUMB_APIKEY, url)
+
+ h = httplib.HTTPConnection(WEBTHUMB_HOST)
+ h.request("GET", WEBTHUMB_URI, request)
+ response = h.getresponse()
+
+ type = response.getheader('Content-Type', 'text/plain')
+ body = response.read()
+ h.close()
+ if type == 'text/xml':
+ # This is defined as 'success' by the API. text/plain is failure.
+ doc = xml.dom.minidom.parseString(body)
+ wait = 1
+ for node in doc.getElementsByTagName("job"):
+ wait = node.getAttribute('estimate')
+ key = ""
+ for node2 in node.childNodes:
+ if node2.nodeType == Node.TEXT_NODE:
+ key = node2.data
+
+ # We're given an approx time by the webthumb server,
+ # we shouldn't request the thumbnail again within this
+ # time.
+ time.sleep(int(wait))
+
+ request = """
+ <webthumb>
+ <apikey>%s</apikey>
+ <fetch>
+ <job>%s</job>
+ <size>%s</size>
+ </fetch>
+ </webthumb>
+ """ % (WEBTHUMB_APIKEY, key, size)
+
+ h = httplib.HTTPConnection(WEBTHUMB_HOST)
+ h.request("GET", WEBTHUMB_URI, request)
+ response = h.getresponse()
+ try:
+ os.unlink(output_path)
+ except:
+ pass
+ img = file(output_path, "wb")
+ img.write(response.read())
+ img.close()
+ h.close()
+ return True
+ else:
+ return False
--- /dev/null
+#!/usr/bin/python
+# Create thumbs of webpages from a list of URLs
+
+# depends : webthumb, imagemagick
+
+import os
+import sys
+from webthumb import get_thumbnail
+
+img_dir = '/var/www/files/img/webthumbs'
+site_list_file = '/var/www/files/img/webthumbs/webthumb_list.txt'
+
+def main(site_list_file, img_dir):
+ site_list = open(site_list_file,'r')
+ for site in site_list.readlines():
+ site = site[0:len(site)-1]
+ if site:
+ print site
+ file = site.replace('/','_')
+ file = img_dir+os.sep+file+'.png'
+ print file
+ get_thumbnail('http://'+site, file,'large')
+ site_list.close()
+ print 'Webthumbs created !'
+
+if __name__ == '__main__':
+ main(site_list_file, img_dir)
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+import time
+import smtplib
+from email.mime.text import MIMEText
+from email.mime.multipart import MIMEMultipart
+import logging
+
+
+class Logger:
+ """A logging object"""
+
+ def __init__(self, file):
+ self.logger = logging.getLogger('myapp')
+ self.hdlr = logging.FileHandler(file)
+ self.formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
+ self.hdlr.setFormatter(self.formatter)
+ self.logger.addHandler(self.hdlr)
+ self.logger.setLevel(logging.INFO)
+
+ def write(self, message):
+ self.logger.info(message)
+
+
+class ParissonMailLogger:
+
+ def __init__(self, emails, server, service, txt_file=None):
+ self.emails = emails
+ self.server = server
+ self.service = service
+ self.user = 'logger'
+ self.user_email = self.user + '@' + self.server
+ self.smtp_server = smtplib.SMTP('localhost')
+ self.date = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())
+ self.msg = self.date + ' : ' + self.service + ' has logged this information'
+ self.mime_msg = MIMEMultipart()
+ self.mime_msg['Subject'] = 'URGENT ! ' + self.server + ' : ' + self.service
+ self.mime_msg['To'] = ', '.join(self.emails)
+ self.mime_msg['From'] = self.user_email
+ self.mime_txt = MIMEText(self.msg)
+ self.mime_msg.attach(self.mime_txt)
+ if txt_file:
+ self.txt_file = open(txt_file, 'r')
+ self.mime_txt = MIMEText(self.txt_file.read())
+ self.mime_msg.attach(self.mime_txt)
+ self.txt_file.close()
+
+ def send(self):
+ self.smtp_server.sendmail(self.user_email, self.emails, self.mime_msg.as_string())
+
+def main():
+ txt_file = sys.argv[-1]
+ service = sys.argv[-2]
+ server = sys.argv[-3]
+ emails = ['yomguy@sfr.fr','yomguy@parisson.com', 'janob@parisson.com']
+
+ date = os.path.getmtime(txt_file)
+ laps = time.time() - date
+ if laps < 60:
+ p = ParissonMailLogger(emails, server, service, txt_file)
+ p.send()
+ p.smtp_server.quit()
+
+if __name__ == '__main__':
+ main()
+
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+import time
+import socket
+import smtplib
+from email.mime.text import MIMEText
+from email.mime.multipart import MIMEMultipart
+
+class ParissonMailLogger:
+
+ def __init__(self, emails, service, txt_file=None):
+ self.emails = emails
+ self.server = socket.gethostbyaddr(socket.gethostname())[0]
+ self.service = service
+ self.user = 'logger-no-reply'
+ self.user_email = self.user + '@' + self.server
+ self.smtp_server = smtplib.SMTP('localhost')
+ self.date = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())
+ self.msg = self.date + ' : ' + self.service + ' has logged this information'
+ self.mime_msg = MIMEMultipart()
+ self.mime_msg['Subject'] = self.server + ' : ' + self.service
+ self.mime_msg['To'] = ', '.join(self.emails)
+ self.mime_msg['From'] = self.user_email
+ self.mime_txt = MIMEText(self.msg)
+ self.mime_msg.attach(self.mime_txt)
+ if txt_file:
+ self.txt_file = open(txt_file, 'r')
+ self.mime_txt = MIMEText(self.txt_file.read())
+ self.mime_msg.attach(self.mime_txt)
+ self.txt_file.close()
+
+ def send(self):
+ self.smtp_server.sendmail(self.user_email, self.emails, self.mime_msg.as_string())
+
+def main():
+ txt_file = sys.argv[-2]
+ service = sys.argv[-3]
+ emails = sys.argv[-1].split(',')
+
+ p = ParissonMailLogger(emails, service, txt_file)
+ p.send()
+ p.smtp_server.quit()
+
+if __name__ == '__main__':
+ main()
+
--- /dev/null
+#!/usr/bin/python
+
+import os
+import time
+
+service = 'apache2'
+mails = ['yomguy@sfr.fr','pellerin@parisson.com']
+server = 'ns37892'
+file = '/tmp/restartd_apache.tmp'
+
+def touch_and_mail(server, service, mails, file):
+ for mail in mails:
+ command = 'echo "'+service+' crashed" | mail -s"'+server+'" '+mail
+ os.system('touch '+file)
+ os.system(command)
+
+
+if not os.path.exists(file):
+ touch_and_mail(server, service, mails, file)
+
+date = os.path.getmtime(file)
+laps = time.time() - date
+print laps
+if laps > 120:
+ touch_and_mail(server, service, mails, file)
+
+
--- /dev/null
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import sys
+import twitter
+
+
+# @deefuzz_test3
+test_key='146002442-qgtArE6YrpLfL6h51LnE5TA9skcKhOqDraNDaOY'
+test_secret='8RWoZjllOv52PUmXbLJcu5qunY8qAa6V6pyLGBHEcg'
+
+# @parisson_studio
+ps_key='223431436-8uYqGM0tLHBiMbk6Bt39oBfwXpylfLcr7t6bs311'
+ps_secret='SzWD3fDgBpw9qwNNrYarXTcRJSTklp0PpKXg7Iw'
+
+# @parisson_com
+pc_key='241046394-MpI5YrkgHSjW0Ab4WIlU0nJruGqesLueCWDJ1qtx'
+pc_secret='6gRzqDvqkjhRzFCfetdWfZYPQdbvQQhVEhhGHQ90JCM'
+
+# Twitter DeeFuzzer keys
+DEEFUZZER_CONSUMER_KEY = 'ozs9cPS2ci6eYQzzMSTb4g'
+DEEFUZZER_CONSUMER_SECRET = '1kNEffHgGSXO2gMNTr8HRum5s2ofx3VQnJyfd0es'
+
+escape = ['parisson_studio', 'parisson_com', 'kvraudio']
+
+class Twitter(object):
+
+ def __init__(self, access_token_key, access_token_secret):
+ import twitter
+ self.consumer_key = DEEFUZZER_CONSUMER_KEY
+ self.consumer_secret = DEEFUZZER_CONSUMER_SECRET
+ self.access_token_key = access_token_key
+ self.access_token_secret = access_token_secret
+ self.api = twitter.Api(consumer_key=self.consumer_key,
+ consumer_secret=self.consumer_secret,
+ access_token_key=self.access_token_key,
+ access_token_secret=self.access_token_secret)
+ self.followers = self.get_followers()
+ self.friends = self.get_friends()
+
+ def post(self, message):
+ try:
+ self.api.PostUpdate(message)
+ except:
+ pass
+
+ def get_friends(self):
+ l = []
+ for f in self.api.GetFriends():
+ l.append(f.screen_name)
+ return l
+
+ def get_followers(self):
+ l = []
+ for f in self.api.GetFollowers():
+ l.append(f.screen_name)
+ return l
+
+ def send_private_mess(self, mess, tags):
+ for f in self.followers:
+ self.api.PostDirectMessage(f, mess + ' #' + (' #').join(tags))
+
+ def send_friends_mess(self, mess, tags):
+ mess_header = mess
+ for f in self.friends:
+ if not f in escape:
+ mess = '@' + f + ' ' + mess_header + ' #' + ' #'.join(tags)
+ print mess
+ self.post(mess)
+
+ def add_friends(self, friends):
+ for f in friends:
+ if not f in self.friends and not f in escape:
+ self.api.CreateFriendship(f)
+
+if __name__ == '__main__':
+ mess = 'TC-202 Case : the mobile media solution now released by Parisson http://bit.ly/gSvqaF'
+ tags = ['proaudio', 'broadcast']
+
+ print ('IN')
+ twitt_in = Twitter(ps_key, ps_secret)
+ print str(len(twitt_in.followers)) + ' Followers:'
+ print twitt_in.followers
+ print str(len(twitt_in.friends)) + ' Friends:'
+ print twitt_in.friends
+
+ print ('OUT')
+ twitt_out = Twitter(pc_key, pc_secret)
+ print str(len(twitt_out.followers)) + ' Followers:'
+ print twitt_out.followers
+ print str(len(twitt_out.friends)) + ' Friends:'
+ print twitt_out.friends
+
+ #twitt_out.add_friends(twitt_in.friends)
+ #twitt.send_private_mess(mess, tags)
+ twitt_out.send_friends_mess(mess, tags)
+
+ print 'OK'
+
+
\ No newline at end of file
+++ /dev/null
-#!/usr/bin/python
-
-import os
-import sys
-import string
-
-class ApacheConfig:
- """Implements the whole configuration of Apache server"""
-
- def __init__(self, conf_dir):
- self.conf_dir = conf_dir
- self.conf_list = os.listdir(self.conf_dir)
- self.confs = self.get_confs()
- self.domains = self.get_domains()
- self.conf_number = len(self.confs)
-
- def get_confs(self):
- """return a dictionnary describing all the Apache domains"""
- confs = []
- for conf in self.conf_list:
- c = ApacheVitualHost(self.conf_dir+os.sep+conf)
- conf_dict = {}
- conf_dict['domain'] = c.domain
- conf_dict['conf'] = c.conf
- confs.append(conf_dict)
- return confs
-
- def get_domains(self):
- domains = []
- for conf in self.confs:
- if conf['domain']:
- domains.append(conf['domain'])
- return domains
-
- #if 'ServerName' in conf:
- #domain = conf['ServerName']
- #else:
- #domain = 'unknown'
- #if domain and not 'stats' in domain:
- #domains.append(domain)
-
- def get_param(self, param):
- pass
-
- def get_custom_logs(self):
- logs = {}
- for conf in self.confs:
- if conf['conf']['CustomLog']:
- logs[conf['domain']] = conf['conf']['CustomLog']
- return logs
-
-
-class ApacheVitualHost:
- """Implements an Apache virtualhost"""
-
- def __init__(self, conf_file):
- self.conf_file = conf_file
- self.conf = self.get_conf()
- self.domain = self.get_domain()
-
- def get_conf(self):
- """return a dictionnary describing the Apache virtualhost"""
- conf_file = open(self.conf_file)
- conf = conf_file.readlines()
- conf_dict = {}
- for line in conf:
- line = line.strip()
- if line:
- if line[0] != '<' and line[0] != '#':
- #print line
- param = line.split(' ')
- param = [w for w in param if len(w) > 0]
- #print param
- if len(param) > 1:
- conf_dict[param[0]] = param[1]
- #print conf_dict
- return conf_dict
- conf_file.close()
-
- def get_domain(self):
- if 'ServerName' in self.conf:
- domain = self.conf['ServerName']
- else:
- domain = 'unknown'
- if domain:
- return domain
-
-
-class AwstatsConfig:
- """Implements the whole configuration of Awstats system"""
-
- def __init__(self, conf_dir):
- self.conf_dir = conf_dir
- self.conf_list = os.listdir(self.conf_dir)
- self.confs = self.get_confs()
- self.domains = self.get_domains()
- self.conf_number = len(self.confs)
- self.default_conf = 'awstats_default.conf'
-
- def get_confs(self):
- """return a dictionnary describing all the Awstats domains"""
- confs = []
- for conf in self.conf_list:
- c = AwstatsDomain(self.conf_dir+os.sep+conf)
- conf_dict = {}
- conf_dict['domain'] = c.domain
- conf_dict['conf'] = c.conf
- confs.append(conf_dict)
- return confs
-
- def get_domains(self):
- domains = []
- for conf in self.confs:
- if conf['domain']:
- domains.append(conf['domain'])
- return domains
-
- def get_custom_logs(self):
- """return a dictionnary of all the custom log files"""
- logs = {}
- for conf in self.confs:
- if conf['conf']:
- if conf['conf']['LogFile']:
- logs[conf['domain']] = conf['conf']['LogFile']
- return logs
-
-
-class AwstatsDomain:
- """Implements an Awstasts domain"""
- def __init__(self, conf_file):
- self.conf_file = conf_file
- self.conf = self.get_conf()
- self.domain = self.get_domain()
-
- def get_conf(self):
- """return a dictionnary describing the Awstats domain"""
- conf_file = open(self.conf_file)
- conf = conf_file.readlines()
- conf_dict = {}
- for line in conf:
- line = line.strip()
- if line:
- if line[0] != '<' and line[0] != '#':
- #print line
- param = line.split('=')
- param = [w for w in param if len(w) > 0]
- #print param
- if len(param) > 1:
- conf_dict[param[0]] = param[1].replace('"','').replace('\t','').strip()
- #print conf_dict
- return conf_dict
- conf_file.close()
-
- def get_domain(self):
- if 'SiteDomain' in self.conf:
- domain = self.conf['SiteDomain']
- else:
- domain = ''
- if domain:
- return domain
-
- def set_conf(self):
- pass
-
- def get_apache_conf(self):
- return """ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
- <Directory "/usr/lib/cgi-bin">
- AllowOverride All
- Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
- Order allow,deny
- Allow from all
- </Directory>
-
- Alias /awstats-icon/ "/usr/share/awstats/icon/"
- <Directory /usr/share/awstats/icon>
- AllowOverride None
- Options None
- Order allow,deny
- Allow from all
- </Directory>
- """
-
-def main():
- a = ApacheConfig('/etc/apache2/sites-available/')
- w = AwstatsConfig('/etc/awstats/')
-
-<<<<<<< .mine
-#print w.get_confs( )
-print w.get_domains()
-print w.get_custom_logs()
-=======
- print a.get_domains()
- print a.get_custom_logs()
-
- #print w.get_confs()
- print w.get_domains()
- print w.get_custom_logs()
- print
-
-if __name__ == '__main__':
- main()
-
->>>>>>> .r64
+++ /dev/null
-# AWSTATS CONFIGURE FILE 6.6
-#-----------------------------------------------------------------------------
-# Copy this file into awstats.www.mydomain.conf and edit this new config file
-# to setup AWStats (See documentation in docs/ directory).
-# The config file must be in /etc/awstats, /usr/local/etc/awstats or /etc (for
-# Unix/Linux) or same directory than awstats.pl (Windows, Mac, Unix/Linux...)
-# To include an environment variable in any parameter (AWStats will replace
-# it with its value when reading it), follow the example:
-# Parameter="__ENVNAME__"
-# Note that environment variable AWSTATS_CURRENT_CONFIG is always defined with
-# the config value in an AWStats running session and can be used like others.
-#-----------------------------------------------------------------------------
-# $Revision: 1.327 $ - $Author: eldy $ - $Date: 2006/04/21 22:28:49 $
-
-
-
-#-----------------------------------------------------------------------------
-# MAIN SETUP SECTION (Required to make AWStats work)
-#-----------------------------------------------------------------------------
-
-# "LogFile" contains the web, ftp or mail server log file to analyze.
-# Possible values: A full path, or a relative path from awstats.pl directory.
-# Example: "/var/log/apache/access.log"
-# Example: "../logs/mycombinedlog.log"
-# You can also use tags in this filename if you need a dynamic file name
-# depending on date or time (Replacement is made by AWStats at the beginning
-# of its execution). This is available tags :
-# %YYYY-n is replaced with 4 digits year we were n hours ago
-# %YY-n is replaced with 2 digits year we were n hours ago
-# %MM-n is replaced with 2 digits month we were n hours ago
-# %MO-n is replaced with 3 letters month we were n hours ago
-# %DD-n is replaced with day we were n hours ago
-# %HH-n is replaced with hour we were n hours ago
-# %NS-n is replaced with number of seconds at 00:00 since 1970
-# %WM-n is replaced with the week number in month (1-5)
-# %Wm-n is replaced with the week number in month (0-4)
-# %WY-n is replaced with the week number in year (01-52)
-# %Wy-n is replaced with the week number in year (00-51)
-# %DW-n is replaced with the day number in week (1-7, 1=sunday)
-# use n=24 if you need (1-7, 1=monday)
-# %Dw-n is replaced with the day number in week (0-6, 0=sunday)
-# use n=24 if you need (0-6, 0=monday)
-# Use 0 for n if you need current year, month, day, hour...
-# Example: "/var/log/access_log.%YYYY-0%MM-0%DD-0.log"
-# Example: "C:/WINNT/system32/LogFiles/W3SVC1/ex%YY-24%MM-24%DD-24.log"
-# You can also use a pipe if log file come from a pipe :
-# Example: "gzip -d </var/log/apache/access.log.gz |"
-# If there are several log files from load balancing servers :
-# Example: "/pathtotools/logresolvemerge.pl *.log |"
-#
-LogFile="/var/log/apache/access.log"
-
-
-# Enter the log file type you want to analyze.
-# Possible values:
-# W - For a web log file
-# S - For a streaming log file
-# M - For a mail log file
-# F - For a ftp log file
-# Example: W
-# Default: W
-#
-LogType=W
-
-
-# Enter here your log format (Must match your web server config. See setup
-# instructions in documentation to know how to configure your web server to
-# have the required log format).
-# Possible values: 1,2,3,4 or "your_own_personalized_log_format"
-# 1 - Apache or Lotus Notes/Domino native combined log format (NCSA combined/XLF/ELF log format)
-# 2 - IIS or ISA format (IIS W3C log format). See FAQ-COM115 For ISA.
-# 3 - Webstar native log format.
-# 4 - Apache or Squid native common log format (NCSA common/CLF log format)
-# With LogFormat=4, some features (browsers, os, keywords...) can't work.
-# "your_own_personalized_log_format" = If your log is ftp, mail or other format,
-# you must use following keys to define the log format string (See FAQ for
-# ftp, mail or exotic web log format examples):
-# %host Client hostname or IP address (or Sender host for mail log)
-# %host_r Receiver hostname or IP address (for mail log)
-# %lognamequot Authenticated login/user with format: "john"
-# %logname Authenticated login/user with format: john
-# %time1 Date and time with format: [dd/mon/yyyy:hh:mm:ss +0000] or [dd/mon/yyyy:hh:mm:ss]
-# %time2 Date and time with format: yyyy-mm-dd hh:mm:ss
-# %time3 Date and time with format: Mon dd hh:mm:ss or Mon dd hh:mm:ss yyyy
-# %time4 Date and time with unix timestamp format: dddddddddd
-# %methodurl Method and URL with format: "GET /index.html HTTP/x.x"
-# %methodurlnoprot Method and URL with format: "GET /index.html"
-# %method Method with format: GET
-# %url URL only with format: /index.html
-# %query Query string (used by URLWithQuery option)
-# %code Return code status (with format for web log: 999)
-# %bytesd Size of document in bytes
-# %refererquot Referer page with format: "http://from.com/from.htm"
-# %referer Referer page with format: http://from.com/from.htm
-# %uabracket User agent with format: [Mozilla/4.0 (compatible, ...)]
-# %uaquot User agent with format: "Mozilla/4.0 (compatible, ...)"
-# %ua User agent with format: Mozilla/4.0_(compatible...)
-# %gzipin mod_gzip compression input bytes: In:XXX
-# %gzipout mod_gzip compression output bytes & ratio: Out:YYY:ZZpct.
-# %gzipratio mod_gzip compression ratio: ZZpct.
-# %deflateratio mod_deflate compression ratio with format: (ZZ)
-# %email EMail sender (for mail log)
-# %email_r EMail receiver (for mail log)
-# %virtualname Web sever virtual hostname. Use this tag when same log
-# contains data of several virtual web servers. AWStats
-# will discard records not in SiteDomain nor HostAliases
-# %cluster If log file is provided from several computers (merged by
-# logresolvemerge.pl), use this to define cluster id field.
-# %extraX Another field that you plan to use for building a
-# personalized report with ExtraSection feature (See later).
-# If your log format has some fields not included in this list, use:
-# %other Means another not used field
-# %otherquot Means another not used double quoted field
-#
-# Examples for Apache combined logs (following two examples are equivalent):
-# LogFormat = 1
-# LogFormat = "%host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot"
-#
-# Example for IIS:
-# LogFormat = 2
-#
-LogFormat=1
-
-
-# If your log field's separator is not a space, you can change this parameter.
-# This parameter is not used if LogFormat is a predefined value (1,2,3,4)
-# Backslash can be used as escape character.
-# Example: " "
-# Example: "\t"
-# Example: "\|"
-# Example: ","
-# Default: " "
-#
-LogSeparator=" "
-
-
-# "SiteDomain" must contain the main domain name, or the main intranet web
-# server name, used to reach the web site.
-# If you share the same log file for several virtual web servers, this
-# parameter is used to tell AWStats to filter record that contains records for
-# this virtual host name only (So check that this virtual hostname can be
-# found in your log file and use a personalized log format that include the
-# %virtualname tag).
-# But for multi hosting a better solution is to have one log file for each
-# virtual web server. In this case, this parameter is only used to generate
-# full URL's links when ShowLinksOnUrl option is set to 1.
-# If analyzing mail log, enter here the domain name of mail server.
-# Example: "myintranetserver"
-# Example: "www.domain.com"
-# Example: "ftp.domain.com"
-# Example: "domain.com"
-#
-SiteDomain=""
-
-
-# Enter here all other possible domain names, addresses or virtual host
-# aliases someone can use to access your site. Try to keep only the minimum
-# number of possible names/addresses to have the best performances.
-# You can repeat the "SiteDomain" value in this list.
-# This parameter is used to analyze referer field in log file and to help
-# AWStats to know if a referer URL is a local URL of same site or an URL of
-# another site.
-# Note: Use space between each value.
-# Note: You can use regular expression values writing value with REGEX[value].
-# Note: You can also use @/mypath/myfile if list of aliases are in a file.
-# Example: "www.myserver.com localhost 127.0.0.1 REGEX[mydomain\.(net|org)$]"
-#
-HostAliases="localhost 127.0.0.1"
-
-
-# If you want to have hosts reported by name instead of ip address, AWStats
-# need to make reverse DNS lookups (if not already done in your log file).
-# With DNSLookup to 0, all hosts will be reported by their IP addresses and
-# not by the full hostname of visitors (except if names are already available
-# in log file).
-# If you want/need to set DNSLookup to 1, don't forget that this will reduce
-# dramatically AWStats update process speed. Do not use on large web sites.
-# Note: Reverse DNS lookup is done on IPv4 only (Enable ipv6 plugin for IPv6).
-# Note: Result of DNS Lookup can be used to build the Country report. However
-# it is highly recommanded to enable the plugin 'geoipfree' or 'geoip' to
-# have an accurate Country report with no need of DNS Lookup.
-# Possible values:
-# 0 - No DNS Lookup
-# 1 - DNS Lookup is fully enabled
-# 2 - DNS Lookup is made only from static DNS cache file (if it exists)
-# Default: 2
-#
-DNSLookup=1
-
-
-# When AWStats updates its statistics, it stores results of its analysis in
-# files (AWStats database). All those files are written in the directory
-# defined by the "DirData" parameter. Set this value to the directory where
-# you want AWStats to save its database and working files into.
-# Warning: If you want to be able to use the "AllowToUpdateStatsFromBrowser"
-# feature (see later), you need "Write" permissions by web server user on this
-# directory (and "Modify" for Windows NTFS file systems).
-# Example: "/var/lib/awstats"
-# Example: "../data"
-# Example: "C:/awstats_data_dir"
-# Default: "." (means same directory as awstats.pl)
-#
-DirData="/var/lib/awstats"
-
-
-# Relative or absolute web URL of your awstats cgi-bin directory.
-# This parameter is used only when AWStats is run from command line
-# with -output option (to generate links in HTML reported page).
-# Example: "/awstats"
-# Default: "/cgi-bin" (means awstats.pl is in "/yourwwwroot/cgi-bin")
-#
-DirCgi="/cgi-bin"
-
-
-# Relative or absolute web URL of your awstats icon directory.
-# If you build static reports ("... -output > outputpath/output.html"), enter
-# path of icon directory relative to the output directory 'outputpath'.
-# Example: "/awstatsicons"
-# Example: "../icon"
-# Default: "/icon" (means you must copy icon directories in "/mywwwroot/icon")
-#
-DirIcons="/awstats-icon"
-
-
-# When this parameter is set to 1, AWStats adds a button on report page to
-# allow to "update" statistics from a web browser. Warning, when "update" is
-# made from a browser, AWStats is run as a CGI by the web server user defined
-# in your web server (user "nobody" by default with Apache, "IUSR_XXX" with
-# IIS), so the "DirData" directory and all already existing history files
-# awstatsMMYYYY[.xxx].txt must be writable by this user. Change permissions if
-# necessary to "Read/Write" (and "Modify" for Windows NTFS file systems).
-# Warning: Update process can be long so you might experience "time out"
-# browser errors if you don't launch AWStats frequently enough.
-# When set to 0, update is only made when AWStats is run from the command
-# line interface (or a task scheduler).
-# Possible values: 0 or 1
-# Default: 0
-#
-AllowToUpdateStatsFromBrowser=0
-
-
-# AWStats saves and sorts its database on a month basis (except if using
-# databasebreak option from command line).
-# However, if you choose the -month=all from command line or
-# value '-Year-' from CGI combo form to have a report for all year, AWStats
-# needs to reload all data for full year (each month), and sort them,
-# requiring a large amount of time, memory and CPU. This might be a problem
-# for web hosting providers that offer AWStats for large sites, on shared
-# servers, to non CPU cautious customers.
-# For this reason, the 'full year' is only enabled on Command Line by default.
-# You can change this by setting this parameter to 0, 1, 2 or 3.
-# Possible values:
-# 0 - Never allowed
-# 1 - Allowed on CLI only, -Year- value in combo is not visible
-# 2 - Allowed on CLI only, -Year- value in combo is visible but not allowed
-# 3 - Possible on CLI and CGI
-# Default: 2
-#
-AllowFullYearView=2
-
-
-
-#-----------------------------------------------------------------------------
-# OPTIONAL SETUP SECTION (Not required but increase AWStats features)
-#-----------------------------------------------------------------------------
-
-# When the update process runs, AWStats can set a lock file in TEMP or TMP
-# directory. This lock is to avoid to have 2 update processes running at the
-# same time to prevent unknown conflicts problems and avoid DoS attacks when
-# AllowToUpdateStatsFromBrowser is set to 1.
-# Because, when you use lock file, you can experience sometimes problems in
-# lock file not correctly removed (killed process for example requires that
-# you remove the file manualy), this option is not enabled by default (Do
-# not enable this option with no console server access).
-# Change : Effective immediatly
-# Possible values: 0 or 1
-# Default: 0
-#
-EnableLockForUpdate=0
-
-
-# AWStats can do reverse DNS lookups through a static DNS cache file that was
-# previously created manually. If no path is given in static DNS cache file
-# name, AWStats will search DirData directory. This file is never changed.
-# This option is not used if DNSLookup=0.
-# Note: DNS cache file format is 'minsince1970 ipaddress resolved_hostname'
-# or just 'ipaddress resolved_hostname'
-# Change : Effective for new updates only
-# Example: "/mydnscachedir/dnscache"
-# Default: "dnscache.txt"
-#
-DNSStaticCacheFile="dnscache.txt"
-
-
-# AWStats can do reverse DNS lookups through a DNS cache file that was created
-# by a previous run of AWStats. This file is erased and recreated after each
-# statistics update process. You don't need to create and/or edit it.
-# AWStats will read and save this file in DirData directory.
-# This option is used only if DNSLookup=1.
-# Note: If a DNSStaticCacheFile is available, AWStats will check for DNS
-# lookup in DNSLastUpdateCacheFile after checking into DNSStaticCacheFile.
-# Change : Effective for new updates only
-# Example: "/mydnscachedir/dnscachelastupdate"
-# Default: "dnscachelastupdate.txt"
-#
-DNSLastUpdateCacheFile="dnscachelastupdate.txt"
-
-
-# You can specify specific IP addresses that should NOT be looked up in DNS.
-# This option is used only if DNSLookup=1.
-# Note: Use space between each value.
-# Note: You can use regular expression values writing value with REGEX[value].
-# Change : Effective for new updates only
-# Example: "123.123.123.123 REGEX[^192\.168\.]"
-# Default: ""
-#
-SkipDNSLookupFor=""
-
-
-# The following two parameters allow you to protect a config file from being
-# read by AWStats when called from a browser if web user has not been
-# authenticated. Your AWStats program must be in a web protected "realm" (With
-# Apache, you can use .htaccess files to do so. With other web servers, see
-# your server setup manual).
-# Change : Effective immediatly
-# Possible values: 0 or 1
-# Default: 0
-#
-AllowAccessFromWebToAuthenticatedUsersOnly=0
-
-
-# This parameter gives the list of all authorized authenticated users to view
-# statistics for this domain/config file. This parameter is used only if
-# AllowAccessFromWebToAuthenticatedUsersOnly is set to 1.
-# Change : Effective immediatly
-# Example: "user1 user2"
-# Example: "__REMOTE_USER__"
-# Default: ""
-#
-AllowAccessFromWebToFollowingAuthenticatedUsers=""
-
-
-# When this parameter is defined to something, the IP address of the user that
-# reads its statistics from a browser (when AWStats is used as a CGI) is
-# checked and must match one of the IP address values or ranges.
-# Change : Effective immediatly
-# Example: "127.0.0.1 123.123.123.1-123.123.123.255"
-# Default: ""
-#
-AllowAccessFromWebToFollowingIPAddresses=""
-
-
-# If the "DirData" directory (see above) does not exist, AWStats return an
-# error. However, you can ask AWStats to create it.
-# This option can be used by some Web Hosting Providers that has defined a
-# dynamic value for DirData (for example DirData="/home/__REMOTE_USER__") and
-# don't want to have to create a new directory each time they add a new user.
-# Change : Effective immediatly
-# Possible values: 0 or 1
-# Default: 0
-#
-CreateDirDataIfNotExists=0
-
-
-# You can choose in which format the Awstats history database is saved.
-# Note: Using "xml" format make AWStats building database files three times
-# larger than using "text" format.
-# Change : Database format is switched after next update
-# Possible values: text or xml
-# Default: text
-#
-BuildHistoryFormat=text
-
-
-# If you prefer having the report output pages be built as XML compliant pages
-# instead of simple HTML pages, you can set this to 'xhtml' (May not work
-# properly with old browsers).
-# Change : Effective immediatly
-# Possible values: html or xhtml
-# Default: html
-#
-BuildReportFormat=html
-
-
-# AWStats databases can be updated from command line of from a browser (when
-# used as a cgi program). So AWStats database files need write permission
-# for both command line user and default web server user (nobody for Unix,
-# IUSR_xxx for IIS/Windows,...).
-# To avoid permission problems between update process (run by an admin user)
-# and CGI process (ran by a low level user), AWStats can save its database
-# files with read and write permissions for everyone.
-# By default, AWStats keeps default user permissions on updated files. If you
-# set AllowToUpdateStatsFromBrowser to 1, you can change this parameter to 1.
-# Change : Effective for new updates only
-# Possible values: 0 or 1
-# Default: 0
-#
-SaveDatabaseFilesWithPermissionsForEveryone=0
-
-
-# AWStats can purge log file, after analyzing it. Note that AWStats is able
-# to detect new lines in a log file, to process only them, so you can launch
-# AWStats as often as you want, even with this parameter to 0.
-# With 0, no purge is made, so you must use a scheduled task or a web server
-# that make this purge frequently.
-# With 1, the purge of the log file is made each time AWStats update is run.
-# This parameter doesn't work with IIS (This web server doesn't let its log
-# file to be purged).
-# Change : Effective for new updates only
-# Possible values: 0 or 1
-# Default: 0
-#
-PurgeLogFile=0
-
-
-# When PurgeLogFile is setup to 1, AWStats will clean your log file after
-# processing it. You can however keep an archive file of all processed log
-# records by setting this parameter (For example if you want to use another
-# log analyzer). The archived log file is saved in "DirData" with name
-# awstats_archive.configname[.suffix].log
-# This parameter is not used if PurgeLogFile=0
-# Change : Effective for new updates only
-# Possible values: 0, 1, or tags (See LogFile parameter) for suffix
-# Example: 1
-# Example: %YYYY%MM%DD
-# Default: 0
-#
-ArchiveLogRecords=0
-
-
-# Each time you run the update process, AWStats overwrites the 'historic file'
-# for the month (awstatsMMYYYY[.*].txt) with the updated one.
-# When write errors occurs (IO, disk full,...), this historic file can be
-# corrupted and must be deleted. Because this file contains information of all
-# past processed log files, you will loose old stats if removed. So you can
-# ask AWStats to save last non corrupted file in a .bak file. This file is
-# stored in "DirData" directory with other 'historic files'.
-# Change : Effective for new updates only
-# Possible values: 0 or 1
-# Default: 0
-#
-KeepBackupOfHistoricFiles=0
-
-
-# Default index page name for your web server.
-# Change : Effective for new updates only
-# Example: "index.php index.html default.html"
-# Default: "index.html"
-#
-DefaultFile="index.html"
-
-
-# Do not include access from clients that match following criteria.
-# If your log file contains IP addresses in host field, you must enter here
-# matching IP addresses criteria.
-# If DNS lookup is already done in your log file, you must enter here hostname
-# criteria, else enter ip address criteria.
-# The opposite parameter of "SkipHosts" is "OnlyHosts".
-# Note: Use space between each value. This parameter is not case sensitive.
-# Note: You can use regular expression values writing value with REGEX[value].
-# Change : Effective for new updates only
-# Example: "127.0.0.1 REGEX[^192\.168\.] REGEX[^10\.]"
-# Example: "localhost REGEX[^.*\.localdomain$]"
-# Default: ""
-#
-SkipHosts=""
-
-
-# Do not include access from clients with a user agent that match following
-# criteria. If you want to exclude a robot, you should update the robots.pm
-# file instead of this parameter.
-# The opposite parameter of "SkipUserAgents" is "OnlyUserAgents".
-# Note: Use space between each value. This parameter is not case sensitive.
-# Note: You can use regular expression values writing value with REGEX[value].
-# Change : Effective for new updates only
-# Example: "konqueror REGEX[ua_test_v\d\.\d]"
-# Default: ""
-#
-SkipUserAgents=""
-
-
-# Use SkipFiles to ignore access to URLs that match one of following entries.
-# You can enter a list of not important URLs (like framed menus, hidden pages,
-# etc...) to exclude them from statistics. You must enter here exact relative
-# URL as found in log file, or a matching REGEX value. Check apply on URL with
-# all its query paramaters.
-# For example, to ignore /badpage.php, just add "/badpage.php". To ignore all
-# pages in a particular directory, add "REGEX[^\/directorytoexclude]".
-# The opposite parameter of "SkipFiles" is "OnlyFiles".
-# Note: Use space between each value. This parameter is or not case sensitive
-# depending on URLNotCaseSensitive parameter.
-# Note: You can use regular expression values writing value with REGEX[value].
-# Change : Effective for new updates only
-# Example: "/badpage.php /page.php?param=x REGEX[^\/excludedirectory]"
-# Default: ""
-#
-SkipFiles=""
-
-
-# Use SkipReferrersBlackList if you want to exclude records coming from a SPAM
-# referrer. Parameter must receive a local file name containing rules applied
-# on referrer field. If parameter is empty, no filter is applied.
-# An example of such a file is available in lib/blacklist.txt
-# You can download updated version at http://www.jayallen.org/comment_spam/
-# Change : Effective for new updates only
-# Example: "/mylibpath/blacklist.txt"
-# Default: ""
-#
-# WARNING!! Using this feature make AWStats running very slower (5 times slower
-# with black list file provided with AWStats !
-#
-SkipReferrersBlackList=""
-
-
-# Include in stats, only accesses from hosts that match one of following
-# entries. For example, if you want AWStats to filter access to keep only
-# stats for visits from particular hosts, you can add those host names in
-# this parameter.
-# If DNS lookup is already done in your log file, you must enter here hostname
-# criteria, else enter ip address criteria.
-# The opposite parameter of "OnlyHosts" is "SkipHosts".
-# Note: Use space between each value. This parameter is not case sensitive.
-# Note: You can use regular expression values writing value with REGEX[value].
-# Change : Effective for new updates only
-# Example: "127.0.0.1 REGEX[^192\.168\.] REGEX[^10\.]"
-# Default: ""
-#
-OnlyHosts=""
-
-
-# Include in stats, only accesses from user agent that match one of following
-# entries. For example, if you want AWStats to filter access to keep only
-# stats for visits from particular browsers, you can add their user agents
-# string in this parameter.
-# The opposite parameter of "OnlyUserAgents" is "SkipUserAgents".
-# Note: Use space between each value. This parameter is not case sensitive.
-# Note: You can use regular expression values writing value with REGEX[value].
-# Change : Effective for new updates only
-# Example: "msie"
-# Default: ""
-#
-OnlyUserAgents=""
-
-
-# Include in stats, only accesses to URLs that match one of following entries.
-# For example, if you want AWStats to filter access to keep only stats that
-# match a particular string, like a particular directory, you can add this
-# directory name in this parameter.
-# The opposite parameter of "OnlyFiles" is "SkipFiles".
-# Note: Use space between each value. This parameter is or not case sensitive
-# depending on URLNotCaseSensitive parameter.
-# Note: You can use regular expression values writing value with REGEX[value].
-# Change : Effective for new updates only
-# Example: "REGEX[marketing_directory] REGEX[office\/.*\.(csv|sxw)$]"
-# Default: ""
-#
-OnlyFiles=""
-
-
-# Add here a list of kind of url (file extension) that must be counted as
-# "Hit only" and not as a "Hit" and "Page/Download". You can set here all
-# image extensions as they are hit downloaded that must be counted but they
-# are not viewed pages. URLs with such extensions are not included in the TOP
-# Pages/URL report.
-# Note: If you want to exclude particular URLs from stats (No Pages and no
-# Hits reported), you must use SkipFiles parameter.
-# Change : Effective for new updates only
-# Example: "css js class gif jpg jpeg png bmp ico zip arj gz z wav mp3 wma mpg"
-# Example: ""
-# Default: "css js class gif jpg jpeg png bmp ico"
-#
-NotPageList="css js class gif jpg jpeg png bmp ico swf"
-
-
-# By default, AWStats considers that records found in web log file are
-# successful hits if HTTP code returned by server is a valid HTTP code (200
-# and 304). Any other code are reported in HTTP status chart.
-# Note that HTTP 'control codes', like redirection (302, 305) are not added by
-# default in this list as they are not pages seen by a visitor but are
-# protocol exchange codes to tell the browser to ask another page. Because
-# this other page will be counted and seen with a 200 or 304 code, if you
-# add such codes, you will have 2 pages viewed reported for only one in facts.
-# Change : Effective for new updates only
-# Example: "200 304 302 305"
-# Default: "200 304"
-#
-ValidHTTPCodes="200 304"
-
-
-# By default, AWStats considers that records found in mail log file are
-# successful mail transfers if field that represent return code in analyzed
-# log file match values defined by this parameter.
-# Change : Effective for new updates only
-# Example: "1 250 200"
-# Default: "1 250"
-#
-ValidSMTPCodes="1 250"
-
-
-# Some web servers on some Operating systems (IIS-Windows) consider that a
-# login with same value but different case are the same login. To tell AWStats
-# to also consider them as one, set this parameter to 1.
-# Change : Effective for new updates only
-# Possible values: 0 or 1
-# Default: 0
-#
-AuthenticatedUsersNotCaseSensitive=0
-
-
-# Some web servers on some Operating systems (IIS-Windows) considers that two
-# URLs with same value but different case are the same URL. To tell AWStats to
-# also considers them as one, set this parameter to 1.
-# Change : Effective for new updates only
-# Possible values: 0 or 1
-# Default: 0
-#
-URLNotCaseSensitive=0
-
-
-# Keep or remove the anchor string you can find in some URLs.
-# Change : Effective for new updates only
-# Possible values: 0 or 1
-# Default: 0
-#
-URLWithAnchor=0
-
-
-# In URL links, "?" char is used to add parameter's list in URLs. Syntax is:
-# /mypage.html?param1=value1¶m2=value2
-# However, some servers/sites use also other chars to isolate dynamic part of
-# their URLs. You can complete this list with all such characters.
-# Change : Effective for new updates only
-# Example: "?;,"
-# Default: "?;"
-#
-URLQuerySeparators="?;"
-
-
-# Keep or remove the query string to the URL in the statistics for individual
-# pages. This is primarily used to differentiate between the URLs of dynamic
-# pages. If set to 1, mypage.html?id=x and mypage.html?id=y are counted as two
-# different pages.
-# Warning, when set to 1, memory required to run AWStats is dramatically
-# increased if you have a lot of changing URLs (for example URLs with a random
-# id inside). Such web sites should not set this option to 1 or use seriously
-# the next parameter URLWithQueryWithOnlyFollowingParameters (or eventually
-# URLWithQueryWithoutFollowingParameters).
-# Change : Effective for new updates only
-# Possible values:
-# 0 - URLs are cleaned from the query string (ie: "/mypage.html")
-# 1 - Full URL with query string is used (ie: "/mypage.html?p=x&q=y")
-# Default: 0
-#
-URLWithQuery=0
-
-
-# When URLWithQuery is on, you will get the full URL with all parameters in
-# URL reports. But among thoose parameters, sometimes you don't need a
-# particular parameter because it does not identify the page or because it's
-# a random ID changing for each access even if URL points to same page. In
-# such cases, it is higly recommanded to ask AWStats to keep only parameters
-# you need (if you know them) before counting, manipulating and storing URL.
-# Enter here list of wanted parameters. For example, with "param", one hit on
-# /mypage.cgi?param=abc&id=Yo4UomP9d and /mypage.cgi?param=abc&id=Mu8fdxl3r
-# will be reported as 2 hits on /mypage.cgi?param=abc
-# This parameter is not used when URLWithQuery is 0 and can't be used with
-# URLWithQueryWithoutFollowingParameters.
-# Change : Effective for new updates only
-# Example: "param"
-# Default: ""
-#
-URLWithQueryWithOnlyFollowingParameters=""
-
-
-# When URLWithQuery is on, you will get the full URL with all parameters in
-# URL reports. But among thoose parameters, sometimes you don't need a
-# particular parameter because it does not identify the page or because it's
-# a random ID changing for each access even if URL points to same page. In
-# such cases, it is higly recommanded to ask AWStats to remove such parameters
-# from the URL before counting, manipulating and storing URL. Enter here list
-# of all non wanted parameters. For example if you enter "id", one hit on
-# /mypage.cgi?param=abc&id=Yo4UomP9d and /mypage.cgi?param=abc&id=Mu8fdxl3r
-# will be reported as 2 hits on /mypage.cgi?param=abc
-# This parameter is not used when URLWithQuery is 0 and can't be used with
-# URLWithQueryWithOnlyFollowingParameters.
-# Change : Effective for new updates only
-# Example: "PHPSESSID jsessionid"
-# Default: ""
-#
-URLWithQueryWithoutFollowingParameters=""
-
-
-# Keep or remove the query string to the referrer URL in the statistics for
-# external referrer pages. This is used to differentiate between the URLs of
-# dynamic referrer pages. If set to 1, mypage.html?id=x and mypage.html?id=y
-# are counted as two different referrer pages.
-# Change : Effective for new updates only
-# Possible values:
-# 0 - Referrer URLs are cleaned from the query string (ie: "/mypage.html")
-# 1 - Full URL with query string is used (ie: "/mypage.html?p=x&q=y")
-# Default: 0
-#
-URLReferrerWithQuery=0
-
-
-# AWStats can detect setup problems or show you important informations to have
-# a better use. Keep this to 1, except if AWStats says you can change it.
-# Change : Effective immediatly
-# Possible values: 0 or 1
-# Default: 1
-#
-WarningMessages=1
-
-
-# When an error occurs, AWStats outputs a message related to errors. If you
-# want (in most cases for security reasons) to have no error messages, you
-# can set this parameter to your personalized generic message.
-# Change : Effective immediatly
-# Example: "An error occurred. Contact your Administrator"
-# Default: ""
-#
-ErrorMessages=""
-
-
-# AWStat can be run with debug=x parameter to output various informations
-# to help in debugging or solving troubles. If you want to allow this (not
-# enabled by default for security reasons), set this parameter to 0.
-# Change : Effective immediatly
-# Possible values: 0 or 1
-# Default: 0
-#
-DebugMessages=0
-
-
-# To help you to detect if your log format is good, AWStats reports an error
-# if all the first NbOfLinesForCorruptedLog lines have a format that does not
-# match the LogFormat parameter.
-# However, some worm virus attack on your web server can result in a very high
-# number of corrupted lines in your log. So if you experience awstats stop
-# because of bad virus records at the beginning of your log file, you can
-# increase this parameter (very rare).
-# Change : Effective for new updates only
-# Default: 50
-#
-NbOfLinesForCorruptedLog=50
-
-
-# For some particular integration needs, you may want to have CGI links to
-# point to another script than awstats.pl.
-# Use the name of this script in WrapperScript parameter.
-# Change : Effective immediatly
-# Example: "awstatslauncher.pl"
-# Default: ""
-#
-WrapperScript=""
-
-
-# DecodeUA must be set to 1 if you use Roxen web server. This server converts
-# all spaces in user agent field into %20. This make the AWStats robots, OS
-# and browsers detection fail in some cases. Just change it to 1 if and only
-# if your web server is Roxen.
-# Change : Effective for new updates only
-# Possible values: 0 or 1
-# Default: 0
-#
-DecodeUA=0
-
-
-# MiscTrackerUrl can be used to make AWStats able to detect some miscellaneous
-# things, that can not be tracked on other way, like:
-# - Javascript disabled
-# - Java enabled
-# - Screen size
-# - Color depth
-# - Macromedia Director plugin
-# - Macromedia Shockwave plugin
-# - Realplayer G2 plugin
-# - QuickTime plugin
-# - Mediaplayer plugin
-# - Acrobat PDF plugin
-# To enable all these features, you must copy the awstats_misc_tracker.js file
-# into a /js/ directory stored in your web document root and add the following
-# HTML code at the end of your index page (but before </BODY>) :
-#
-# <script language=javascript src="/js/awstats_misc_tracker.js"></script>
-# <noscript><img src="/js/awstats_misc_tracker.js?nojs=y" height=0 width=0 border=0 style="display: none"></noscript>
-#
-# If code is not added in index page, all those detection capabilities will be
-# disabled. You must also check that ShowScreenSizeStats and ShowMiscStats
-# parameters are set to 1 to make results appear in AWStats report page.
-# If you want to use another directory than /js/, you must also change the
-# awstatsmisctrackerurl variable into the awstats_misc_tracker.js file.
-# Change : Effective for new updates only.
-# Possible value: URL of javascript tracker file added in your HTML code.
-# Default: "/js/awstats_misc_tracker.js"
-#
-MiscTrackerUrl="/js/awstats_misc_tracker.js"
-
-
-
-#-----------------------------------------------------------------------------
-# OPTIONAL ACCURACY SETUP SECTION (Not required but increase AWStats features)
-#-----------------------------------------------------------------------------
-
-# The following values allow you to define accuracy of AWStats entities
-# (robots, browsers, os, referers, file types) detection.
-# It might be a good idea for large web sites or ISP that provides AWStats to
-# high number of customers, to set this parameter to 1 (or 0), instead of 2.
-# Possible values:
-# 0 = No detection,
-# 1 = Medium/Standard detection
-# 2 = Full detection
-# Change : Effective for new updates only
-# Note : LevelForBrowsersDetection can also accept value "allphones". This
-# enable detailed detection of phone/pda browsers.
-# Default: 2 (0 for LevelForWormsDetection)
-#
-LevelForBrowsersDetection=2 # 0 disables Browsers detection.
- # 2 reduces AWStats speed by 2%
- # allphones reduces AWStats speed by 5%
-LevelForOSDetection=2 # 0 disables OS detection.
- # 2 reduces AWStats speed by 3%
-LevelForRefererAnalyze=2 # 0 disables Origin detection.
- # 2 reduces AWStats speed by 14%
-LevelForRobotsDetection=2 # 0 disables Robots detection.
- # 2 reduces AWStats speed by 2.5%
-LevelForSearchEnginesDetection=2 # 0 disables Search engines detection.
- # 2 reduces AWStats speed by 9%
-LevelForKeywordsDetection=2 # 0 disables Keyphrases/Keywords detection.
- # 2 reduces AWStats speed by 1%
-LevelForFileTypesDetection=2 # 0 disables File types detection.
- # 2 reduces AWStats speed by 1%
-LevelForWormsDetection=0 # 0 disables Worms detection.
- # 2 reduces AWStats speed by 15%
-
-
-
-#-----------------------------------------------------------------------------
-# OPTIONAL APPEARANCE SETUP SECTION (Not required but increase AWStats features)
-#-----------------------------------------------------------------------------
-
-# When you use AWStats as a CGI, you can have the reports shown in HTML frames.
-# Frames are only available for report viewed dynamically. When you build
-# pages from command line, this option is not used and no frames are built.
-# Possible values: 0 or 1
-# Default: 1
-#
-UseFramesWhenCGI=1
-
-
-# This parameter asks your browser to open detailed reports into a different
-# window than the main page.
-# Possible values:
-# 0 - Open all in same browser window
-# 1 - Open detailed reports in another window except if using frames
-# 2 - Open always in a different window even if reports are framed
-# Default: 1
-#
-DetailedReportsOnNewWindows=1
-
-
-# You can add, in the HTML report page, a cache lifetime (in seconds) that
-# will be returned to the browser in HTTP header answer by server.
-# This parameter is not used when reports are built with -staticlinks option.
-# Example: 3600
-# Default: 0
-#
-Expires=0
-
-
-# To avoid too large web pages, you can ask AWStats to limit number of rows of
-# all reported charts to this number when no other limits apply.
-# Default: 1000
-#
-MaxRowsInHTMLOutput=1000
-
-
-# Set your primary language (ISO-639-1 language codes).
-# Possible values:
-# Albanian=al, Bosnian=ba, Bulgarian=bg, Catalan=ca,
-# Chinese (Taiwan)=tw, Chinese (Simpliefied)=cn, Croatian=hr, Czech=cz,
-# Danish=dk, Dutch=nl, English=en, Estonian=et, Euskara=eu, Finnish=fi,
-# French=fr, Galician=gl, German=de, Greek=gr, Hebrew=he, Hungarian=hu,
-# Icelandic=is, Indonesian=id, Italian=it, Japanese=jp, Korean=ko,
-# Latvian=lv, Norwegian (Nynorsk)=nn, Norwegian (Bokmal)=nb, Polish=pl,
-# Portuguese=pt, Portuguese (Brazilian)=br, Romanian=ro, Russian=ru,
-# Serbian=sr, Slovak=sk, Slovenian=si, Spanish=es, Swedish=se, Turkish=tr,
-# Ukrainian=ua, Welsh=cy.
-# First available language accepted by browser=auto
-# Default: "auto"
-#
-Lang="auto"
-
-
-# Set the location of language files.
-# Example: "/usr/share/awstats/lang"
-# Default: "./lang" (means lang directory is in same location than awstats.pl)
-#
-DirLang="/usr/share/awstats/lang"
-
-
-# Show menu header with reports' links
-# Possible values: 0 or 1
-# Default: 1
-#
-ShowMenu=1
-
-
-# You choose here which reports you want to see in the main page and what you
-# want to see in those reports.
-# Possible values:
-# 0 - Report is not shown at all
-# 1 - Report is shown in main page with an entry in menu and default columns
-# XYZ - Report shows column informations defined by code X,Y,Z...
-# X,Y,Z... are code letters among the following:
-# U = Unique visitors
-# V = Visits
-# P = Number of pages
-# H = Number of hits (or mails)
-# B = Bandwith (or total mail size for mail logs)
-# L = Last access date
-# E = Entry pages
-# X = Exit pages
-# C = Web compression (mod_gzip,mod_deflate)
-# M = Average mail size (mail logs)
-#
-
-# Show monthly summary
-# Context: Web, Streaming, Mail, Ftp
-# Default: UVPHB, Possible column codes: UVPHB
-ShowSummary=UVPHB
-
-# Show monthly chart
-# Context: Web, Streaming, Mail, Ftp
-# Default: UVPHB, Possible column codes: UVPHB
-ShowMonthStats=UVPHB
-
-# Show days of month chart
-# Context: Web, Streaming, Mail, Ftp
-# Default: VPHB, Possible column codes: VPHB
-ShowDaysOfMonthStats=VPHB
-
-# Show days of week chart
-# Context: Web, Streaming, Mail, Ftp
-# Default: PHB, Possible column codes: PHB
-ShowDaysOfWeekStats=PHB
-
-# Show hourly chart
-# Context: Web, Streaming, Mail, Ftp
-# Default: PHB, Possible column codes: PHB
-ShowHoursStats=PHB
-
-# Show domains/country chart
-# Context: Web, Streaming, Mail, Ftp
-# Default: PHB, Possible column codes: PHB
-ShowDomainsStats=PHB
-
-# Show hosts chart
-# Context: Web, Streaming, Mail, Ftp
-# Default: PHBL, Possible column codes: PHBL
-ShowHostsStats=PHBL
-
-# Show authenticated users chart
-# Context: Web, Streaming, Ftp
-# Default: 0, Possible column codes: PHBL
-ShowAuthenticatedUsers=0
-
-# Show robots chart
-# Context: Web, Streaming
-# Default: HBL, Possible column codes: HBL
-ShowRobotsStats=HBL
-
-# Show worms chart
-# Context: Web, Streaming
-# Default: 0 (If set to other than 0, see also LevelForWormsDetection), Possible column codes: HBL
-ShowWormsStats=0
-
-# Show email senders chart (For use when analyzing mail log files)
-# Context: Mail
-# Default: 0, Possible column codes: HBML
-ShowEMailSenders=0
-
-# Show email receivers chart (For use when analyzing mail log files)
-# Context: Mail
-# Default: 0, Possible column codes: HBML
-ShowEMailReceivers=0
-
-# Show session chart
-# Context: Web, Streaming, Ftp
-# Default: 1, Possible column codes: None
-ShowSessionsStats=1
-
-# Show pages-url chart.
-# Context: Web, Streaming, Ftp
-# Default: PBEX, Possible column codes: PBEX
-ShowPagesStats=PBEX
-
-# Show file types chart.
-# Context: Web, Streaming, Ftp
-# Default: HB, Possible column codes: HBC
-ShowFileTypesStats=HB
-
-# Show file size chart (Not yet available)
-# Context: Web, Streaming, Mail, Ftp
-# Default: 1, Possible column codes: None
-ShowFileSizesStats=0
-
-# Show operating systems chart
-# Context: Web, Streaming, Ftp
-# Default: 1, Possible column codes: None
-ShowOSStats=1
-
-# Show browsers chart
-# Context: Web, Streaming
-# Default: 1, Possible column codes: None
-ShowBrowsersStats=1
-
-# Show screen size chart
-# Context: Web, Streaming
-# Default: 0 (If set to 1, see also MiscTrackerUrl), Possible column codes: None
-ShowScreenSizeStats=0
-
-# Show origin chart
-# Context: Web, Streaming
-# Default: PH, Possible column codes: PH
-ShowOriginStats=PH
-
-# Show keyphrases chart
-# Context: Web, Streaming
-# Default: 1, Possible column codes: None
-ShowKeyphrasesStats=1
-
-# Show keywords chart
-# Context: Web, Streaming
-# Default: 1, Possible column codes: None
-ShowKeywordsStats=1
-
-# Show misc chart
-# Context: Web, Streaming
-# Default: a (See also MiscTrackerUrl parameter), Possible column codes: anjdfrqwp
-ShowMiscStats=a
-
-# Show http errors chart
-# Context: Web, Streaming
-# Default: 1, Possible column codes: None
-ShowHTTPErrorsStats=1
-
-# Show smtp errors chart (For use when analyzing mail log files)
-# Context: Mail
-# Default: 0, Possible column codes: None
-ShowSMTPErrorsStats=0
-
-# Show the cluster report (Your LogFormat must contains the %cluster tag)
-# Context: Web, Streaming, Ftp
-# Default: 0, Possible column codes: PHB
-ShowClusterStats=0
-
-
-# Some graphical reports are followed by the data array of values.
-# If you don't want this array (to reduce the report size for example), you
-# can set thoose options to 0.
-# Possible values: 0 or 1
-# Default: 1
-#
-# Data array values for the ShowMonthStats report
-AddDataArrayMonthStats=1
-# Data array values for the ShowDaysOfMonthStats report
-AddDataArrayShowDaysOfMonthStats=1
-# Data array values for the ShowDaysOfWeekStats report
-AddDataArrayShowDaysOfWeekStats=1
-# Data array values for the ShowHoursStats report
-AddDataArrayShowHoursStats=1
-
-
-# In the Origin chart, you have stats on where your hits came from. You can
-# include hits on pages that come from pages of same sites in this chart.
-# Possible values: 0 or 1
-# Default: 0
-#
-IncludeInternalLinksInOriginSection=0
-
-
-# The following parameters can be used to choose the maximum number of lines
-# shown for the particular following reports.
-#
-# Stats by countries/domains
-MaxNbOfDomain = 10
-MinHitDomain = 1
-# Stats by hosts
-MaxNbOfHostsShown = 10
-MinHitHost = 1
-# Stats by authenticated users
-MaxNbOfLoginShown = 10
-MinHitLogin = 1
-# Stats by robots
-MaxNbOfRobotShown = 10
-MinHitRobot = 1
-# Stats by pages
-MaxNbOfPageShown = 10
-MinHitFile = 1
-# Stats by OS
-MaxNbOfOsShown = 10
-MinHitOs = 1
-# Stats by browsers
-MaxNbOfBrowsersShown = 10
-MinHitBrowser = 1
-# Stats by screen size
-MaxNbOfScreenSizesShown = 5
-MinHitScreenSize = 1
-# Stats by window size (following 2 parameters are not yet used)
-MaxNbOfWindowSizesShown = 5
-MinHitWindowSize = 1
-# Stats by referers
-MaxNbOfRefererShown = 10
-MinHitRefer = 1
-# Stats for keyphrases
-MaxNbOfKeyphrasesShown = 10
-MinHitKeyphrase = 1
-# Stats for keywords
-MaxNbOfKeywordsShown = 10
-MinHitKeyword = 1
-# Stats for sender or receiver emails
-MaxNbOfEMailsShown = 20
-MinHitEMail = 1
-
-
-# Choose if you want the week report to start on sunday or monday
-# Possible values:
-# 0 - Week starts on sunday
-# 1 - Week starts on monday
-# Default: 1
-#
-FirstDayOfWeek=1
-
-
-# List of visible flags that link to other language translations.
-# See Lang parameter for list of allowed flag/language codes.
-# If you don't want any flag link, set ShowFlagLinks to "".
-# This parameter is used only if ShowMenu parameter is set to 1.
-# Possible values: "" or "language_codes_separated_by_space"
-# Example: "en es fr nl de"
-# Default: ""
-#
-ShowFlagLinks=""
-
-
-# Each URL, shown in stats report views, are links you can click.
-# Possible values: 0 or 1
-# Default: 1
-#
-ShowLinksOnUrl=1
-
-
-# When AWStats builds HTML links in its report pages, it starts those links
-# with "http://". However some links might be HTTPS links, so you can enter
-# here the root of all your HTTPS links. If all your site is a SSL web site,
-# just enter "/".
-# This parameter is not used if ShowLinksOnUrl is 0.
-# Example: "/shopping"
-# Example: "/"
-# Default: ""
-#
-UseHTTPSLinkForUrl=""
-
-
-# Maximum length of URL part shown on stats page (number of characters).
-# This affects only URL visible text, links still work.
-# Default: 64
-#
-MaxLengthOfShownURL=64
-
-
-# You can enter HTML code that will be added at the top of AWStats reports.
-# Default: ""
-#
-HTMLHeadSection=""
-
-
-# You can enter HTML code that will be added at the end of AWStats reports.
-# Great to add advert ban.
-# Default: ""
-#
-HTMLEndSection=""
-
-
-# You can set Logo and LogoLink to use your own logo.
-# Logo must be the name of image file (must be in $DirIcons/other directory).
-# LogoLink is the expected URL when clicking on Logo.
-# Default: "awstats_logo6.png"
-#
-Logo="awstats_logo6.png"
-LogoLink="http://awstats.sourceforge.net"
-
-
-# Value of maximum bar width/height for horizontal/vertical HTML graphics bars.
-# Default: 260/90
-#
-BarWidth = 260
-BarHeight = 90
-
-
-# You can ask AWStats to use a particular CSS (Cascading Style Sheet) to
-# change its look. To create a style sheet, you can use samples provided with
-# AWStats in wwwroot/css directory.
-# Example: "/awstatscss/awstats_bw.css"
-# Example: "/css/awstats_bw.css"
-# Default: ""
-#
-StyleSheet=""
-
-
-# Those color parameters can be used (if StyleSheet parameter is not used)
-# to change AWStats look.
-# Example: color_name="RRGGBB" # RRGGBB is Red Green Blue components in Hex
-#
-color_Background="FFFFFF" # Background color for main page (Default = "FFFFFF")
-color_TableBGTitle="CCCCDD" # Background color for table title (Default = "CCCCDD")
-color_TableTitle="000000" # Table title font color (Default = "000000")
-color_TableBG="CCCCDD" # Background color for table (Default = "CCCCDD")
-color_TableRowTitle="FFFFFF" # Table row title font color (Default = "FFFFFF")
-color_TableBGRowTitle="ECECEC" # Background color for row title (Default = "ECECEC")
-color_TableBorder="ECECEC" # Table border color (Default = "ECECEC")
-color_text="000000" # Color of text (Default = "000000")
-color_textpercent="606060" # Color of text for percent values (Default = "606060")
-color_titletext="000000" # Color of text title within colored Title Rows (Default = "000000")
-color_weekend="EAEAEA" # Color for week-end days (Default = "EAEAEA")
-color_link="0011BB" # Color of HTML links (Default = "0011BB")
-color_hover="605040" # Color of HTML on-mouseover links (Default = "605040")
-color_u="FFAA66" # Background color for number of unique visitors (Default = "FFAA66")
-color_v="F4F090" # Background color for number of visites (Default = "F4F090")
-color_p="4477DD" # Background color for number of pages (Default = "4477DD")
-color_h="66DDEE" # Background color for number of hits (Default = "66DDEE")
-color_k="2EA495" # Background color for number of bytes (Default = "2EA495")
-color_s="8888DD" # Background color for number of search (Default = "8888DD")
-color_e="CEC2E8" # Background color for number of entry pages (Default = "CEC2E8")
-color_x="C1B2E2" # Background color for number of exit pages (Default = "C1B2E2")
-
-
-
-#-----------------------------------------------------------------------------
-# PLUGINS
-#-----------------------------------------------------------------------------
-
-# Add here all plugin files you want to load.
-# Plugin files must be .pm files stored in 'plugins' directory.
-# Uncomment LoadPlugin lines to enable a plugin after checking that perl
-# modules required by the plugin are installed.
-
-# Plugin: Tooltips
-# Perl modules required: None
-# Add some tooltips help on HTML report pages.
-# Note that enabling this kind of help will increased HTML report pages size,
-# so server load and bandwidth.
-#
-#LoadPlugin="tooltips"
-
-# Plugin: DecodeUTFKeys
-# Perl modules required: Encode and URI::Escape
-# Allow AWStats to show correctly (in language charset) keywords/keyphrases
-# strings even if they were UTF8 coded by the referer search engine.
-#
-#LoadPlugin="decodeutfkeys"
-
-# Plugin: IPv6
-# Perl modules required: Net::IP and Net::DNS
-# This plugin gives AWStats capability to make reverse DNS lookup on IPv6
-# addresses.
-# Note: If you are interested in having country report, you should use the
-# geoipfree or geoip plugin instead of enabled reverse DNS lookup.
-#
-#LoadPlugin="ipv6"
-
-# Plugin: HashFiles
-# Perl modules required: Storable
-# AWStats DNS cache files are read/saved as native hash files. This increases
-# DNS cache files loading speed, above all for very large web sites.
-#
-LoadPlugin="hashfiles"
-
-# Plugin: GeoIP
-# Perl modules required: Geo::IP or Geo::IP::PurePerl (from Maxmind)
-# Country chart is built from an Internet IP-Country database.
-# This plugin is useless for intranet only log files.
-# Note: You must choose between using this plugin (need Perl Geo::IP module
-# from Maxmind, database more up to date) or the GeoIPfree plugin (need
-# Perl Geo::IPfree module, database less up to date).
-# This plugin reduces AWStats speed of 8% !
-#
-#LoadPlugin="geoip GEOIP_STANDARD /pathto/GeoIP.dat"
-
-# Plugin: GeoIPfree
-# Perl modules required: Geo::IPfree version 0.2+ (from Graciliano M.P.)
-# Country chart is built from an Internet IP-Country database.
-# This plugin is useless for intranet only log files.
-# Note: You must choose between using this plugin (need Perl Geo::IPfree
-# module, database less up to date) or the GeoIP plugin (need Perl Geo::IP
-# module from Maxmind, database more up to date).
-# Note: Activestate provide a corrupted version of Geo::IPfree 0.2 Perl
-# module, so install it from elsewhere (from www.cpan.org for example).
-# This plugin reduces AWStats speed of 10% !
-#
-#LoadPlugin="geoipfree"
-
-# Plugin: GeoIP_Region_Maxmind
-# Perl modules required: Geo::IP (from Maxmind)
-# This plugin add a chart of hits by regions. Only regions for US and
-# Canada can be detected.
-# Note: This plugin need Maxmind GeoIP Perl module AND the region database.
-# Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
-# on Windows but it works great on Linux with default Perl.
-# You need to purchase a license from Maxmind to get/use the Region database.
-# This plugin reduces AWStats speed.
-#
-#LoadPlugin="geoip_region_maxmind GEOIP_STANDARD /pathto/GeoIPRegion.dat"
-
-# Plugin: GeoIP_City_Maxmind
-# Perl modules required: Geo::IP (from Maxmind)
-# This plugin add a chart of hits by cities (with country and regions
-# informations for major countries).
-# Note: This plugin need Maxmind GeoIP Perl module AND the city database.
-# Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
-# on Windows but it works great on Linux with default Perl.
-# You need to purchase a license from Maxmind to get/use the City database.
-# This plugin reduces AWStats speed.
-#
-#LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /pathto/GeoIPCity.dat"
-
-# Plugin: GeoIP_ISP_Maxmind
-# Perl modules required: Geo::IP (from Maxmind)
-# This plugin add a chart of hits by ISP.
-# Note: This plugin need Maxmind GeoIP Perl module AND the ISP database.
-# Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
-# on Windows but it works great on Linux with default Perl.
-# You need to purchase a license from Maxmind to get/use the ISP database.
-# This plugin reduces AWStats speed.
-#
-#LoadPlugin="geoip_isp_maxmind GEOIP_STANDARD /pathto/GeoIPISP.dat"
-
-# Plugin: GeoIP_Org_Maxmind
-# Perl modules required: Geo::IP (from Maxmind)
-# This plugin add a chart of hits by Organization name
-# Note: This plugin need Maxmind GeoIP Perl module AND the Org database.
-# Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
-# on Windows but it works great on Linux with default Perl.
-# You need to purchase a license from Maxmind to get/use the Org database.
-# This plugin reduces AWStats speed.
-#
-#LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /pathto/GeoIPOrg.dat"
-
-# Plugin: UserInfo
-# Perl modules required: None
-# Add a text (Firtname, Lastname, Office Department, ...) in authenticated user
-# reports for each login value.
-# A text file called userinfo.myconfig.txt, with two fields (first is login,
-# second is text to show, separated by a tab char) must be created in DirData
-# directory.
-#
-#LoadPlugin="userinfo"
-
-# Plugin: HostInfo
-# Perl modules required: Net::XWhois
-# Add a column into host chart with a link to open a popup window that shows
-# info on host (like whois records).
-#
-#LoadPlugin="hostinfo"
-
-# Plugin: ClusterInfo
-# Perl modules required: None
-# Add a text (for example a full hostname) in cluster reports for each cluster
-# number.
-# A text file called clusterinfo.myconfig.txt, with two fields (first is
-# cluster number, second is text to show) separated by a tab char. must be
-# created into DirData directory.
-# Note this plugin is useless if ShowClusterStats is set to 0 or if you don't
-# use a personalized log format that contains %cluster tag.
-#
-#LoadPlugin="clusterinfo"
-
-# Plugin: UrlAliases
-# Perl modules required: None
-# Add a text (Page title, description...) in URL reports before URL value.
-# A text file called urlalias.myconfig.txt, with two fields (first is URL,
-# second is text to show, separated by a tab char) must be created into
-# DirData directory.
-#
-#LoadPlugin="urlalias"
-
-# Plugin: TimeHiRes
-# Perl modules required: Time::HiRes (if Perl < 5.8)
-# Time reported by -showsteps option is in millisecond. For debug purpose.
-#
-#LoadPlugin="timehires"
-
-# Plugin: TimeZone
-# Perl modules required: Time::Local
-# Allow AWStats to correct a bad timezone for user of some IIS that use
-# GMT date in its log instead of local server time.
-# This module is useless for Apache and most IIS version.
-# This plugin reduces AWStats speed of 40% !!!!!!!
-#
-#LoadPlugin="timezone +2"
-
-# Plugin: Rawlog
-# Perl modules required: None
-# This plugin adds a form in AWStats main page to allow users to see raw
-# content of current log files. A filter is also available.
-#
-#LoadPlugin="rawlog"
-
-# Plugin: GraphApplet
-# Perl modules required: None
-# Supported charts are built by a 3D graphic applet.
-#
-#LoadPlugin="graphapplet /awstatsclasses" # EXPERIMENTAL FEATURE
-
-
-
-#-----------------------------------------------------------------------------
-# EXTRA SECTIONS
-#-----------------------------------------------------------------------------
-
-# You can define your own charts, you choose here what are rows and columns
-# keys. This feature is particularly useful for marketing purpose, tracking
-# products orders for example.
-# For this, edit all parameters of Extra section. Each set of parameter is a
-# different chart. For several charts, duplicate section changing the number.
-# Note: Each Extra section reduces AWStats speed by 8%.
-#
-# WARNING: A wrong setup of Extra section might result in too large arrays
-# that will consume all your memory, making AWStats unusable after several
-# updates, so be sure to setup it correctly.
-# In most cases, you don't need this feature.
-#
-# ExtraSectionNameX is title of your personalized chart.
-# ExtraSectionCodeFilterX is list of codes the record code field must match.
-# Put an empty string for no test on code.
-# ExtraSectionConditionX are conditions you can use to count or not the hit,
-# Use one of the field condition
-# (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOST,extraX)
-# and a regex to match, after a coma. Use "||" for "OR".
-# ExtraSectionFirstColumnTitleX is the first column title of the chart.
-# ExtraSectionFirstColumnValuesX is a string to tell AWStats which field to
-# extract value from
-# (URL,URLWITHQUERY,QUERY_STRING,REFERER,UA,HOST,VHOST,extraX)
-# and how to extract the value (using regex syntax). Each different value
-# found will appear in first column of report on a different row. Be sure
-# that list of different possible values will not grow indefinitely.
-# ExtraSectionFirstColumnFormatX is the string used to write value.
-# ExtraSectionStatTypesX are things you want to count. You can use standard
-# code letters (P for pages,H for hits,B for bandwidth,L for last access).
-# ExtraSectionAddAverageRowX add a row at bottom of chart with average values.
-# ExtraSectionAddSumRowX add a row at bottom of chart with sum values.
-# MaxNbOfExtraX is maximum number of rows shown in chart.
-# MinHitExtraX is minimum number of hits required to be shown in chart.
-#
-
-# Example to report the 20 products the most ordered by "order.cgi" script
-#ExtraSectionName1="Product orders"
-#ExtraSectionCodeFilter1="200 304"
-#ExtraSectionCondition1="URL,\/cgi\-bin\/order\.cgi||URL,\/cgi\-bin\/order2\.cgi"
-#ExtraSectionFirstColumnTitle1="Product ID"
-#ExtraSectionFirstColumnValues1="QUERY_STRING,productid=([^&]+)"
-#ExtraSectionFirstColumnFormat1="%s"
-#ExtraSectionStatTypes1=PL
-#ExtraSectionAddAverageRow1=0
-#ExtraSectionAddSumRow1=1
-#MaxNbOfExtra1=20
-#MinHitExtra1=1
-
-
-# There is also a global parameter ExtraTrackedRowsLimit that limits the
-# number of possible rows an ExtraSection can report. This parameter is
-# here to protect too much memory use when you make a bad setup in your
-# ExtraSection. It applies to all ExtraSection independently meaning that
-# none ExtraSection can report more rows than value defined by ExtraTrackedRowsLimit.
-# If you know an ExtraSection will report more rows than its value, you should
-# increase this parameter or AWStats will stop with an error.
-# Example: 2000
-# Default: 500
-#
-ExtraTrackedRowsLimit=500
-
-
-#-----------------------------------------------------------------------------
-# INCLUDES
-#-----------------------------------------------------------------------------
-
-# You can include other config files using the directive with the name of the
-# config file.
-# This is particularly useful for users who have a lot of virtual servers, so
-# a lot of config files and want to maintain common values in only one file.
-# Note that when a variable is defined both in a config file and in an
-# included file, AWStats will use the last value read for parameters that
-# contains one value and AWStats will concat all values from both files for
-# parameters that are lists of values.
-#
-
-Include "/etc/awstats/awstats.conf.local"
-
+++ /dev/null
-#
-# DAV testing hack
-#
-
-import os
-import sys
-import davlib
-import string
-import gdbm
-import StringIO
-import base64
-from xml.utils import qp_xml
-
-#HOST = 'parisson.com'
-HOST = 'localhost'
-PORT = '1983'
-BASE = 'http://%s:%s' % (HOST, PORT)
-USERNAME = 'admin'
-DESTDIR = 'CRFPA/formations/formations-en-ligne/cours-audio/droit_penal_cours/'
-#DESTDIR = 'parisson.com_2/Members/yomguy/dav'
-#DESTDIR = 'dav'
-SOURCEDIR = '/home/momo/music/mp3'
-FILE = 'lll-0001.mp3'
-#FILE = '04_Idjut_Boys_-_Rebirth_Evil_Vibrations.mp3'
-PASSWORD = sys.argv[1]
-
-
-
-def getprop(dirname, fname, ns, propname):
- g = gdbm.open(dirname + '/.DAV/' + fname, 'r')
- return g[str(ns) + ':' + propname + '\0']
-
-def setprop(dirname, fname, ns, propname, value):
- g = gdbm.open(dirname + '/.DAV/' + fname, 'c')
- g[str(ns) + ':' + propname + '\0'] = value + '\0'
-
-def dump(dirname, fname):
- g = gdbm.open(dirname + '/.DAV/' + fname, 'r')
- for key in g.keys():
- print `key`, '=', `g[key]`
-
-class mydav(davlib.DAV):
- def _request(self, method, url, *rest, **kw):
- print 'REQUEST:', method, url
- response = apply(davlib.DAV._request, (self, method, url) + rest, kw)
- print "STATUS:", response.status
- print "REASON:", response.reason
- for hdr in response.msg.headers:
- print string.strip (hdr)
- print '-'*70
- if response.status == 207:
- #print response.doc.dump()
- #print response.doc.toxml()
- response.parse_multistatus()
- davlib.qp_xml.dump(sys.stdout, response.root)
- elif method == 'LOCK' and response.status == 200:
- response.parse_lock_response()
- davlib.qp_xml.dump(sys.stdout, response.root)
- else:
- print response.read()
- print '-'*70
- return response
- def get_lock(self, url, owner='', timeout=None, depth=None):
- return self.lock(url, owner, timeout, depth).locktoken
-
-
-def _dav():
- return mydav(HOST, PORT)
-
-def getvalue(url, ns, prop):
- response = _dav().getprops(url, prop, ns=ns)
- resp = response.msr.responses[0]
- if resp.status and resp.status[0] != 200:
- raise 'error retrieving property', response.status
- propstat = resp.propstat[0]
- if propstat.status and propstat.status[0] != 200:
- raise 'error retrieving property', propstat.status
- return propstat.prop[(ns, prop)]
-
- #s = StringIO.StringIO()
- #davlib.qp_xml.dump(s, propstat.prop[(ns, prop)])
- #return s.getvalue()
-
-
-def del_test_data():
- _dav().delete('/dav/testdata')
-
-def gettest():
- _dav()._request('GET', '/dav/test.html')
-
-def if_test():
- _dav().put('/dav/foo.html', 'foo.html contents\n')
- etag = qp_xml.textof(getvalue('/dav/foo.html', 'DAV:', 'getetag'))
- print 'ETAG:', etag
- _dav()._request('DELETE', '/dav/foo.html', extra_hdrs={
- 'If' : '(["abc"])',
- })
- _dav()._request('DELETE', '/dav/foo.html', extra_hdrs={
- 'If' : '([' + etag + '])',
- })
-
-def lock_test():
- _dav().delete('/dav/locktest')
- _dav().mkcol('/dav/locktest')
- _dav().mkcol('/dav/locktest/sub')
-
- # test a locknull resource
- r = _dav().lock('/dav/locktest/locknull')
-
-def upload(base, dest_dir, source_dir, file, username, password, encodeduserpass):
- _dav().setauth(username, password)
- auth_dict = {"Authorization":"Basic %s" % encodeduserpass}
- auth = auth_dict['Authorization']
- print auth
-
- f = open(source_dir + os.sep + file,'r')
- #_dav().mkcol(BASE+'/'+DESTDIR,auth)
- _dav().put(base+'/'+dest_dir+'/'+file,f.read(),None,None,auth_dict)
-
-
-
-if __name__ == '__main__':
- if HOST == 'FILL THIS IN':
- import sys
- sys.stdout = sys.stderr
- print 'ERROR: you must edit davtest.py to set the HOST/PORT values'
- print ' at the top of the script.'
- sys.exit(1)
-
- encodedUSERPASS = base64.encodestring(USERNAME+":"+PASSWORD)
- upload(BASE, DESTDIR, SOURCEDIR, FILE, USERNAME, PASSWORD, encodedUSERPASS)
+++ /dev/null
-#
-# DAV testing hack
-#
-
-import os
-import sys
-import davlib
-import string
-import gdbm
-import StringIO
-import base64
-from xml.utils import qp_xml
-
-HOST = 'localhost'
-#HOST = 'crfpa.pre-barreau.com'
-PORT = '1983'
-BASE = 'http://%s:%s' % (HOST, PORT)
-USERNAME = 'zope'
-DESTDIR = 'CRFPA/formations/formations-en-ligne/cours-audio/'
-#DESTDIR = 'CRFPA/'
-TITLE = 'Pre-barreau_-_Augustins_-_CRFPA_-_'
-SOURCEDIR = '/home/augustins/audio/media/CRFPA/2008/'
-#PASSWORD = sys.argv[1]
-PASSWORD = 'wasncellar;z'
-COURSES = 'pre-barreau_courses_crfpa.txt'
-
-
-
-def getprop(dirname, fname, ns, propname):
- g = gdbm.open(dirname + '/.DAV/' + fname, 'r')
- return g[str(ns) + ':' + propname + '\0']
-
-def setprop(dirname, fname, ns, propname, value):
- g = gdbm.open(dirname + '/.DAV/' + fname, 'c')
- g[str(ns) + ':' + propname + '\0'] = value + '\0'
-
-def dump(dirname, fname):
- g = gdbm.open(dirname + '/.DAV/' + fname, 'r')
- for key in g.keys():
- print `key`, '=', `g[key]`
-
-class mydav(davlib.DAV):
- def _request(self, method, url, *rest, **kw):
- print 'REQUEST:', method, url
- response = apply(davlib.DAV._request, (self, method, url) + rest, kw)
- print "STATUS:", response.status
- print "REASON:", response.reason
- for hdr in response.msg.headers:
- print string.strip (hdr)
- print '-'*70
- if response.status == 207:
- #print response.doc.dump()
- #print response.doc.toxml()
- response.parse_multistatus()
- davlib.qp_xml.dump(sys.stdout, response.root)
- elif method == 'LOCK' and response.status == 200:
- response.parse_lock_response()
- davlib.qp_xml.dump(sys.stdout, response.root)
- else:
- print response.read()
- print '-'*70
- return response
- def get_lock(self, url, owner='', timeout=None, depth=None):
- return self.lock(url, owner, timeout, depth).locktoken
-
-
-def _dav():
- return mydav(HOST, PORT)
-
-def getvalue(url, ns, prop):
- response = _dav().getprops(url, prop, ns=ns)
- resp = response.msr.responses[0]
- if resp.status and resp.status[0] != 200:
- raise 'error retrieving property', response.status
- propstat = resp.propstat[0]
- if propstat.status and propstat.status[0] != 200:
- raise 'error retrieving property', propstat.status
- return propstat.prop[(ns, prop)]
-
- #s = StringIO.StringIO()
- #davlib.qp_xml.dump(s, propstat.prop[(ns, prop)])
- #return s.getvalue()
-
-
-def del_test_data():
- _dav().delete('/dav/testdata')
-
-def gettest():
- _dav()._request('GET', '/dav/test.html')
-
-def if_test():
- _dav().put('/dav/foo.html', 'foo.html contents\n')
- etag = qp_xml.textof(getvalue('/dav/foo.html', 'DAV:', 'getetag'))
- print 'ETAG:', etag
- _dav()._request('DELETE', '/dav/foo.html', extra_hdrs={
- 'If' : '(["abc"])',
- })
- _dav()._request('DELETE', '/dav/foo.html', extra_hdrs={
- 'If' : '([' + etag + '])',
- })
-
-def lock_test():
- _dav().delete('/dav/locktest')
- _dav().mkcol('/dav/locktest')
- _dav().mkcol('/dav/locktest/sub')
-
- # test a locknull resource
- r = _dav().lock('/dav/locktest/locknull')
-
-def upload(base, title, dest_dir, source_dir, username, password, encodeduserpass):
- _dav().setauth(username, password)
- auth_dict = {"Authorization":"Basic %s" % encodeduserpass}
- auth = auth_dict['Authorization']
- print auth
-
- for _dir in os.listdir(source_dir):
- _dir_low = _dir.replace(title, '')
- _dest_dir = dest_dir + _dir_low.lower()
- #_dav().mkcol(base+'/'+dest_dir,auth_dict)
- for file in os.listdir(source_dir+os.sep+_dir):
- print source_dir + os.sep +_dir + os.sep + file
- f = open(source_dir + os.sep +_dir + os.sep + file,'r')
- _dav().put(base+'/'+_dest_dir+'/'+file,f.read(),None,None,auth_dict)
-
-def init(base, title, dest_dir, source_dir, username, password, encodeduserpass):
- _dav().setauth(username, password)
- auth_dict = {"Authorization":"Basic %s" % encodeduserpass}
- auth = auth_dict['Authorization']
- print auth
- f = open(COURSES, 'r')
- courses = f.readlines()
- for course in courses:
- _dav().mkcol(base+'/'+dest_dir+course.lower()+'/'+'Archives_Audio',auth)
-
-if __name__ == '__main__':
- if HOST == 'FILL THIS IN':
- import sys
- sys.stdout = sys.stderr
- print 'ERROR: you must edit davtest.py to set the HOST/PORT values'
- print ' at the top of the script.'
- sys.exit(1)
-
- encodedUSERPASS = base64.encodestring(USERNAME+":"+PASSWORD)
- #upload(BASE, TITLE, DESTDIR, SOURCEDIR, USERNAME, PASSWORD, encodedUSERPASS)
- init(BASE, TITLE, DESTDIR, SOURCEDIR, USERNAME, PASSWORD, encodedUSERPASS)
-
+++ /dev/null
-#
-# DAV client library
-#
-# Copyright (C) 1998-2000 Guido van Rossum. All Rights Reserved.
-# Written by Greg Stein. Given to Guido. Licensed using the Python license.
-#
-# This module is maintained by Greg and is available at:
-# http://www.lyra.org/greg/python/davlib.py
-#
-# Since this isn't in the Python distribution yet, we'll use the CVS ID
-# for tracking:
-# $Id: davlib.py,v 1.7 2000/06/11 10:04:49 gstein Exp $
-#
-
-import httplib
-import urllib
-import string
-import types
-import mimetypes
-#import qp_xml
-from xml.utils import qp_xml
-
-
-INFINITY = 'infinity'
-XML_DOC_HEADER = '<?xml version="1.0" encoding="utf-8"?>'
-XML_CONTENT_TYPE = 'text/xml; charset="utf-8"'
-
-# block size for copying files up to the server
-BLOCKSIZE = 16384
-
-
-class HTTPConnectionAuth(httplib.HTTPConnection):
- def __init__(self, *args, **kw):
- apply(httplib.HTTPConnection.__init__, (self,) + args, kw)
-
- self.__username = None
- self.__password = None
- self.__nonce = None
- self.__opaque = None
-
- def setauth(self, username, password):
- self.__username = username
- self.__password = password
-
-
-def _parse_status(elem):
- text = elem.textof()
- idx1 = string.find(text, ' ')
- idx2 = string.find(text, ' ', idx1+1)
- return int(text[idx1:idx2]), text[idx2+1:]
-
-class _blank:
- def __init__(self, **kw):
- self.__dict__.update(kw)
-class _propstat(_blank): pass
-class _response(_blank): pass
-class _multistatus(_blank): pass
-
-def _extract_propstat(elem):
- ps = _propstat(prop={}, status=None, responsedescription=None)
- for child in elem.children:
- if child.ns != 'DAV:':
- continue
- if child.name == 'prop':
- for prop in child.children:
- ps.prop[(prop.ns, prop.name)] = prop
- elif child.name == 'status':
- ps.status = _parse_status(child)
- elif child.name == 'responsedescription':
- ps.responsedescription = child.textof()
- ### unknown element name
-
- return ps
-
-def _extract_response(elem):
- resp = _response(href=[], status=None, responsedescription=None, propstat=[])
- for child in elem.children:
- if child.ns != 'DAV:':
- continue
- if child.name == 'href':
- resp.href.append(child.textof())
- elif child.name == 'status':
- resp.status = _parse_status(child)
- elif child.name == 'responsedescription':
- resp.responsedescription = child.textof()
- elif child.name == 'propstat':
- resp.propstat.append(_extract_propstat(child))
- ### unknown child element
-
- return resp
-
-def _extract_msr(root):
- if root.ns != 'DAV:' or root.name != 'multistatus':
- raise 'invalid response: <DAV:multistatus> expected'
-
- msr = _multistatus(responses=[ ], responsedescription=None)
-
- for child in root.children:
- if child.ns != 'DAV:':
- continue
- if child.name == 'responsedescription':
- msr.responsedescription = child.textof()
- elif child.name == 'response':
- msr.responses.append(_extract_response(child))
- ### unknown child element
-
- return msr
-
-def _extract_locktoken(root):
- if root.ns != 'DAV:' or root.name != 'prop':
- raise 'invalid response: <DAV:prop> expected'
- elem = root.find('lockdiscovery', 'DAV:')
- if not elem:
- raise 'invalid response: <DAV:lockdiscovery> expected'
- elem = elem.find('activelock', 'DAV:')
- if not elem:
- raise 'invalid response: <DAV:activelock> expected'
- elem = elem.find('locktoken', 'DAV:')
- if not elem:
- raise 'invalid response: <DAV:locktoken> expected'
- elem = elem.find('href', 'DAV:')
- if not elem:
- raise 'invalid response: <DAV:href> expected'
- return elem.textof()
-
-
-class DAVResponse(httplib.HTTPResponse):
- def parse_multistatus(self):
- self.root = qp_xml.Parser().parse(self)
- self.msr = _extract_msr(self.root)
-
- def parse_lock_response(self):
- self.root = qp_xml.Parser().parse(self)
- self.locktoken = _extract_locktoken(self.root)
-
-
-class DAV(HTTPConnectionAuth):
-
- response_class = DAVResponse
-
- def get(self, url, extra_hdrs={ }):
- return self._request('GET', url, extra_hdrs=extra_hdrs)
-
- def head(self, url, extra_hdrs={ }):
- return self._request('HEAD', url, extra_hdrs=extra_hdrs)
-
- def post(self, url, data={ }, body=None, extra_hdrs={ }):
- headers = extra_hdrs.copy()
-
- assert body or data, "body or data must be supplied"
- assert not (body and data), "cannot supply both body and data"
- if data:
- body = ''
- for key, value in data.items():
- if isinstance(value, types.ListType):
- for item in value:
- body = body + '&' + key + '=' + urllib.quote(str(item))
- else:
- body = body + '&' + key + '=' + urllib.quote(str(value))
- body = body[1:]
- headers['Content-Type'] = 'application/x-www-form-urlencoded'
-
- return self._request('POST', url, body, headers)
-
- def options(self, url='*', extra_hdrs={ }):
- return self._request('OPTIONS', url, extra_hdrs=extra_hdrs)
-
- def trace(self, url, extra_hdrs={ }):
- return self._request('TRACE', url, extra_hdrs=extra_hdrs)
-
- def put(self, url, contents,
- content_type=None, content_enc=None, extra_hdrs={ }):
-
- if not content_type:
- content_type, content_enc = mimetypes.guess_type(url)
-
- headers = extra_hdrs.copy()
- if content_type:
- headers['Content-Type'] = content_type
- if content_enc:
- headers['Content-Encoding'] = content_enc
- return self._request('PUT', url, contents, headers)
-
- def delete(self, url, extra_hdrs={ }):
- return self._request('DELETE', url, extra_hdrs=extra_hdrs)
-
- def propfind(self, url, body=None, depth=None, extra_hdrs={ }):
- headers = extra_hdrs.copy()
- headers['Content-Type'] = XML_CONTENT_TYPE
- if depth is not None:
- headers['Depth'] = str(depth)
- return self._request('PROPFIND', url, body, headers)
-
- def proppatch(self, url, body, extra_hdrs={ }):
- headers = extra_hdrs.copy()
- headers['Content-Type'] = XML_CONTENT_TYPE
- return self._request('PROPPATCH', url, body, headers)
-
- def mkcol(self, url, extra_hdrs={ }):
- return self._request('MKCOL', url, extra_hdrs)
-
- def move(self, src, dst, extra_hdrs={ }):
- headers = extra_hdrs.copy()
- headers['Destination'] = dst
- return self._request('MOVE', src, extra_hdrs=headers)
-
- def copy(self, src, dst, depth=None, extra_hdrs={ }):
- headers = extra_hdrs.copy()
- headers['Destination'] = dst
- if depth is not None:
- headers['Depth'] = str(depth)
- return self._request('COPY', src, extra_hdrs=headers)
-
- def lock(self, url, owner='', timeout=None, depth=None,
- scope='exclusive', type='write', extra_hdrs={ }):
- headers = extra_hdrs.copy()
- headers['Content-Type'] = XML_CONTENT_TYPE
- if depth is not None:
- headers['Depth'] = str(depth)
- if timeout is not None:
- headers['Timeout'] = timeout
- body = XML_DOC_HEADER + \
- '<DAV:lockinfo xmlns:DAV="DAV:">' + \
- '<DAV:lockscope><DAV:%s/></DAV:lockscope>' % scope + \
- '<DAV:locktype><DAV:%s/></DAV:locktype>' % type + \
- owner + \
- '</DAV:lockinfo>'
- return self._request('LOCK', url, body, extra_hdrs=headers)
-
- def unlock(self, url, locktoken, extra_hdrs={ }):
- headers = extra_hdrs.copy()
- if locktoken[0] != '<':
- locktoken = '<' + locktoken + '>'
- headers['Lock-Token'] = locktoken
- return self._request('UNLOCK', url, extra_hdrs=headers)
-
- def _request(self, method, url, body=None, extra_hdrs={}):
- "Internal method for sending a request."
-
- self.request(method, url, body, extra_hdrs)
- return self.getresponse()
-
-
- #
- # Higher-level methods for typical client use
- #
-
- def allprops(self, url, depth=None):
- return self.propfind(url, depth=depth)
-
- def propnames(self, url, depth=None):
- body = XML_DOC_HEADER + \
- '<DAV:propfind xmlns:DAV="DAV:"><DAV:propname/></DAV:propfind>'
- return self.propfind(url, body, depth)
-
- def getprops(self, url, *names, **kw):
- assert names, 'at least one property name must be provided'
- if kw.has_key('ns'):
- xmlns = ' xmlns:NS="' + kw['ns'] + '"'
- ns = 'NS:'
- del kw['ns']
- else:
- xmlns = ns = ''
- if kw.has_key('depth'):
- depth = kw['depth']
- del kw['depth']
- else:
- depth = 0
- assert not kw, 'unknown arguments'
- body = XML_DOC_HEADER + \
- '<DAV:propfind xmlns:DAV="DAV:"' + xmlns + '><DAV:prop><' + ns + \
- string.joinfields(names, '/><' + ns) + \
- '/></DAV:prop></DAV:propfind>'
- return self.propfind(url, body, depth)
-
- def delprops(self, url, *names, **kw):
- assert names, 'at least one property name must be provided'
- if kw.has_key('ns'):
- xmlns = ' xmlns:NS="' + kw['ns'] + '"'
- ns = 'NS:'
- del kw['ns']
- else:
- xmlns = ns = ''
- assert not kw, 'unknown arguments'
- body = XML_DOC_HEADER + \
- '<DAV:propertyupdate xmlns:DAV="DAV:"' + xmlns + \
- '><DAV:remove><DAV:prop><' + ns + \
- string.joinfields(names, '/><' + ns) + \
- '/></DAV:prop></DAV:remove></DAV:propertyupdate>'
- return self.proppatch(url, body)
-
- def setprops(self, url, *xmlprops, **props):
- assert xmlprops or props, 'at least one property must be provided'
- xmlprops = list(xmlprops)
- if props.has_key('ns'):
- xmlns = ' xmlns:NS="' + props['ns'] + '"'
- ns = 'NS:'
- del props['ns']
- else:
- xmlns = ns = ''
- for key, value in props.items():
- if value:
- xmlprops.append('<%s%s>%s</%s%s>' % (ns, key, value, ns, key))
- else:
- xmlprops.append('<%s%s/>' % (ns, key))
- elems = string.joinfields(xmlprops, '')
- body = XML_DOC_HEADER + \
- '<DAV:propertyupdate xmlns:DAV="DAV:"' + xmlns + \
- '><DAV:set><DAV:prop>' + \
- elems + \
- '</DAV:prop></DAV:set></DAV:propertyupdate>'
- return self.proppatch(url, body)
-
- def get_lock(self, url, owner='', timeout=None, depth=None):
- response = self.lock(url, owner, timeout, depth)
- response.parse_lock_response()
- return response.locktoken
+++ /dev/null
-#
-# DAV testing hack
-#
-
-import sys
-import davlib
-import string
-import gdbm
-import StringIO
-import base64
-from xml.utils import qp_xml
-
-HOST = 'parisson.com'
-#HOST = 'localhost'
-PORT = '1983'
-BASE = 'http://%s:%s' % (HOST, PORT)
-USERNAME = 'zope'
-DESTDIR = 'CRFPA/formations/formations-en-ligne/cours-audio/droit_penal_cours/'
-#DESTDIR = 'parisson.com_2/Members/yomguy/dav'
-#DESTDIR = 'dav'
-#FILE = 'vc07_lop_nobd_100bpm.wav.mp3'
-FILE = '04_Idjut_Boys_-_Rebirth_Evil_Vibrations.mp3'
-PASSWORD = sys.argv[1]
-encodedUSERPASS = base64.encodestring(USERNAME+":"+PASSWORD)
-
-
-def getprop(dirname, fname, ns, propname):
- g = gdbm.open(dirname + '/.DAV/' + fname, 'r')
- return g[str(ns) + ':' + propname + '\0']
-
-def setprop(dirname, fname, ns, propname, value):
- g = gdbm.open(dirname + '/.DAV/' + fname, 'c')
- g[str(ns) + ':' + propname + '\0'] = value + '\0'
-
-def dump(dirname, fname):
- g = gdbm.open(dirname + '/.DAV/' + fname, 'r')
- for key in g.keys():
- print `key`, '=', `g[key]`
-
-class mydav(davlib.DAV):
- def _request(self, method, url, *rest, **kw):
- print 'REQUEST:', method, url
- response = apply(davlib.DAV._request, (self, method, url) + rest, kw)
- print "STATUS:", response.status
- print "REASON:", response.reason
- for hdr in response.msg.headers:
- print string.strip (hdr)
- print '-'*70
- if response.status == 207:
- #print response.doc.dump()
- #print response.doc.toxml()
- response.parse_multistatus()
- davlib.qp_xml.dump(sys.stdout, response.root)
- elif method == 'LOCK' and response.status == 200:
- response.parse_lock_response()
- davlib.qp_xml.dump(sys.stdout, response.root)
- else:
- print response.read()
- print '-'*70
- return response
- def get_lock(self, url, owner='', timeout=None, depth=None):
- return self.lock(url, owner, timeout, depth).locktoken
-
-
-def _dav():
- return mydav(HOST, PORT)
-
-def getvalue(url, ns, prop):
- response = _dav().getprops(url, prop, ns=ns)
- resp = response.msr.responses[0]
- if resp.status and resp.status[0] != 200:
- raise 'error retrieving property', response.status
- propstat = resp.propstat[0]
- if propstat.status and propstat.status[0] != 200:
- raise 'error retrieving property', propstat.status
- return propstat.prop[(ns, prop)]
-
- #s = StringIO.StringIO()
- #davlib.qp_xml.dump(s, propstat.prop[(ns, prop)])
- #return s.getvalue()
-
-def gen_test_data():
- # some property values
- pv1 = '<pv1>pv1</pv1>'
- pv2 = '<pv2/>'
- pv3 = '<foo:pv3 xmlns:foo="namespace">pv3</foo:pv3>'
- pv4 = '<foo:pv4 xmlns:foo="namespace"/>'
- pv5 = '<bar:pv5 xmlns:bar="namespace">pv5</bar:pv5>'
- pv6 = '<bar:pv6 xmlns:bar="namespace"/>'
- pv7 = '<pv7 xmlns="namespace">pv7</pv7>'
- pv8 = '<pv8 xmlns="namespace"/>'
- pv9 = '<foo:pv9 xmlns:foo="other">pv9</foo:pv9>'
- pv10 = '<foo:pv10 xmlns:foo="other"/>'
- pv11 = '<bar:pv11 xmlns:bar="other">pv11</bar:pv11>'
- pv12 = '<bar:pv12 xmlns:bar="other"/>'
- pv13 = '<pv13 xmlns="other">pv13</pv13>'
- pv14 = '<pv14 xmlns="other"/>'
-
- # prep the file structure
- _dav().mkcol('/dav/testdata')
- _dav().put('/dav/testdata/file1', 'file1 contents\n')
- _dav().put('/dav/testdata/file2', 'file2 contents\n')
- _dav().put('/dav/testdata/file3', 'file3 contents\n')
- _dav().mkcol('/dav/testdata/sub')
- _dav().put('/dav/testdata/sub/file1', 'sub/file1 contents\n')
- _dav().put('/dav/testdata/sub/file2', 'sub/file1 contents\n')
- _dav().put('/dav/testdata/sub/file3', 'sub/file1 contents\n')
-
- # attach a bunch of properties
- _dav().setprops('/dav/testdata',
- pv1, pv2,
- pv3, pv4, pv5, pv6, pv7, pv8,
- pv9, pv10, pv11, pv12, pv13, pv14)
- _dav().setprops('/dav/testdata/file1',
- pv1, pv2,
- pv3, pv4, pv5, pv6, pv7, pv8,
- pv9, pv10, pv11, pv12, pv13, pv14)
- _dav().setprops('/dav/testdata/file2',
- pv9, pv10, pv11, pv12, pv13, pv14)
- _dav().setprops('/dav/testdata/file3',
- pv1, pv2,
- pv3, pv4, pv5, pv6, pv7, pv8)
- _dav().setprops('/dav/testdata/sub',
- pv1, pv2)
- _dav().setprops('/dav/testdata/sub/file1',
- pv1, pv2,
- pv9, pv10, pv11, pv12, pv13, pv14)
- _dav().setprops('/dav/testdata/sub/file2',
- pv3, pv4, pv5, pv6, pv7, pv8,
- pv9, pv10, pv11, pv12, pv13, pv14)
- _dav().setprops('/dav/testdata/sub/file3',
- pv1, pv2,
- pv3, pv4, pv5, pv6, pv7, pv8)
-
- # do some moves and copies
- _dav().move('/dav/testdata/file1', BASE + '/dav/testdata/newfile1')
- _dav().move('/dav/testdata/sub', BASE + '/dav/testdata/newsub')
- _dav().move('/dav/testdata/newsub/file2', BASE + '/dav/testdata/newsubfile2')
- _dav().copy('/dav/testdata/newsub/file3', BASE + '/dav/testdata/newsub/file3copy')
- _dav().copy('/dav/testdata/newsub/file1', BASE + '/dav/testdata/subfile1copy')
- _dav().copy('/dav/testdata/newsub', BASE + '/dav/testdata/subcopy')
-
- # dump all the data
- _dav().allprops('/dav/testdata')
-
-
-def del_test_data():
- _dav().delete('/dav/testdata')
-
-def gettest():
- _dav()._request('GET', '/dav/test.html')
-
-def if_test():
- _dav().put('/dav/foo.html', 'foo.html contents\n')
- etag = qp_xml.textof(getvalue('/dav/foo.html', 'DAV:', 'getetag'))
- print 'ETAG:', etag
- _dav()._request('DELETE', '/dav/foo.html', extra_hdrs={
- 'If' : '(["abc"])',
- })
- _dav()._request('DELETE', '/dav/foo.html', extra_hdrs={
- 'If' : '([' + etag + '])',
- })
-
-def lock_test():
- _dav().delete('/dav/locktest')
- _dav().mkcol('/dav/locktest')
- _dav().mkcol('/dav/locktest/sub')
-
- # test a locknull resource
- r = _dav().lock('/dav/locktest/locknull')
-
-def test():
- _dav().setauth(USERNAME,PASSWORD)
- auth_dict = {"Authorization":"Basic %s" % encodedUSERPASS}
- auth = auth_dict['Authorization']
- print auth
-
- f = open(FILE,'r')
- #_dav().mkcol(BASE+'/'+DESTDIR,auth)
- _dav().put(BASE+'/'+DESTDIR+'/'+FILE,f.read(),None,None,auth_dict)
-
- #_data = _dav().get(BASE+'/test/'+FILE,auth_dict)
- #f = open(FILE,'w')
- #f.write(_data)
- #f.close()
-
- #_dav().getprops(BASE+'/test/foo.html', 'author', 'foober', 'title')
- #_dav().mkcol(BASE+'/dav/',{"Authorization":"Basic %s" % encodedUSERPASS})
- #_dav().put(BASE+'/foo.html','\n OKKKKKKKKKKK \n',{"Authorization":"Basic %s" % encodedUSERPASS})
- #_dav().options('/dav/foo.html')
- #_dav().delete('/dav/foo.html')
- #_dav().delete('/dav/newdir')
- #_dav().mkcol('/dav/newdir')
- #_dav().mkcol('/dav/newdir/another')
- #_dav().allprops('/dav', 1)
- #_dav().propnames('/dav', 1)
- #_dav().getprops('/dav', 'author', 'foober', 'title')
- #_dav().propfind('/dav',
- #'<?xml version="1.0"?><propfind xmlns="DAV:"><prop>'
- #'<author/><foobar/><title/>'
- #'</prop></propfind>',
- #'infinity')
- #_dav().delprops('/dav', 'author')
- #_dav().setprops('/dav', '''<author>
- #<complex oops="hi" two="three" > stuff goes in here
- #</complex>
- #<more foo="bar"/>
- #stuff
- #</author>''')
- #_dav().put('/dav/blah.cgi', 'body of blah.cgi\n')
- #_dav().put('/dav/file1', 'body of file1\n')
- #_dav().move('/dav/blah.cgi', BASE + '/dav/foo.cgi')
- #_dav().copy('/dav/subdir', BASE + '/dav/subdir3')
- #_dav().setprops('/dav/file1','<woo>bar</woo>')
-
- #_dav().propfind('/dav/foo.cgi', '''<?xml version="1.0"?>
- #<propfind xmlns="DAV:"><propname/>
- #<foo:bar xmlns:foo="xyz" xmlns:bar="abc">
- #<foo:bar bar:xxx="hello"/>
- #<bar:ddd what:aaa="hi" xmlns:what="ha"/>
- #<geez xmlns="empty"/>
- #<davtag/>
- #<rep:davtag2 xmlns:rep="DAV:"/>
- #</foo:bar>
- #</propfind>
- #''')
-
- #del_test_data()
- #gen_test_data()
-
-
-if __name__ == '__main__':
- if HOST == 'FILL THIS IN':
- import sys
- sys.stdout = sys.stderr
- print 'ERROR: you must edit davtest.py to set the HOST/PORT values'
- print ' at the top of the script.'
- sys.exit(1)
-
- test()
+++ /dev/null
-
-Hello World !
-
-Yomguy
-:)
+++ /dev/null
-#!/usr/bin.python
-
-import davlib
-
-HOST = 'localhost'
-PORT = 1980
-BASE = 'http://%s:%s' % (HOST, PORT)
-
-class mydav(davlib.DAV):
- def _request(self, method, url, *rest, **kw):
- print 'REQUEST:', method, url
- response = apply(davlib.DAV._request, (self, method, url) + rest, kw)
- print "STATUS:", response.status
- print "REASON:", response.reason
- for hdr in response.msg.headers:
- print string.strip(hdr)
- print '-'*70
- if response.status == 207:
- #print response.doc.dump()
- #print response.doc.toxml()
- response.parse_multistatus()
- davlib.qp_xml.dump(sys.stdout, response.root)
- elif method == 'LOCK' and response.status == 200:
- response.parse_lock_response()
- davlib.qp_xml.dump(sys.stdout, response.root)
- else:
- print response.read()
- print '-'*70
- return response
- def get_lock(self, url, owner='', timeout=None, depth=None):
- return self.lock(url, owner, timeout, depth).locktoken
-
-
-def _dav():
- return mydav(HOST, PORT)
-
-
-def getvalue(url, ns, prop):
- response = _dav().getprops(url, prop, ns=ns)
- resp = response.msr.responses[0]
- if resp.status and resp.status[0] != 200:
- raise 'error retrieving property', response.status
- propstat = resp.propstat[0]
- if propstat.status and propstat.status[0] != 200:
- raise 'error retrieving property', propstat.status
- return propstat.prop[(ns, prop)]
-
+++ /dev/null
-#!/usr/bin/python
-# Backups all zope instances (any versions)
-#
-# Depends : zope_instance.py
-# Copyright (C) 2007-2009 Guillaume Pellerin
-
-import os
-import sys
-from zope_instance import *
-
-version = '0.2'
-info = 'zope_backup v'+version+'\n'+ \
- """Copyright (C) 2007-2009 Guillaume Pellerin
- Usage: zope_backup DIRECTORY
- where DIRECTORY is the directory where you want to backup
- the instances of the different versions of zope."""
-print info
-
-backup_dir = sys.argv[-1]
-if not os.path.exists(backup_dir):
- sys.exit('This backup directory does not exists !')
-
-z = ZopeInstall()
-instances = z.get_instances()
-
-def backup_all():
- for version in instances:
- for instance in instances[version]:
- z = ZopeInstance(version, instance, backup_dir)
- print 'Backuping : ' + z.get_instance_dir() + '...'
- z.backup()
- print version + ': ' + instance + ' backuped !'
-
-if __name__ == '__main__':
- backup_all()
- print "Backup_all Zopes done !"
-
+++ /dev/null
-#!/usr/bin/python
-#
-# Depends : zope_instance.py
-# Copyright (C) 2007-2008 Guillaume Pellerin
-
-import os
-import sys
-from zope_instance import *
-
-version = '0.2'
-info = 'zope_check v'+version+'\n'+ \
- """Copyright (C) 2007-2008 Guillaume Pellerin
- Usage: zope_backup DIRECTORY
- where DIRECTORY is the directory where you want to backup
- the instances of the different versions of zope."""
-
-#if len(sys.argv) < 2:
-# sys.exit(info)
-#else :
-# backup_dir = sys.argv[1]
-
-z = ZopeInstall()
-instances = z.get_instances()
-instance_main_dir = z.instance_main_dir
-
-def get_zope_port(main_dir):
- conf_path = main_dir + os.sep + 'etc' + os.sep + 'zope.conf'
- conf = open(conf_path, 'r')
- lines = conf.readlines()
- for line in lines:
- if 'HTTPPORT' in line:
- return main_dir+': ' + line
-
-def check_all():
- for version in instances:
- for instance in instances[version]:
- z = ZopeInstance(version, instance)
- print get_zope_port(z.get_instance_dir())
-
-if __name__ == '__main__':
- check_all()
-
-
-
+++ /dev/null
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-#
-# Copyright (c) 2007 Guillaume Pellerin <yomguy@parisson.com>
-# All rights reserved.
-#
-# This software is licensed as described in the file COPYING, which
-# you should have received as part of this distribution.
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Guillaume Pellerin <yomguy@parisson.com>
-
-
-import os
-import sys
-from optparse import OptionParser
-
-
-class ZopeInstall:
- """This give the main parameters of the Zope installations respectively to the
- distribution used"""
-
- def __init__(self):
- self.versions = ['2.7', '2.9', '2.8', '2.10']
- self.instance_main_dir = '/var/lib'
- self.zope_main_dir = '/usr/lib'
-
- def get_instances(self):
- """Return all instances in all zope versions installed"""
- dict = {}
- for version in self.versions:
- #print version
- path = self.instance_main_dir + os.sep + 'zope' + version + os.sep + 'instance'
- if os.path.exists(path):
- dict[version] = os.listdir(path)
- #print dict
- return dict
-
-
-class ZopeInstance(ZopeInstall):
- """Expose Zope instances to several python methods that simplifies admins' life
- (backup, recover, import, etc...)"""
-
- def __init__(self, version, instance, backup_dir):
- ZopeInstall.__init__(self)
- self.version = version
- self.instance = instance
- self.backup_dir = backup_dir
- self.instance_dir = self.instance_main_dir + os.sep + 'zope' + version + os.sep + \
- 'instance' + os.sep + self.instance
- self.instance_data = self.instance_dir + os.sep + 'var' + os.sep + 'Data.fs'
- self.instance_products = self.instance_dir + os.sep + 'Products' + os.sep
- self.instance_var = self.instance_dir + os.sep + 'var' + os.sep
- self.instance_etc = self.instance_dir + os.sep + 'etc' + os.sep
- self.instance_lib = self.instance_dir + os.sep + 'lib' + os.sep
- self.repozo = self.zope_main_dir + os.sep + 'zope' + self.version + os.sep + 'bin' + os.sep + 'repozo.py'
- self.instance_backup_dir = self.backup_dir + os.sep + self.version + os.sep + self.instance
-
- def get_instance_dir(self):
- return self.instance_dir
-
- def tar(self, name, sub_dir):
- os.chdir(self.instance_backup_dir)
- if os.path.exists(sub_dir):
- command = 'tar czf ' + self.instance_backup_dir + os.sep + \
- name + '.tar.gz ' + sub_dir + ' --exclude=Data.fs'
- os.system(command)
-
- def untar(self, name, sub_dir):
- os.chdir(self.instance_backup_dir)
- print 'Recovering ' + sub_dir
- command = 'tar xzf ' + name + '.tar.gz && ' + \
- 'rsync -a ' + './' + self.instance_dir + os.sep + name + os.sep + ' ' + sub_dir + ' && ' + \
- 'chown -R zope:zope ' + sub_dir + os.sep + ' && ' + \
- 'rm -rf ' + './' + self.instance_dir + os.sep + name
- os.system(command)
-
- def backup(self):
- """Backup the instance"""
-
- path = self.instance_backup_dir+ os.sep + 'Data'
- if not os.path.exists(path):
- os.makedirs(path)
- if os.path.exists(self.instance_data):
- command = 'export PYTHONPATH='+ self.zope_main_dir + os.sep + 'zope' + self.version + os.sep + \
- 'lib/python/ && '+ self.repozo +' -Bvz -r ' + path + ' -f ' + self.instance_data
- os.system(command)
- command = 'chmod -R 700 ' + path + os.sep
- os.system(command)
- else:
- print self.instance_data + ' does not exists !'
- if not os.path.exists(self.instance_backup_dir):
- os.makedirs(self.instance_backup_dir)
-
- self.tar('Products', self.instance_products)
- self.tar('var', self.instance_var)
- self.tar('etc', self.instance_etc)
- self.tar('lib', self.instance_lib)
-
- 'rm -rf ' + './' + self.instance_dir
- print self.instance + ' backuped !'
-
- def recover(self):
- """Recover the instance from a backup"""
-
- self.untar('Products', self.instance_products)
- self.untar('var', self.instance_var)
- self.untar('etc', self.instance_etc)
- self.untar('lib', self.instance_lib)
-
- command = self.repozo + ' -Rvz -r ' + self.instance_backup_dir + os.sep + \
- 'Data -o ' + self.instance_data
- if os.path.exists(self.instance_data):
- os.system(command)
- else:
- print self.instance_data + ' does not exists !'
-
- command = self.instance_dir+os.sep+'bin'+os.sep+'zopectl restart'
- os.system(command)
-
- print self.instance + ' recovered !'
-
- def import_from(self, user, server):
- command = 'rsync -a --rsh="ssh -l '+user+'" ' + \
- user+'@'+server+':'+self.instance_backup_dir+os.sep + ' ' + self.instance_backup_dir+os.sep
- os.system(command)
-
- def export_to(self, user, server):
- command = 'rsync -a --rsh="ssh -l '+user+'" ' + \
- self.instance_backup_dir+os.sep + ' ' + user+'@'+server+':'+self.instance_backup_dir+os.sep
- os.system(command)
-
-
+++ /dev/null
-#!/usr/bin/python
-# Recover all zope instances (any versions)
-#
-# Depends : zope_instance.py
-# Copyright (C) 2007-2009 Guillaume Pellerin
-
-import os
-import sys
-from zope_instance import *
-
-version = '0.2'
-info = 'zope_recover v'+version+'\n'+ \
- """Copyright (C) 2007-2009 Guillaume Pellerin
- Usage: zope_recover DIRECTORY
- where DIRECTORY is the directory where you want to backup
- the instances of the different versions of zope."""
-print info
-
-backup_dir = sys.argv[-1]
-#print backup_dir
-if not os.path.exists(backup_dir):
- sys.exit('This backup directory does not exists !')
-
-z = ZopeInstall()
-instances = z.get_instances()
-
-def recover_all():
- for version in instances:
- for instance in instances[version]:
- z = ZopeInstance(version, instance, backup_dir)
- print 'Recovering : ' + z.get_instance_dir() + '...'
- z.recover()
- print version + ': ' + instance + ' recovered !'
-
-if __name__ == '__main__':
- recover_all()
- print "Recover all Zope instances done !"
-
+++ /dev/null
-#!/bin/sh
-
-u=$1
-sudo deluser $u
-sudo rm -rf /home/$u
-
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import os, time, sys
-
-root_orig = sys.argv[1]
-#root_dest = sys.argv[2]
-date_filter = '08'
-
-date_file_list = []
-for root, dirs, files in os.walk(root_orig):
- for file in files:
- #print file
- stats = os.stat(root+os.sep+file)
- lastmod_date = time.localtime(stats[8])
- date_file_tuple = lastmod_date, root+os.sep+file, stats[6]
- date_file_list.append(date_file_tuple)
-
-date_file_list.sort()
-date_file_list.reverse() # newest mod date now first
-
-total_size = 0
-print "%-50s %s" % ("filename:", "last modified:")
-for file in date_file_list:
- if os.path.isfile(file[1]):
- file_date = time.strftime("%y/%m/%d %H:%M:%S", file[0])
- year = time.strftime("%y", file[0])
- #dest_file = root_dest+os.sep+file[1]
- if year <= date_filter and file[1].split('.')[-1] == 'mp3' and 'CRFPA' in file[1] :
- #os.path.exists(dest_file) :
- print "%-50s %s" % (file[1], file_date)
- total_size += file[2]
-
- #os.system('sudo rm "' + file[1] + '"')
- #os.system('sudo touch "' + file[1] + '"')
- #os.system('sudo chown zope:zope "' + file[1] + '"')
- #os.system('sudo chmod 600 "' + file[1] + '"')
-
- #os.symlink(dest_file, file[1])
- #print "File linked !"
-
-print total_size
\ No newline at end of file
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import os
-import sys
-import time
-import smtplib
-from email.mime.text import MIMEText
-from email.mime.multipart import MIMEMultipart
-import logging
-
-
-class Logger:
- """A logging object"""
-
- def __init__(self, file):
- self.logger = logging.getLogger('myapp')
- self.hdlr = logging.FileHandler(file)
- self.formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
- self.hdlr.setFormatter(self.formatter)
- self.logger.addHandler(self.hdlr)
- self.logger.setLevel(logging.INFO)
-
- def write(self, message):
- self.logger.info(message)
-
-
-class ParissonMailLogger:
-
- def __init__(self, emails, server, service, txt_file=None):
- self.emails = emails
- self.server = server
- self.service = service
- self.user = 'logger'
- self.user_email = self.user + '@' + self.server
- self.smtp_server = smtplib.SMTP('localhost')
- self.date = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())
- self.msg = self.date + ' : ' + self.service + ' has logged this information'
- self.mime_msg = MIMEMultipart()
- self.mime_msg['Subject'] = 'URGENT ! ' + self.server + ' : ' + self.service
- self.mime_msg['To'] = ', '.join(self.emails)
- self.mime_msg['From'] = self.user_email
- self.mime_txt = MIMEText(self.msg)
- self.mime_msg.attach(self.mime_txt)
- if txt_file:
- self.txt_file = open(txt_file, 'r')
- self.mime_txt = MIMEText(self.txt_file.read())
- self.mime_msg.attach(self.mime_txt)
- self.txt_file.close()
-
- def send(self):
- self.smtp_server.sendmail(self.user_email, self.emails, self.mime_msg.as_string())
-
-def main():
- txt_file = sys.argv[-1]
- service = sys.argv[-2]
- server = sys.argv[-3]
- emails = ['yomguy@sfr.fr','yomguy@parisson.com', 'janob@parisson.com']
-
- date = os.path.getmtime(txt_file)
- laps = time.time() - date
- if laps < 60:
- p = ParissonMailLogger(emails, server, service, txt_file)
- p.send()
- p.smtp_server.quit()
-
-if __name__ == '__main__':
- main()
-
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import os
-import sys
-import time
-import socket
-import smtplib
-from email.mime.text import MIMEText
-from email.mime.multipart import MIMEMultipart
-
-class ParissonMailLogger:
-
- def __init__(self, emails, service, txt_file=None):
- self.emails = emails
- self.server = socket.gethostbyaddr(socket.gethostname())[0]
- self.service = service
- self.user = 'logger-no-reply'
- self.user_email = self.user + '@' + self.server
- self.smtp_server = smtplib.SMTP('localhost')
- self.date = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())
- self.msg = self.date + ' : ' + self.service + ' has logged this information'
- self.mime_msg = MIMEMultipart()
- self.mime_msg['Subject'] = self.server + ' : ' + self.service
- self.mime_msg['To'] = ', '.join(self.emails)
- self.mime_msg['From'] = self.user_email
- self.mime_txt = MIMEText(self.msg)
- self.mime_msg.attach(self.mime_txt)
- if txt_file:
- self.txt_file = open(txt_file, 'r')
- self.mime_txt = MIMEText(self.txt_file.read())
- self.mime_msg.attach(self.mime_txt)
- self.txt_file.close()
-
- def send(self):
- self.smtp_server.sendmail(self.user_email, self.emails, self.mime_msg.as_string())
-
-def main():
- txt_file = sys.argv[-2]
- service = sys.argv[-3]
- emails = sys.argv[-1].split(',')
-
- p = ParissonMailLogger(emails, service, txt_file)
- p.send()
- p.smtp_server.quit()
-
-if __name__ == '__main__':
- main()
-
+++ /dev/null
-#!/usr/bin/python
-
-import os
-import time
-
-service = 'apache2'
-mails = ['yomguy@sfr.fr','pellerin@parisson.com']
-server = 'ns37892'
-file = '/tmp/restartd_apache.tmp'
-
-def touch_and_mail(server, service, mails, file):
- for mail in mails:
- command = 'echo "'+service+' crashed" | mail -s"'+server+'" '+mail
- os.system('touch '+file)
- os.system(command)
-
-
-if not os.path.exists(file):
- touch_and_mail(server, service, mails, file)
-
-date = os.path.getmtime(file)
-laps = time.time() - date
-print laps
-if laps > 120:
- touch_and_mail(server, service, mails, file)
-
-
+++ /dev/null
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-import sys
-import twitter
-
-
-# @deefuzz_test3
-test_key='146002442-qgtArE6YrpLfL6h51LnE5TA9skcKhOqDraNDaOY'
-test_secret='8RWoZjllOv52PUmXbLJcu5qunY8qAa6V6pyLGBHEcg'
-
-# @parisson_studio
-ps_key='223431436-8uYqGM0tLHBiMbk6Bt39oBfwXpylfLcr7t6bs311'
-ps_secret='SzWD3fDgBpw9qwNNrYarXTcRJSTklp0PpKXg7Iw'
-
-# @parisson_com
-pc_key='241046394-MpI5YrkgHSjW0Ab4WIlU0nJruGqesLueCWDJ1qtx'
-pc_secret='6gRzqDvqkjhRzFCfetdWfZYPQdbvQQhVEhhGHQ90JCM'
-
-# Twitter DeeFuzzer keys
-DEEFUZZER_CONSUMER_KEY = 'ozs9cPS2ci6eYQzzMSTb4g'
-DEEFUZZER_CONSUMER_SECRET = '1kNEffHgGSXO2gMNTr8HRum5s2ofx3VQnJyfd0es'
-
-escape = ['parisson_studio', 'parisson_com', 'kvraudio']
-
-class Twitter(object):
-
- def __init__(self, access_token_key, access_token_secret):
- import twitter
- self.consumer_key = DEEFUZZER_CONSUMER_KEY
- self.consumer_secret = DEEFUZZER_CONSUMER_SECRET
- self.access_token_key = access_token_key
- self.access_token_secret = access_token_secret
- self.api = twitter.Api(consumer_key=self.consumer_key,
- consumer_secret=self.consumer_secret,
- access_token_key=self.access_token_key,
- access_token_secret=self.access_token_secret)
- self.followers = self.get_followers()
- self.friends = self.get_friends()
-
- def post(self, message):
- try:
- self.api.PostUpdate(message)
- except:
- pass
-
- def get_friends(self):
- l = []
- for f in self.api.GetFriends():
- l.append(f.screen_name)
- return l
-
- def get_followers(self):
- l = []
- for f in self.api.GetFollowers():
- l.append(f.screen_name)
- return l
-
- def send_private_mess(self, mess, tags):
- for f in self.followers:
- self.api.PostDirectMessage(f, mess + ' #' + (' #').join(tags))
-
- def send_friends_mess(self, mess, tags):
- mess_header = mess
- for f in self.friends:
- if not f in escape:
- mess = '@' + f + ' ' + mess_header + ' #' + ' #'.join(tags)
- print mess
- self.post(mess)
-
- def add_friends(self, friends):
- for f in friends:
- if not f in self.friends and not f in escape:
- self.api.CreateFriendship(f)
-
-if __name__ == '__main__':
- mess = 'TC-202 Case : the mobile media solution now released by Parisson http://bit.ly/gSvqaF'
- tags = ['proaudio', 'broadcast']
-
- print ('IN')
- twitt_in = Twitter(ps_key, ps_secret)
- print str(len(twitt_in.followers)) + ' Followers:'
- print twitt_in.followers
- print str(len(twitt_in.friends)) + ' Friends:'
- print twitt_in.friends
-
- print ('OUT')
- twitt_out = Twitter(pc_key, pc_secret)
- print str(len(twitt_out.followers)) + ' Followers:'
- print twitt_out.followers
- print str(len(twitt_out.friends)) + ' Friends:'
- print twitt_out.friends
-
- #twitt_out.add_friends(twitt_in.friends)
- #twitt.send_private_mess(mess, tags)
- twitt_out.send_friends_mess(mess, tags)
-
- print 'OK'
-
-
\ No newline at end of file
+++ /dev/null
-#!/usr/bin/python
-# 1 mp3 to m3u
-# depends: fapg
-
-import os, sys, string
-
-host = 'audio.pre-barreau.com'
-root_dir = '/home/pro-barreau/www/audio'
-web_dir = '/'
-types = ['mp3','ogg','flac']
-
-#s.chdir(root_dir)
-
-for root, dirs, files in os.walk(root_dir+web_dir):
- #print root
- for file in files:
- file_split = file.split('.')
- filename = file_split[len(file_split)-2]
- #print filename
- if not os.path.exists(root+os.sep+filename+'.m3u'):
- fileext = file_split[len(file_split)-1]
- if fileext in types :
- os.chdir(root_dir)
- prefix = 'http://'+host+'/'
- dest_dir = string.replace(root,'/home/pro-barreau/www/audio/','')
- file_new = string.replace(file,' ','_')
- filename_new = string.replace(filename,' ','_')
- if file_new != file:
- os.system('mv "'+dest_dir+os.sep+file+'" "'+dest_dir+os.sep+file_new+'"')
- os.system('fapg -f m3u -p '+prefix+' -o "'+root+os.sep+filename_new+'.m3u" "'+dest_dir+os.sep+file_new+'"')
-
+++ /dev/null
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-import os, sys, stat, time
-
-if len(sys.argv) <= 2:
- exit('Usage : python rm_date.py MONTH YEAR PATH')
-
-
-dir = sys.argv[-1]
-year = int(sys.argv[-2])
-month = int(sys.argv[-3])
-
-date_file_list = []
-for root, dirs, files in os.walk(dir):
- for file in files:
- #print file
- stats = os.stat(root+os.sep+file)
- lastmod_date = time.strftime("%d_%m_%Y",time.localtime(stats[stat.ST_MTIME]))
- date_file_tuple = lastmod_date, root+os.sep+file
- date_file_list.append(date_file_tuple)
-
-date_file_list.sort()
-date_file_list.reverse() # newest mod date now first
-
-for file in date_file_list:
- if os.path.isfile(file[1]):
- date = file[0].split('_')
- m = int(date[1])
- y = int(date[2])
- if y <= year and m <= month:
- os.remove(file[1])
- print 'removed : ', y, m, file
-
-
\ No newline at end of file
+++ /dev/null
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-# 1 mp3 to m3u
-# depends: fapg
-
-import os, sys, string
-
-stretch_app = '/home/momo/apps/audio/paulstretch_python/paulstretch_newmethod.py'
-root_dir = '/home/momo/music_local/source'
-dest_dir = '/home/momo/music_local/stretch'
-types = ['wav','WAV']
-streches = ['0.25','0.5','2','10','50']
-
-for root, dirs, files in os.walk(root_dir):
- for file in files:
- print file
- in_file = root+os.sep+file
- file_split = file.split('.')
- filename = file_split[len(file_split)-2]
- for s in streches:
- new_file = dest_dir+os.sep+filename+'_s'+s+'.wav'
- if not os.path.exists(new_file):
- os.system(stretch_app + ' -s '+s+' "'+in_file+'" "'+new_file+'"')
-
-
+++ /dev/null
-"""Python interface to Webthumb API (see http://bluga.net/webthumb/)
-
-By Ross Poulton - www.rossp.org
-
-License: Use this how you like, just don't claim it as your own because
- that isn't cool. I'm not responsible for what this script does.
-
-Usage: Define WEBTHUMB_APIKEY with your API key, as per the above URL.
-
-Then, just call get_thumbnail(url, output_path). It will return true on
-success, false on anything else.
-
-An optional third parameter can be passed for the image size.
-"""
-
-import time
-import os
-import httplib
-
-import xml.dom.minidom
-from xml.dom.minidom import Node
-
-WEBTHUMB_APIKEY='e1716f8b48a6b9f4b27fa9d06fbc8579'
-
-WEBTHUMB_HOST='webthumb.bluga.net'
-WEBTHUMB_URI='/api.php'
-
-VALID_SIZES = (
- 'small',
- 'medium',
- 'medium2',
- 'large',
-)
-
-def get_thumbnail(url, output_path, size='medium2'):
- if size not in VALID_SIZES:
- return False
-
- request = """
-<webthumb>
- <apikey>%s</apikey>
- <request>
- <url>%s</url>
- <output_type>png</output_type>
- </request>
-</webthumb>
- """ % (WEBTHUMB_APIKEY, url)
-
- h = httplib.HTTPConnection(WEBTHUMB_HOST)
- h.request("GET", WEBTHUMB_URI, request)
- response = h.getresponse()
-
- type = response.getheader('Content-Type', 'text/plain')
- body = response.read()
- h.close()
- if type == 'text/xml':
- # This is defined as 'success' by the API. text/plain is failure.
- doc = xml.dom.minidom.parseString(body)
- wait = 1
- for node in doc.getElementsByTagName("job"):
- wait = node.getAttribute('estimate')
- key = ""
- for node2 in node.childNodes:
- if node2.nodeType == Node.TEXT_NODE:
- key = node2.data
-
- # We're given an approx time by the webthumb server,
- # we shouldn't request the thumbnail again within this
- # time.
- time.sleep(int(wait))
-
- request = """
- <webthumb>
- <apikey>%s</apikey>
- <fetch>
- <job>%s</job>
- <size>%s</size>
- </fetch>
- </webthumb>
- """ % (WEBTHUMB_APIKEY, key, size)
-
- h = httplib.HTTPConnection(WEBTHUMB_HOST)
- h.request("GET", WEBTHUMB_URI, request)
- response = h.getresponse()
- try:
- os.unlink(output_path)
- except:
- pass
- img = file(output_path, "wb")
- img.write(response.read())
- img.close()
- h.close()
- return True
- else:
- return False
+++ /dev/null
-#!/usr/bin/python
-# Create thumbs of webpages from a list of URLs
-
-# depends : webthumb, imagemagick
-
-import os
-import sys
-from webthumb import get_thumbnail
-
-img_dir = '/var/www/files/img/webthumbs'
-site_list_file = '/var/www/files/img/webthumbs/webthumb_list.txt'
-
-def main(site_list_file, img_dir):
- site_list = open(site_list_file,'r')
- for site in site_list.readlines():
- site = site[0:len(site)-1]
- if site:
- print site
- file = site.replace('/','_')
- file = img_dir+os.sep+file+'.png'
- print file
- get_thumbnail('http://'+site, file,'large')
- site_list.close()
- print 'Webthumbs created !'
-
-if __name__ == '__main__':
- main(site_list_file, img_dir)
--- /dev/null
+#!/usr/bin/python
+# Backups all zope instances (any versions)
+#
+# Depends : zope_instance.py
+# Copyright (C) 2007-2009 Guillaume Pellerin
+
+import os
+import sys
+from zope_instance import *
+
+version = '0.2'
+info = 'zope_backup v'+version+'\n'+ \
+ """Copyright (C) 2007-2009 Guillaume Pellerin
+ Usage: zope_backup DIRECTORY
+ where DIRECTORY is the directory where you want to backup
+ the instances of the different versions of zope."""
+print info
+
+backup_dir = sys.argv[-1]
+if not os.path.exists(backup_dir):
+ sys.exit('This backup directory does not exists !')
+
+z = ZopeInstall()
+instances = z.get_instances()
+
+def backup_all():
+ for version in instances:
+ for instance in instances[version]:
+ z = ZopeInstance(version, instance, backup_dir)
+ print 'Backuping : ' + z.get_instance_dir() + '...'
+ z.backup()
+ print version + ': ' + instance + ' backuped !'
+
+if __name__ == '__main__':
+ backup_all()
+ print "Backup_all Zopes done !"
+
--- /dev/null
+#!/usr/bin/python
+#
+# Depends : zope_instance.py
+# Copyright (C) 2007-2008 Guillaume Pellerin
+
+import os
+import sys
+from zope_instance import *
+
+version = '0.2'
+info = 'zope_check v'+version+'\n'+ \
+ """Copyright (C) 2007-2008 Guillaume Pellerin
+ Usage: zope_backup DIRECTORY
+ where DIRECTORY is the directory where you want to backup
+ the instances of the different versions of zope."""
+
+#if len(sys.argv) < 2:
+# sys.exit(info)
+#else :
+# backup_dir = sys.argv[1]
+
+z = ZopeInstall()
+instances = z.get_instances()
+instance_main_dir = z.instance_main_dir
+
+def get_zope_port(main_dir):
+ conf_path = main_dir + os.sep + 'etc' + os.sep + 'zope.conf'
+ conf = open(conf_path, 'r')
+ lines = conf.readlines()
+ for line in lines:
+ if 'HTTPPORT' in line:
+ return main_dir+': ' + line
+
+def check_all():
+ for version in instances:
+ for instance in instances[version]:
+ z = ZopeInstance(version, instance)
+ print get_zope_port(z.get_instance_dir())
+
+if __name__ == '__main__':
+ check_all()
+
+
+
--- /dev/null
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2007 Guillaume Pellerin <yomguy@parisson.com>
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Guillaume Pellerin <yomguy@parisson.com>
+
+
+import os
+import sys
+from optparse import OptionParser
+
+
+class ZopeInstall:
+ """This give the main parameters of the Zope installations respectively to the
+ distribution used"""
+
+ def __init__(self):
+ self.versions = ['2.7', '2.9', '2.8', '2.10']
+ self.instance_main_dir = '/var/lib'
+ self.zope_main_dir = '/usr/lib'
+
+ def get_instances(self):
+ """Return all instances in all zope versions installed"""
+ dict = {}
+ for version in self.versions:
+ #print version
+ path = self.instance_main_dir + os.sep + 'zope' + version + os.sep + 'instance'
+ if os.path.exists(path):
+ dict[version] = os.listdir(path)
+ #print dict
+ return dict
+
+
+class ZopeInstance(ZopeInstall):
+ """Expose Zope instances to several python methods that simplifies admins' life
+ (backup, recover, import, etc...)"""
+
+ def __init__(self, version, instance, backup_dir):
+ ZopeInstall.__init__(self)
+ self.version = version
+ self.instance = instance
+ self.backup_dir = backup_dir
+ self.instance_dir = self.instance_main_dir + os.sep + 'zope' + version + os.sep + \
+ 'instance' + os.sep + self.instance
+ self.instance_data = self.instance_dir + os.sep + 'var' + os.sep + 'Data.fs'
+ self.instance_products = self.instance_dir + os.sep + 'Products' + os.sep
+ self.instance_var = self.instance_dir + os.sep + 'var' + os.sep
+ self.instance_etc = self.instance_dir + os.sep + 'etc' + os.sep
+ self.instance_lib = self.instance_dir + os.sep + 'lib' + os.sep
+ self.repozo = self.zope_main_dir + os.sep + 'zope' + self.version + os.sep + 'bin' + os.sep + 'repozo.py'
+ self.instance_backup_dir = self.backup_dir + os.sep + self.version + os.sep + self.instance
+
+ def get_instance_dir(self):
+ return self.instance_dir
+
+ def tar(self, name, sub_dir):
+ os.chdir(self.instance_backup_dir)
+ if os.path.exists(sub_dir):
+ command = 'tar czf ' + self.instance_backup_dir + os.sep + \
+ name + '.tar.gz ' + sub_dir + ' --exclude=Data.fs'
+ os.system(command)
+
+ def untar(self, name, sub_dir):
+ os.chdir(self.instance_backup_dir)
+ print 'Recovering ' + sub_dir
+ command = 'tar xzf ' + name + '.tar.gz && ' + \
+ 'rsync -a ' + './' + self.instance_dir + os.sep + name + os.sep + ' ' + sub_dir + ' && ' + \
+ 'chown -R zope:zope ' + sub_dir + os.sep + ' && ' + \
+ 'rm -rf ' + './' + self.instance_dir + os.sep + name
+ os.system(command)
+
+ def backup(self):
+ """Backup the instance"""
+
+ path = self.instance_backup_dir+ os.sep + 'Data'
+ if not os.path.exists(path):
+ os.makedirs(path)
+ if os.path.exists(self.instance_data):
+ command = 'export PYTHONPATH='+ self.zope_main_dir + os.sep + 'zope' + self.version + os.sep + \
+ 'lib/python/ && '+ self.repozo +' -Bvz -r ' + path + ' -f ' + self.instance_data
+ os.system(command)
+ command = 'chmod -R 700 ' + path + os.sep
+ os.system(command)
+ else:
+ print self.instance_data + ' does not exists !'
+ if not os.path.exists(self.instance_backup_dir):
+ os.makedirs(self.instance_backup_dir)
+
+ self.tar('Products', self.instance_products)
+ self.tar('var', self.instance_var)
+ self.tar('etc', self.instance_etc)
+ self.tar('lib', self.instance_lib)
+
+ 'rm -rf ' + './' + self.instance_dir
+ print self.instance + ' backuped !'
+
+ def recover(self):
+ """Recover the instance from a backup"""
+
+ self.untar('Products', self.instance_products)
+ self.untar('var', self.instance_var)
+ self.untar('etc', self.instance_etc)
+ self.untar('lib', self.instance_lib)
+
+ command = self.repozo + ' -Rvz -r ' + self.instance_backup_dir + os.sep + \
+ 'Data -o ' + self.instance_data
+ if os.path.exists(self.instance_data):
+ os.system(command)
+ else:
+ print self.instance_data + ' does not exists !'
+
+ command = self.instance_dir+os.sep+'bin'+os.sep+'zopectl restart'
+ os.system(command)
+
+ print self.instance + ' recovered !'
+
+ def import_from(self, user, server):
+ command = 'rsync -a --rsh="ssh -l '+user+'" ' + \
+ user+'@'+server+':'+self.instance_backup_dir+os.sep + ' ' + self.instance_backup_dir+os.sep
+ os.system(command)
+
+ def export_to(self, user, server):
+ command = 'rsync -a --rsh="ssh -l '+user+'" ' + \
+ self.instance_backup_dir+os.sep + ' ' + user+'@'+server+':'+self.instance_backup_dir+os.sep
+ os.system(command)
+
+
--- /dev/null
+#!/usr/bin/python
+# Recover all zope instances (any versions)
+#
+# Depends : zope_instance.py
+# Copyright (C) 2007-2009 Guillaume Pellerin
+
+import os
+import sys
+from zope_instance import *
+
+version = '0.2'
+info = 'zope_recover v'+version+'\n'+ \
+ """Copyright (C) 2007-2009 Guillaume Pellerin
+ Usage: zope_recover DIRECTORY
+ where DIRECTORY is the directory where you want to backup
+ the instances of the different versions of zope."""
+print info
+
+backup_dir = sys.argv[-1]
+#print backup_dir
+if not os.path.exists(backup_dir):
+ sys.exit('This backup directory does not exists !')
+
+z = ZopeInstall()
+instances = z.get_instances()
+
+def recover_all():
+ for version in instances:
+ for instance in instances[version]:
+ z = ZopeInstance(version, instance, backup_dir)
+ print 'Recovering : ' + z.get_instance_dir() + '...'
+ z.recover()
+ print version + ': ' + instance + ' recovered !'
+
+if __name__ == '__main__':
+ recover_all()
+ print "Recover all Zope instances done !"
+