[LON-CAPA-cvs] cvs: loncom /publisher lonpublisher.pm

raeburn raeburn at source.lon-capa.org
Sat Jun 1 18:25:23 EDT 2024


raeburn		Sat Jun  1 22:25:23 2024 EDT

  Modified files:              
    /loncom/publisher	lonpublisher.pm 
  Log:
  - Bug 6991 
    Always include &notify() as one of the handlers in the PerlCleanupHandler
    phase whenever a lock is set.
  
  
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.303 loncom/publisher/lonpublisher.pm:1.304
--- loncom/publisher/lonpublisher.pm:1.303	Fri Jul 14 22:19:22 2023
+++ loncom/publisher/lonpublisher.pm	Sat Jun  1 22:25:23 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.303 2023/07/14 22:19:22 raeburn Exp $
+# $Id: lonpublisher.pm,v 1.304 2024/06/01 22:25:23 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2129,11 +2129,7 @@
 
 # ------------------------------------------------------------- Trigger updates
     push(@{$modified_urls},[$target,$source]);
-    unless ($registered_cleanup) {
-        my $handlers = $r->get_handlers('PerlCleanupHandler');
-        $r->set_handlers('PerlCleanupHandler' => [\&notify,@{$handlers}]);
-	$registered_cleanup=1;
-    }
+    &notify_in_cleanup($r);
 
 # ---------------------------------------------------------- Clear local caches
     my $thisdistarget=$target;
@@ -2189,6 +2185,15 @@
     }
 }
 
+sub notify_in_cleanup {
+    my ($r) = @_;
+    unless ($registered_cleanup) {
+        my $handlers = $r->get_handlers('PerlCleanupHandler');
+        $r->set_handlers('PerlCleanupHandler' => [\&notify,@{$handlers}]);
+        $registered_cleanup=1;
+    }
+}
+
 # =============================================================== Notifications
 sub notify {  
 # --------------------------------------------------- Send update notifications
@@ -2350,6 +2355,9 @@
         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) {
+            &notify_in_cleanup($r);
+        }
 # actually publish things
 	opendir(DIR,$fn);
 	my @files=sort(readdir(DIR));
@@ -2358,7 +2366,7 @@
 		$cuid,$cgid,$crdev,$csize,
 		$catime,$cmtime,$cctime,
 		$cblksize,$cblocks)=stat($fn.'/'.$filename);
-	    
+
 	    my $extension='';
 	    if ($filename=~/\.(\w+)$/) { $extension=$1; }
 	    if ($cmode&$dirptr) {




More information about the LON-CAPA-cvs mailing list