Skip to content

Commit

Permalink
Item9293: Update logger so that it logs configuration changes
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@8099 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Jul 10, 2010
1 parent 772f762 commit 3614cc6
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions core/lib/Foswiki/Configure/UIs/UPDATE.pm
Expand Up @@ -38,10 +38,8 @@ sub commitChanges {

my $logfile;
$this->{log} = '';
$this->{user} = '';
if ( defined $Foswiki::query ) {
$this->{user} = $Foswiki::query->remote_user() || '';
}
$this->{user} = $Foswiki::query->remote_user() || $ENV{REMOTE_USER} || '';
$this->{addr} = $Foswiki::query->remote_addr() || $ENV{REMOTE_ADDR} || '';

# Pass ourselves as log listener
Foswiki::Configure::FoswikiCfg::save( $root, $valuer, $this );
Expand All @@ -53,13 +51,14 @@ sub commitChanges {
# input a proper path and therefore untaint rigourously
# NOTE: this assumes configure is properly hardened through the web
# server as instructed in the fine manual!
$Foswiki::cfg{Log}{Dir} =~ /^(.*)$/;
$Foswiki::cfg{Log}{Dir} = $1;
unless ( -d $Foswiki::cfg{Log}{Dir} ) {
mkdir $Foswiki::cfg{Log}{Dir};
my $logdir = $Foswiki::cfg{Log}{Dir};
Foswiki::Configure::Load::expandValue($logdir);
($logdir) = $logdir =~ /^(.*)$/;
unless ( -d $logdir ) {
mkdir $logdir;
}
if ( open( F, '>>', "$Foswiki::cfg{Log}{Dir}/configure.log" ) ) {
print F $this->{log};
if ( open( F, '>>', "$logdir/configure.log" ) ) {
print F $this->{log}."\n";
close(F);
}
}
Expand All @@ -83,8 +82,9 @@ sub logChange {
$this->{log} .= '| '
. gmtime() . ' | '
. $this->{user} . ' | '
. $this->{addr} . ' | '
. $keys . ' | '
. $value, " |\n";
. $value . " |\n";
}
}

Expand Down

0 comments on commit 3614cc6

Please sign in to comment.