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

raeburn raeburn at source.lon-capa.org
Tue Jul 2 10:08:57 EDT 2024


raeburn		Tue Jul  2 14:08:57 2024 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/publisher	lonpublisher.pm 
  Log:
  - For 2.11
    Backport 1.304
  
  
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.295.2.1 loncom/publisher/lonpublisher.pm:1.295.2.2
--- loncom/publisher/lonpublisher.pm:1.295.2.1	Fri Jun  4 15:09:36 2021
+++ loncom/publisher/lonpublisher.pm	Tue Jul  2 14:08:57 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.295.2.1 2021/06/04 15:09:36 raeburn Exp $
+# $Id: lonpublisher.pm,v 1.295.2.2 2024/07/02 14:08:57 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1924,11 +1924,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;
@@ -1964,6 +1960,15 @@
     return 1;
 }
 
+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
@@ -2109,6 +2114,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));
@@ -2117,7 +2125,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