Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 269
- Log:
Overdue upgrade to AWStats v6.9, the most recent version
available at the time of writing.
- Author:
- rool
- Date:
- Wed May 27 23:57:15 +0100 2009
- Size:
- 3684 Bytes
- Properties:
- Property svn:executable is set
1 | #!/usr/bin/perl |
2 | #----------------------------------------------------------------------------- |
3 | # ClusterInfo AWStats plugin |
4 | # This plugin allow you to add information on cluster chart from |
5 | # a text file. Like full cluster hostname. |
6 | # You must create a file called clusterinfo.configvalue.txt wich contains 2 |
7 | # columns separated by a tab char, and store it in DirData directory. |
8 | # First column is cluster number and second column is text you want to add. |
9 | #----------------------------------------------------------------------------- |
10 | # Perl Required Modules: None |
11 | #----------------------------------------------------------------------------- |
12 | # $Revision: 1.2 $ - $Author: eldy $ - $Date: 2008/11/15 16:03:42 $ |
13 | |
14 | |
15 | # <----- |
16 | # ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES |
17 | #if (!eval ('require "TheModule.pm";')) { return $@?"Error: $@":"Error: Need Perl module TheModule"; } |
18 | # -----> |
19 | #use strict; |
20 | no strict "refs"; |
21 | |
22 | |
23 | |
24 | #----------------------------------------------------------------------------- |
25 | # PLUGIN VARIABLES |
26 | #----------------------------------------------------------------------------- |
27 | # <----- |
28 | # ENTER HERE THE MINIMUM AWSTATS VERSION REQUIRED BY YOUR PLUGIN |
29 | # AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE. |
30 | my $PluginNeedAWStatsVersion="6.2"; |
31 | my $PluginHooksFunctions="ShowInfoCluster"; |
32 | # -----> |
33 | |
34 | # <----- |
35 | # IF YOUR PLUGIN NEED GLOBAL VARIABLES, THEY MUST BE DECLARED HERE. |
36 | use vars qw/ |
37 | $clusterinfoloaded |
38 | %ClusterInfo |
39 | /; |
40 | # -----> |
41 | |
42 | |
43 | |
44 | #----------------------------------------------------------------------------- |
45 | # PLUGIN FUNCTION: Init_pluginname |
46 | #----------------------------------------------------------------------------- |
47 | sub Init_clusterinfo { |
48 | my $InitParams=shift; |
49 | my $checkversion=&Check_Plugin_Version($PluginNeedAWStatsVersion); |
50 | |
51 | # <----- |
52 | # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS |
53 | debug(" Plugin clusterinfo: InitParams=$InitParams",1); |
54 | $clusterinfoloaded=0; |
55 | %ClusterInfo=(); |
56 | # -----> |
57 | |
58 | return ($checkversion?$checkversion:"$PluginHooksFunctions"); |
59 | } |
60 | |
61 | |
62 | |
63 | #----------------------------------------------------------------------------- |
64 | # PLUGIN FUNCTION: ShowInfoCluster_pluginname |
65 | # UNIQUE: NO (Several plugins using this function can be loaded) |
66 | # Function called to add additionnal columns to Cluster report. |
67 | # This function is called when building rows of the report (One call for each |
68 | # row). So it allows you to add a column in report, for example with code : |
69 | # print "<TD>This is a new cell</TD>"; |
70 | # Parameters: Cluster number |
71 | #----------------------------------------------------------------------------- |
72 | sub ShowInfoCluster_clusterinfo { |
73 | my $param="$_[0]"; |
74 | # <----- |
75 | my $filetoload=''; |
76 | if ($param && $param ne '__title__' && ! $clusterinfoloaded) { |
77 | # Load clusterinfo file |
78 | if ($SiteConfig && open(CLUSTERINFOFILE,"$DirData/clusterinfo.$SiteConfig.txt")) { $filetoload="$DirData/clusterinfo.$SiteConfig.txt"; } |
79 | elsif (open(CLUSTERINFOFILE,"$DirData/clusterinfo.txt")) { $filetoload="$DirData/clusterinfo.txt"; } |
80 | else { error("Couldn't open ClusterInfo file \"$DirData/clusterinfo.txt\": $!"); } |
81 | # This is the fastest way to load with regexp that I know |
82 | %ClusterInfo = map(/^([^\s]+)\s+(.+)/o,<CLUSTERINFOFILE>); |
83 | close CLUSTERINFOFILE; |
84 | debug(" Plugin clusterinfo: ClusterInfo file loaded: ".(scalar keys %ClusterInfo)." entries found."); |
85 | $clusterinfoloaded=1; |
86 | } |
87 | if ($param eq '__title__') { |
88 | print "<th>$Message[114]</th>"; |
89 | } |
90 | elsif ($param) { |
91 | print "<td class=\"aws\">"; |
92 | if ($ClusterInfo{$param}) { print "$ClusterInfo{$param}"; } |
93 | else { print " "; } # Undefined cluster info |
94 | print "</td>"; |
95 | } |
96 | else { |
97 | print "<td> </td>"; |
98 | } |
99 | return 1; |
100 | # -----> |
101 | } |
102 | |
103 | |
104 | 1; # Do not remove this line |