Diff for /loncom/publisher/lonpublisher.pm between versions 1.181 and 1.182

version 1.181, 2005/01/05 20:11:19 version 1.182, 2005/01/12 16:18:54
Line 138  my $docroot; Line 138  my $docroot;
 my $cuname;  my $cuname;
 my $cudom;  my $cudom;
   
   my $registered_cleanup;
   
 =pod  =pod
   
 =item B<metaeval>  =item B<metaeval>
Line 1543  sub phasetwo { Line 1545  sub phasetwo {
     $r->rflush;      $r->rflush;
   
 # ------------------------------------------------------------- Trigger updates  # ------------------------------------------------------------- Trigger updates
     $ENV{'internal.publication.target'}=$target;      print $logfile("\nRegistering for notifications: $target $source\n");
     $ENV{'internal.publication.source'}=$source;      push(@{$ENV{'internal.publication.targetsource'}},[$target,$source]);
     $r->register_cleanup(\&notify);      unless ($registered_cleanup) {
    &Apache::lonnet::logthis('Cleanup handler registered');
    $r->register_cleanup(\&notify);
    $registered_cleanup=1;
       }
 # ------------------------------------------------ Provide link to new resource  # ------------------------------------------------ Provide link to new resource
     unless ($batch) {      unless ($batch) {
         my $thisdistarget=$target;          my $thisdistarget=$target;
Line 1575  sub phasetwo { Line 1580  sub phasetwo {
 # =============================================================== Notifications  # =============================================================== Notifications
 sub notify {    sub notify {  
 # --------------------------------------------------- Send update notifications  # --------------------------------------------------- Send update notifications
     my $target=$ENV{'internal.publication.target'};      &Apache::lonnet::logthis('Cleanup Phase Publication Handler');
     my $source=$ENV{'internal.publication.source'};      foreach my $targetsource (@{$ENV{'internal.publication.targetsource'}}){
     my $logfile=Apache::File->new('>>'.$source.'.log');   my ($target,$source)=@{$targetsource};
     print $logfile "\nCleanup phase: Notifications\n";   my $logfile=Apache::File->new('>>'.$source.'.log');
     my @subscribed=&get_subscribed_hosts($target);   print $logfile "\nCleanup phase: Notifications\n";
     foreach my $subhost (@subscribed) {   my @subscribed=&get_subscribed_hosts($target);
  print $logfile "\nNotifying host ".$subhost.':';   foreach my $subhost (@subscribed) {
  my $reply=&Apache::lonnet::critical('update:'.$target,$subhost);      print $logfile "\nNotifying host ".$subhost.':';
  print $logfile $reply;      my $reply=&Apache::lonnet::critical('update:'.$target,$subhost);
     }      print $logfile $reply;
    }
 # ---------------------------------------- Send update notifications, meta only  # ---------------------------------------- Send update notifications, meta only
     my @subscribedmeta=&get_subscribed_hosts("$target.meta");   my @subscribedmeta=&get_subscribed_hosts("$target.meta");
     foreach my $subhost (@subscribedmeta) {   foreach my $subhost (@subscribedmeta) {
  print $logfile "\nNotifying host for metadata only ".$subhost.':';      print $logfile "\nNotifying host for metadata only ".$subhost.':';
  my $reply=&Apache::lonnet::critical('update:'.$target.'.meta',      my $reply=&Apache::lonnet::critical('update:'.$target.'.meta',
     $subhost);   $subhost);
  print $logfile $reply;      print $logfile $reply;
     }    } 
 # --------------------------------------------------- Notify subscribed courses  # --------------------------------------------------- Notify subscribed courses
     my %courses=&coursedependencies($target);   my %courses=&coursedependencies($target);
     my $now=time;   my $now=time;
     foreach (keys %courses) {   foreach (keys %courses) {
  print $logfile "\nNotifying course ".$_.':';      print $logfile "\nNotifying course ".$_.':';
         my ($cdom,$cname)=split(/\_/,$_);      my ($cdom,$cname)=split(/\_/,$_);
  my $reply=&Apache::lonnet::cput      my $reply=&Apache::lonnet::cput
                   ('versionupdate',{$target => $now},$cdom,$cname);   ('versionupdate',{$target => $now},$cdom,$cname);
  print $logfile $reply;      print $logfile $reply;
    }
    print $logfile "\n============ Done ============\n";
    $logfile->close();
     }      }
     print $logfile "\n============ Done ============\n";      return OK;
     $logfile->close();  
 }  }
   
 #########################################  #########################################
Line 1816  sub handler { Line 1824  sub handler {
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             ['filename']);                                              ['filename']);
   
   # ------------------------------------------------- Flag for registered cleanup
       $registered_cleanup=0;
 # -------------------------------------------------------------- Check filename  # -------------------------------------------------------------- Check filename
   
     my $fn=&Apache::lonnet::unescape($ENV{'form.filename'});      my $fn=&Apache::lonnet::unescape($ENV{'form.filename'});

Removed from v.1.181  
changed lines
  Added in v.1.182


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>