Ticket #835: patch.txt

File patch.txt, 1.4 kB (added by dominiquearpin, 1 year ago)

sorry for the noise.... I clean my code

Line 
1 --- trunk/engine/setup/ispcp-setup.orig 2007-11-29 09:26:09.000000000 -0500
2 +++ trunk/engine/setup/ispcp-setup      2007-11-29 13:37:34.000000000 -0500
3 @@ -2470,15 +2470,24 @@
4         #
5  
6         if ($main::cfg{'AWSTATS_ACTIVE'} eq 'yes') {
7 -               if (-f "/etc/logrotate.d/apache") {
8 -                       # TODO: Fix, if awstats.pl allready added
9 -                       sys_command_rs("sed -i 's#postrotate#postrotate\n\t\$main::cfg{'AWSTATS_ROOT_DIR'}/awstats_updateall.pl now -awstatsprog=$main::cfg{'AWSTATS_ENGINE_DIR'}/awstats.pl#g' /etc/logrotate.d/apache");
10 -               }
11 -               elsif (-f "/etc/loglogrotate.d/apache2") {
12 -                       # TODO: Fix, if awstats.pl allready added
13 -                       sys_command_rs("sed -i 's#postrotate#postrotate\n\t\{AWSTATS_ROOT_DIR}/awstats_updateall.pl now -awstatsprog=$main::cfg{'AWSTATS_ENGINE_DIR'}/awstats.pl#g' /etc/logrotate.d/apache2");
14 -               }
15  
16 +       @apache_file = ("apache","apache2");           
17 +       foreach $apache_file (@apache_file){
18 +               if (-f "/etc/logrotate.d/apache" . $apache_file) {
19 +                       $file = "/etc/logrotate.d/" . $apache_file;
20 +                       $word = "awstats_updateall.pl";
21 +                       
22 +                       open F, $file;
23 +                       @lines = <F>;
24 +                       close F;
25 +                       
26 +                       $nummatches = grep(/$word/, @lines);
27 +
28 +                       if ($nummatches == 0) {
29 +                               sys_command_rs("sed -i 's#sharedscripts#sharedscripts\n\tprerotate\n\t\t$main::cfg{'AWSTATS_ROOT_DIR'}/awstats_updateall.pl now -awstatsprog=$main::cfg{'AWSTATS_ENGINE_DIR'}/awstats.pl &> /dev/null\n\tendscript#g' /etc/logrotate.d/apache");
30 +                       }
31 +               }
32 +       }
33         #
34         # manage some permission;
35         #