initial commit of file from CVS for smeserver-awstats on Sat Sep 7 20:09:28 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 20:09:28 +10:00
parent 2ac31e7de4
commit 4e37dd65ac
29 changed files with 3907 additions and 2 deletions

View File

@@ -0,0 +1,63 @@
#!/usr/bin/perl -w
#----------------------------------------------------------------------
# copyright (C) 2001 neddix, stuttgart
#
# 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 2 of the License, or
# (at your option) 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, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#----------------------------------------------------------------------
package esmith;
use strict;
use Errno;
use esmith::config;
use esmith::util;
use esmith::db;
#------------------------------------------------------------
# run the awstats logfile pre-processor
#------------------------------------------------------------
my $event = $ARGV [0];
my $configDB = esmith::ConfigDB->open or die("can't open Config DB");
my $status = $configDB->get_prop( "AWStats", "status" );
if (defined $status && $status eq "enabled")
{
my $awconfpath="/etc/e-smith/web/panels/manager/cgi-bin/.awstats";
my $mtime;
my $prev_mtime=0;
(undef,undef,undef,undef,undef,undef,undef,undef,undef,$mtime)=stat("$awconfpath/awstats.conf");
exit 0 if (!defined $mtime);
while ($mtime != $prev_mtime) {
open (IN, "$awconfpath/awstats.conf") or die "\nCould not open $awconfpath/awstats.conf\n";
open (OUT, ">$awconfpath/awstats.conf.$$") or die "\nCould not open $awconfpath/awstats.conf.$$\n";
while (<IN>) {
print OUT $_;
}
close (IN);
close (OUT);
(undef,undef,undef,undef,undef,undef,undef,undef,undef,$prev_mtime)=stat("$awconfpath/awstats.conf");
}
esmith::util::backgroundCommand (1, "/sbin/e-smith/awstats-pp", "-c$awconfpath/awstats.conf.$$");
}
exit (0);

View File

@@ -0,0 +1,29 @@
#!/bin/bash
if [[ -d /var/www/awstats/ ]]; then
cp -a /var/www/awstats/icon/* /etc/e-smith/web/panels/manager/html/awstats/icon
cp -a /var/www/awstats/awstats.pl /etc/e-smith/web/panels/manager/cgi-bin/.awstats
cp -a /var/www/awstats/lang /etc/e-smith/web/panels/manager/cgi-bin/.awstats
cp -a /var/www/awstats/lib /etc/e-smith/web/panels/manager/cgi-bin/.awstats
cp -a /var/www/awstats/plugins /etc/e-smith/web/panels/manager/cgi-bin/.awstats
else
rootdir='/usr/share/awstats/'
cp -a $rootdir/wwwroot/icon/* /etc/e-smith/web/panels/manager/html/awstats/icon
cp -a $rootdir/wwwroot/cgi-bin/awstats.pl /etc/e-smith/web/panels/manager/cgi-bin/.awstats
cp -a $rootdir/lang /etc/e-smith/web/panels/manager/cgi-bin/.awstats
cp -a $rootdir/lib /etc/e-smith/web/panels/manager/cgi-bin/.awstats
cp -a $rootdir/plugins /etc/e-smith/web/panels/manager/cgi-bin/.awstats
fi
chmod -R 770 /etc/e-smith/web/panels/manager/cgi-bin/.awstats
#cd /etc/e-smith/web/panels/manager/html/awstats/
ln -sf /etc/e-smith/web/panels/manager/html/awstats/icon/os /etc/e-smith/web/panels/manager/html/awstats/os
ln -sf /etc/e-smith/web/panels/manager/html/awstats/icon/flags /etc/e-smith/web/panels/manager/html/awstats/flags
ln -sf /etc/e-smith/web/panels/manager/html/awstats/icon/browser /etc/e-smith/web/panels/manager/html/awstats/browser
ln -sf /etc/e-smith/web/panels/manager/html/awstats/icon/clock /etc/e-smith/web/panels/manager/html/awstats/clock
ln -sf /etc/e-smith/web/panels/manager/html/awstats/icon/mime /etc/e-smith/web/panels/manager/html/awstats/mime
ln -sf /etc/e-smith/web/panels/manager/html/awstats/icon/other /etc/e-smith/web/panels/manager/html/awstats/other
echo "AWStats upgrade complete"