--- loncom/publisher/lonpublisher.pm 2024/07/03 21:21:46 1.295.2.3 +++ loncom/publisher/lonpublisher.pm 2024/12/30 17:13:26 1.295.2.4 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.295.2.3 2024/07/03 21:21:46 raeburn Exp $ +# $Id: lonpublisher.pm,v 1.295.2.4 2024/12/30 17:13:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -420,7 +420,7 @@ sub common_access { } my %lt = &Apache::lonlocal::texthash( 'default' => 'System wide - can be used for any courses system wide', - 'domain' => 'Domain only - use limited to courses in the domai', + 'domain' => 'Domain only - use limited to courses in the domain', 'custom' => 'Customized right of use ...', 'public' => 'Public - no authentication or authorization required for use', 'closed' => 'Closed - XML source is closed to everyone', @@ -1972,36 +1972,39 @@ sub notify_in_cleanup { # =============================================================== Notifications sub notify { # --------------------------------------------------- Send update notifications - foreach my $targetsource (@{$modified_urls}){ - my ($target,$source)=@{$targetsource}; - my $logfile=Apache::File->new('>>'.$source.'.log'); - print $logfile "\nCleanup phase: Notifications\n"; - my @subscribed=&get_subscribed_hosts($target); - foreach my $subhost (@subscribed) { - print $logfile "\nNotifying host ".$subhost.':'; - my $reply=&Apache::lonnet::critical('update:'.$target,$subhost); - print $logfile $reply; - } + if (ref($modified_urls) eq 'ARRAY') { + foreach my $targetsource (@{$modified_urls}){ + my ($target,$source)=@{$targetsource}; + my $logfile=Apache::File->new('>>'.$source.'.log'); + print $logfile "\nCleanup phase: Notifications\n"; + my @subscribed=&get_subscribed_hosts($target); + foreach my $subhost (@subscribed) { + print $logfile "\nNotifying host ".$subhost.':'; + my $reply=&Apache::lonnet::critical('update:'.$target,$subhost); + print $logfile $reply; + } # ---------------------------------------- Send update notifications, meta only - my @subscribedmeta=&get_subscribed_hosts("$target.meta"); - foreach my $subhost (@subscribedmeta) { - print $logfile "\nNotifying host for metadata only ".$subhost.':'; - my $reply=&Apache::lonnet::critical('update:'.$target.'.meta', - $subhost); - print $logfile $reply; - } + my @subscribedmeta=&get_subscribed_hosts("$target.meta"); + foreach my $subhost (@subscribedmeta) { + print $logfile "\nNotifying host for metadata only ".$subhost.':'; + my $reply=&Apache::lonnet::critical('update:'.$target.'.meta', + $subhost); + print $logfile $reply; + } # --------------------------------------------------- Notify subscribed courses - my %courses=&coursedependencies($target); - my $now=time; - foreach my $course (keys(%courses)) { - print $logfile "\nNotifying course ".$course.':'; - my ($cdom,$cname)=split(/\_/,$course); - my $reply=&Apache::lonnet::cput - ('versionupdate',{$target => $now},$cdom,$cname); - print $logfile $reply; - } - print $logfile "\n============ Done ============\n"; - $logfile->close(); + my %courses=&coursedependencies($target); + my $now=time; + foreach my $course (keys(%courses)) { + print $logfile "\nNotifying course ".$course.':'; + my ($cdom,$cname)=split(/\_/,$course); + my $reply=&Apache::lonnet::cput + ('versionupdate',{$target => $now},$cdom,$cname); + print $logfile $reply; + } + print $logfile "\n============ Done ============\n"; + $logfile->close(); + } + $modified_urls = []; } if ($lock) { &Apache::lonnet::remove_lock($lock); } return OK;