--- loncom/publisher/lonpublisher.pm 2023/01/23 02:24:50 1.295.2.1.2.1 +++ loncom/publisher/lonpublisher.pm 2024/06/01 22:41:28 1.295.2.1.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.295.2.1.2.1 2023/01/23 02:24:50 raeburn Exp $ +# $Id: lonpublisher.pm,v 1.295.2.1.2.2 2024/06/01 22:41:28 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1924,11 +1924,7 @@ sub phasetwo { # ------------------------------------------------------------- Trigger updates push(@{$modified_urls},[$target,$source]); - unless ($registered_cleanup) { - my $handlers = $r->get_handlers('PerlCleanupHandler'); - $r->set_handlers('PerlCleanupHandler' => [\¬ify,@{$handlers}]); - $registered_cleanup=1; - } + ¬ify_in_cleanup($r); # ---------------------------------------------------------- Clear local caches my $thisdistarget=$target; @@ -1964,6 +1960,15 @@ sub phasetwo { return 1; } +sub notify_in_cleanup { + my ($r) = @_; + unless ($registered_cleanup) { + my $handlers = $r->get_handlers('PerlCleanupHandler'); + $r->set_handlers('PerlCleanupHandler' => [\¬ify,@{$handlers}]); + $registered_cleanup=1; + } +} + # =============================================================== Notifications sub notify { # --------------------------------------------------- Send update notifications @@ -2109,6 +2114,9 @@ sub publishdirectory { my %commonaccess; map { $commonaccess{$_} = 1; } &Apache::loncommon::get_env_multiple('form.commonaccess'); unless ($lock) { $lock=&Apache::lonnet::set_lock(&mt('Publishing [_1]',$fn)); } + if ($lock) { + ¬ify_in_cleanup($r); + } # actually publish things opendir(DIR,$fn); my @files=sort(readdir(DIR)); @@ -2117,7 +2125,7 @@ sub publishdirectory { $cuid,$cgid,$crdev,$csize, $catime,$cmtime,$cctime, $cblksize,$cblocks)=stat($fn.'/'.$filename); - + my $extension=''; if ($filename=~/\.(\w+)$/) { $extension=$1; } if ($cmode&$dirptr) {