[LON-CAPA-cvs] cvs: loncom /publisher lonpublisher.pm
raeburn
raeburn at source.lon-capa.org
Sat Jan 4 16:23:34 EST 2025
raeburn Sat Jan 4 21:23:34 2025 EDT
Modified files:
/loncom/publisher lonpublisher.pm
Log:
- Need to set package variables: $cuname and $cudom when &batchpublish()
is being used without invoking lonpublisher::handler().
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.306 loncom/publisher/lonpublisher.pm:1.307
--- loncom/publisher/lonpublisher.pm:1.306 Fri Dec 27 04:01:41 2024
+++ loncom/publisher/lonpublisher.pm Sat Jan 4 21:23:33 2025
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Publication Handler
#
-# $Id: lonpublisher.pm,v 1.306 2024/12/27 04:01:41 raeburn Exp $
+# $Id: lonpublisher.pm,v 1.307 2025/01/04 21:23:33 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2254,6 +2254,18 @@
$srcfile=~/\.(\w+)$/;
my $thistype=$1;
+#
+# If lonpublisher::batchpublish() is called directly from another package
+# instead of via a call to lonpublisher::handler(), need to set the package
+# scalars: $cuname and $cudom, and will unset when done.
+#
+ my $clearvars;
+ if (($cuname eq '') && ($cudom eq '')) {
+ ($cuname,$cudom) = &Apache::lonnet::constructaccess($srcfile);
+ unless (($cuname eq '') && ($cudom eq '')) {
+ $clearvars = 1;
+ }
+ }
my $thisembstyle=&Apache::loncommon::fileembstyle($thistype);
@@ -2268,7 +2280,7 @@
# phase one takes
# my ($source,$target,$style,$batch)=@_;
my ($outstring,$error)=&publish($srcfile,$targetfile,$thisembstyle,1,$nokeyref);
-
+
if ($usebuffer) {
$output .= '<p>'.$outstring.'</p>';
} else {
@@ -2286,6 +2298,10 @@
}
}
%env=%oldenv;
+ if ($clearvars) {
+ undef($cuname);
+ undef($cudom);
+ }
if ($usebuffer) {
return $output;
} else {
More information about the LON-CAPA-cvs
mailing list