--- loncom/lonnet/perl/lonnet.pm 2024/05/01 12:06:25 1.1526 +++ loncom/lonnet/perl/lonnet.pm 2024/05/21 02:57:16 1.1527 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1526 2024/05/01 12:06:25 raeburn Exp $ +# $Id: lonnet.pm,v 1.1527 2024/05/21 02:57:16 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2802,7 +2802,7 @@ sub get_domain_defaults { $domdefaults{'requestauthor'} = $domconfig{'requestauthor'}; } if (ref($domconfig{'authordefaults'}) eq 'HASH') { - foreach my $item ('nocodemirror','copyright','sourceavail','domcoordacc','editors') { + foreach my $item ('nocodemirror','copyright','sourceavail','domcoordacc','editors','archive') { if ($item eq 'editors') { if (ref($domconfig{'authordefaults'}{'editors'}) eq 'ARRAY') { $domdefaults{$item} = join(',',@{$domconfig{'authordefaults'}{'editors'}}); @@ -5622,6 +5622,39 @@ sub coauthorrolelog { } return; } + +sub authorarchivelog { + my ($hashref,$size,$filesdest,$action) = @_; + my $lonprtdir = $Apache::lonnet::perlvar{'lonPrtDir'}; + my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'}; + $filesdest =~ s{^\Q$lonprtdir/\E}{}; + if ($filesdest =~ m{^($match_username)_($match_domain)_archive_(\d+_\d+_\d+(|[.\w]+))$}) { + my ($auname,$audom,$id) = ($1,$2,$3); + if (ref($hashref) eq 'HASH') { + my $namespace = 'archivelog'; + my $dir; + if ($hashref->{dir} =~ m{^\Q$londocroot/priv/$audom/$auname\E(.*)$}) { + $dir = $1; + } + my $delflag = 0; + my %storehash = ( + id => $id, + dir => $dir, + files => $hashref->{numfiles}, + subdirs => $hashref->{numdirs}, + bytes => $hashref->{bytes}, + size => $size, + action => $action, + ); + if ($action eq 'delete') { + $delflag = 1; + } + &write_log('author',$namespace,\%storehash,$delflag,$auname, + $audom,$auname,$audom); + } + } + return; +} sub get_course_adv_roles { my ($cid,$codes) = @_;